@appcorp/fusion-storybook 0.2.45 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base-modules/admission/constants.js +1 -0
- package/base-modules/admission/form.js +1 -1
- package/base-modules/attendance/constants.d.ts +1 -0
- package/base-modules/attendance/constants.js +1 -0
- package/base-modules/attendance/form.js +28 -1
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -17,6 +17,7 @@ export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
|
17
17
|
// ============================================================================
|
|
18
18
|
export const ADMISSION_API_ROUTES = {
|
|
19
19
|
UNIT: "/api/v1/admission",
|
|
20
|
+
DISCOUNT_CODE: "/api/v1/discount-code",
|
|
20
21
|
};
|
|
21
22
|
// ============================================================================
|
|
22
23
|
// STATUS OPTIONS
|
|
@@ -68,7 +68,7 @@ export const AdmissionForm = () => {
|
|
|
68
68
|
});
|
|
69
69
|
}),
|
|
70
70
|
placeholder: t("formDiscountCodePlaceholder"),
|
|
71
|
-
searchEndpoint: ADMISSION_API_ROUTES.
|
|
71
|
+
searchEndpoint: ADMISSION_API_ROUTES.DISCOUNT_CODE,
|
|
72
72
|
searchPlaceholder: t("formSearchDiscountCodesPlaceholder"),
|
|
73
73
|
value: discountCode || "",
|
|
74
74
|
});
|
|
@@ -10,6 +10,7 @@ import { ATTENDANCE_STATUS } from "../../type";
|
|
|
10
10
|
export declare const pageLimit: number;
|
|
11
11
|
export declare const ATTENDANCE_API_ROUTES: {
|
|
12
12
|
readonly UNIT: "/api/v1/attendance";
|
|
13
|
+
readonly STUDENT_PROFILE: "/api/v1/student-profile";
|
|
13
14
|
};
|
|
14
15
|
export declare const ATTENDANCE_STATUS_OPTIONS: {
|
|
15
16
|
label: string;
|
|
@@ -16,6 +16,7 @@ export const pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
|
16
16
|
// ============================================================================
|
|
17
17
|
export const ATTENDANCE_API_ROUTES = {
|
|
18
18
|
UNIT: "/api/v1/attendance",
|
|
19
|
+
STUDENT_PROFILE: "/api/v1/student-profile",
|
|
19
20
|
};
|
|
20
21
|
// ============================================================================
|
|
21
22
|
// STATUS OPTIONS
|
|
@@ -7,10 +7,18 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
|
7
7
|
import { useAttendanceModule } from "./context";
|
|
8
8
|
import { ATTENDANCE_STATUS_OPTIONS, ATTENDANCE_API_ROUTES } from "./constants";
|
|
9
9
|
import { useTranslations } from "next-intl";
|
|
10
|
+
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
11
|
+
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
12
|
+
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
10
13
|
export const AttendanceForm = () => {
|
|
14
|
+
const workspace = getCachedWorkspaceSync();
|
|
11
15
|
const { state, handleChange } = useAttendanceModule();
|
|
12
16
|
const { date, enabled, errors, remarks, status } = state;
|
|
13
17
|
const t = useTranslations("attendance");
|
|
18
|
+
const { data: studentProfiles } = useFetch("/api/v1/student-profile", {
|
|
19
|
+
method: API_METHODS.GET,
|
|
20
|
+
params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
|
|
21
|
+
});
|
|
14
22
|
const attendanceStatusLabelMap = {
|
|
15
23
|
PRESENT: t("formOptionPresent"),
|
|
16
24
|
ABSENT: t("formOptionAbsent"),
|
|
@@ -34,5 +42,24 @@ export const AttendanceForm = () => {
|
|
|
34
42
|
emptyText: t("formNoStatusEmpty"),
|
|
35
43
|
value: status,
|
|
36
44
|
});
|
|
37
|
-
|
|
45
|
+
const { enhancedComboboxElement: studentProfile } = useEnhancedCombobox({
|
|
46
|
+
id: "studentProfile",
|
|
47
|
+
info: t("formStudentProfileInfo"),
|
|
48
|
+
label: t("formOptionStudentProfile"),
|
|
49
|
+
onValueChange: (value) => handleChange("studentProfile", value),
|
|
50
|
+
options: (studentProfiles || []).map((opt) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
return ({
|
|
53
|
+
value: opt.id,
|
|
54
|
+
label: `${(_a = opt.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = opt.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${opt.computerNumber}`,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
57
|
+
placeholder: t("formStudentProfilePlaceholder"),
|
|
58
|
+
required: true,
|
|
59
|
+
searchEndpoint: ATTENDANCE_API_ROUTES.STUDENT_PROFILE,
|
|
60
|
+
searchPlaceholder: t("formSearchStatusPlaceholder"),
|
|
61
|
+
emptyText: t("formNoStatusEmpty"),
|
|
62
|
+
value: status,
|
|
63
|
+
});
|
|
64
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.date, id: "date", info: t("formDateInfo"), label: t("formDateLabel"), onChange: (e) => handleChange("date", e.target.value), placeholder: t("formDatePlaceholder"), required: true, type: "date", value: date }), statusCombo, studentProfile, _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: t("formRemarksInfo"), label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), rows: 3, value: remarks !== null && remarks !== void 0 ? remarks : "" }), _jsx(EnhancedCheckbox, { defaultChecked: enabled, label: t("formActiveAttendanceRecordLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
|
|
38
65
|
};
|