@appcorp/fusion-storybook 0.5.7 → 0.5.11
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/context/use-admission-module.d.ts +10 -1
- package/base-modules/admission/context/use-admission-module.js +207 -69
- package/base-modules/admission/context.d.ts +20 -0
- package/base-modules/admission/context.js +8 -2
- package/base-modules/admission/filter.js +5 -20
- package/base-modules/admission/form.js +11 -32
- package/base-modules/admission/page.js +36 -19
- package/base-modules/admission/validate.d.ts +23 -1
- package/base-modules/admission/validate.js +58 -21
- package/base-modules/admission/view.js +27 -4
- package/base-modules/attendance/context/use-attendance-module.d.ts +60 -0
- package/base-modules/attendance/context/use-attendance-module.js +449 -0
- package/base-modules/attendance/context.d.ts +36 -52
- package/base-modules/attendance/context.js +22 -376
- package/base-modules/attendance/date.d.ts +10 -0
- package/base-modules/attendance/date.js +23 -0
- package/base-modules/attendance/filter.js +22 -6
- package/base-modules/attendance/form.js +53 -42
- package/base-modules/attendance/more-actions.js +10 -233
- package/base-modules/attendance/page.js +45 -31
- package/base-modules/attendance/validate.d.ts +3 -1
- package/base-modules/attendance/validate.js +7 -2
- package/base-modules/attendance/view.js +18 -9
- package/constants.d.ts +0 -4
- package/constants.js +0 -4
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/base-modules/admission/more-actions.d.ts +0 -1
- package/base-modules/admission/more-actions.js +0 -291
|
@@ -14,20 +14,21 @@ import { EnhancedDropzone } from "@appcorp/shadcn/components/enhanced-dropzone";
|
|
|
14
14
|
import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
15
15
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
16
16
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
17
|
+
import { EnhancedCombobox } from "@appcorp/shadcn/components/enhanced-combobox";
|
|
17
18
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
18
19
|
import { useAdmissionModule, ADMISSION_ACTION_TYPES } from "./context";
|
|
19
20
|
import { useEffect } from "react";
|
|
20
21
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
21
22
|
import { getDialCode } from "@react-pakistan/util-functions/general/get-dial-code";
|
|
22
|
-
import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
23
23
|
import { VALUE_DELIMITER } from "@react-pakistan/util-functions/constants/select-value-delimiter";
|
|
24
24
|
import { v4 as uuidv4 } from "uuid";
|
|
25
25
|
import { GENDER_OPTIONS } from "./constants";
|
|
26
|
-
import {
|
|
26
|
+
import { DISCOUNT_CODE_API_ROUTES } from "../../constants";
|
|
27
27
|
import { useTranslations } from "next-intl";
|
|
28
|
-
import {
|
|
28
|
+
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
29
29
|
export const AdmissionForm = () => {
|
|
30
|
-
|
|
30
|
+
var _a;
|
|
31
|
+
const { state, handleChange, dispatch, discountCodes } = useAdmissionModule();
|
|
31
32
|
const { address, admissionNotes, studentIdNumber, city, classForAdmission, country, discountCodeId, dob, documents, emergencyContact, errors, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, previousSchool, registrationCode, siblings, state: provinceState, } = state;
|
|
32
33
|
const t = useTranslations("admission");
|
|
33
34
|
const genderLabelMap = {
|
|
@@ -36,40 +37,17 @@ export const AdmissionForm = () => {
|
|
|
36
37
|
OTHER: t("formOptionOther"),
|
|
37
38
|
};
|
|
38
39
|
const workspace = getCachedWorkspaceSync();
|
|
39
|
-
const {
|
|
40
|
-
params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
|
|
41
|
-
method: API_METHODS.GET,
|
|
42
|
-
});
|
|
43
|
-
const { enhancedComboboxElement: genderCombo } = useEnhancedCombobox({
|
|
44
|
-
emptyText: t("formNoGenderOptionsEmpty"),
|
|
45
|
-
id: "gender",
|
|
46
|
-
info: t("formGenderInfo"),
|
|
47
|
-
label: t("formGenderLabel"),
|
|
48
|
-
required: true,
|
|
49
|
-
onValueChange: (value) => handleChange("gender", value),
|
|
50
|
-
options: GENDER_OPTIONS.map((g) => ({
|
|
40
|
+
const genderCombo = (_jsx(EnhancedCombobox, { emptyText: t("formNoGenderOptionsEmpty"), error: getTranslatedError({ errors, key: "gender", t }), id: "gender", info: t("formGenderInfo"), label: t("formGenderLabel"), onValueChange: (value) => handleChange("gender", value), options: GENDER_OPTIONS.map((g) => ({
|
|
51
41
|
value: g.value,
|
|
52
42
|
label: genderLabelMap[g.value] || g.label,
|
|
53
|
-
})),
|
|
54
|
-
placeholder: t("formGenderPlaceholder"),
|
|
55
|
-
searchEndpoint: ADMISSION_API_ROUTES.UNIT,
|
|
56
|
-
searchPlaceholder: t("formSearchGenderPlaceholder"),
|
|
57
|
-
formatSearchResult: (item) => {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
return ({
|
|
60
|
-
label: String((_a = item.label) !== null && _a !== void 0 ? _a : ""),
|
|
61
|
-
value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
value: gender,
|
|
65
|
-
});
|
|
43
|
+
})), placeholder: t("formGenderPlaceholder"), required: true, searchPlaceholder: t("formSearchGenderPlaceholder"), value: gender }));
|
|
66
44
|
const { enhancedComboboxElement: discountCodeCombo } = useEnhancedCombobox({
|
|
67
45
|
emptyText: t("formNoDiscountCodesEmpty"),
|
|
68
46
|
id: "discountCodeId",
|
|
69
47
|
info: t("formDiscountCodeInfo"),
|
|
70
48
|
label: t("formDiscountCodeLabel"),
|
|
71
49
|
onValueChange: (value) => handleChange("discountCodeId", value),
|
|
72
|
-
options: (
|
|
50
|
+
options: (discountCodes || [])
|
|
73
51
|
.filter((code) => code.enabled)
|
|
74
52
|
.map((code) => {
|
|
75
53
|
var _a;
|
|
@@ -80,6 +58,7 @@ export const AdmissionForm = () => {
|
|
|
80
58
|
}),
|
|
81
59
|
placeholder: t("formDiscountCodePlaceholder"),
|
|
82
60
|
searchEndpoint: DISCOUNT_CODE_API_ROUTES.UNIT,
|
|
61
|
+
searchParams: { schoolId: (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id },
|
|
83
62
|
searchPlaceholder: t("formSearchDiscountCodesPlaceholder"),
|
|
84
63
|
formatSearchResult: (item) => {
|
|
85
64
|
var _a;
|
|
@@ -132,14 +111,14 @@ export const AdmissionForm = () => {
|
|
|
132
111
|
}
|
|
133
112
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
113
|
}, [id, dispatch]);
|
|
135
|
-
return (_jsxs("div", { className: "grid grid-cols-1 gap-2 space-y-2", children: [_jsx("h4", { className: "m-0 p-0", children: t("formSectionStudentInformation") }), _jsxs("div", { className: "grid grid-cols-5 gap-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: firstName || "" }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: lastName || "" }), _jsx(EnhancedInput, { error: errors.studentIdNumber, id: "studentIdNumber", info: t("formStudentIdNumberInfo"), label: t("formStudentIdNumberLabel"), onChange: (e) => handleChange("studentIdNumber", e.target.value), placeholder: t("formStudentIdNumberPlaceholder"), required: true, type: "text", value: studentIdNumber || "" }), genderCombo, _jsx(EnhancedInput, { error: errors.dob, id: "dob", info: t("formDobInfo"), label: t("formDobLabel"), onChange: (e) => handleChange("dob", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, placeholder: t("formDobPlaceholder"), required: true, type: "date", value: dob || "" }), _jsx(EnhancedInput, { error: errors.registrationCode, id: "registrationCode", info: t("formRegistrationCodeInfo"), label: t("formRegistrationCodeLabel"), onChange: (e) => handleChange("registrationCode", e.target.value), placeholder: t("formRegistrationCodePlaceholder"), required: true, type: "text", value: registrationCode || "", disabled: true }), discountCodeCombo, _jsx(EnhancedCheckbox, { label: t("formHafizLabel"), id: "hafiz", info: t("formHafizInfo"), onCheckedChange: (checked) => handleChange("hafiz", checked) }), _jsx(EnhancedCheckbox, { label: t("formOrphanLabel"), id: "orphan", info: t("formOrphanInfo"), onCheckedChange: (checked) => handleChange("orphan", checked) })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionFatherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.fatherFirstName, id: "fatherFirstName", info: t("formFatherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("fatherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: fatherFirstName || "" }), _jsx(EnhancedInput, { error: errors.fatherLastName, id: "fatherLastName", info: t("formFatherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("fatherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: fatherLastName || "" }), _jsx(EnhancedInput, { error: errors.fatherIdNumber, id: "fatherIdNumber", info: t("formFatherIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("fatherIdNumber", e.target.value), placeholder: t("formIdNumberPlaceholder"), required: true, type: "text", value: fatherIdNumber || "" }), _jsx(EnhancedInput, { error: errors.fatherMobile, id: "fatherMobile", info: t("formFatherMobileInfo"), label: t("formMobileLabel"), onChange: (e) => handleChange("fatherMobile", e.target.value), placeholder: "+923001234567", required: true, type: "text", value: fatherMobile || "" }), _jsx(EnhancedInput, { error: errors.fatherOccupation, id: "fatherOccupation", info: t("formFatherOccupationInfo"), label: t("formOccupationLabel"), onChange: (e) => handleChange("fatherOccupation", e.target.value), placeholder: t("formOccupationPlaceholder"), required: false, type: "text", value: fatherOccupation || "" }), _jsx(EnhancedInput, { error: errors.fatherOrganization, id: "fatherOrganization", info: t("formFatherOrganizationInfo"), label: t("formOrganizationLabel"), onChange: (e) => handleChange("fatherOrganization", e.target.value), placeholder: t("formOrganizationPlaceholder"), required: false, type: "text", value: fatherOrganization || "" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactFather", info: t("formFatherEmergencyContactInfo"), checked: emergencyContact === "Father", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Father" : "") })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionMotherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.motherFirstName, id: "motherFirstName", info: t("formMotherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("motherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: motherFirstName || "" }), _jsx(EnhancedInput, { error: errors.motherLastName, id: "motherLastName", info: t("formMotherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("motherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: motherLastName || "" }), _jsx(EnhancedInput, { error: errors.motherIdNumber, id: "motherIdNumber", info: t("formMotherIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("motherIdNumber", e.target.value), placeholder: t("formIdNumberPlaceholder"), required: true, type: "text", value: motherIdNumber || "" }), _jsx(EnhancedInput, { error: errors.motherMobile, id: "motherMobile", info: t("formMotherMobileInfo"), label: t("formMobileLabel"), onChange: (e) => handleChange("motherMobile", e.target.value), placeholder: "+923001234567", required: true, type: "text", value: motherMobile || "" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactMother", info: t("formMotherEmergencyContactInfo"), checked: emergencyContact === "Mother", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Mother" : "") })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionHomeInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedTextarea, { error: errors.address, id: "homeAddress", info: t("formHomeAddressInfo"), label: t("formHomeAddressLabel"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("formHomeAddressPlaceholder"), required: true, rows: 2, value: address || "" }), _jsx(EnhancedInput, { error: errors.city, id: "city", info: t("formCityInfo"), label: t("formCityLabel"), onChange: (e) => handleChange("city", e.target.value), placeholder: t("formCityPlaceholder"), required: true, type: "text", value: city || "" }), _jsx(EnhancedInput, { error: errors.state, id: "state", info: t("formStateInfo"), label: t("formStateLabel"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("formStatePlaceholder"), required: true, type: "text", value: provinceState || "" }), _jsx(EnhancedInput, { error: errors.country, id: "country", info: t("formCountryInfo"), label: t("formCountryLabel"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("formCountryPlaceholder"), required: true, type: "text", value: country || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionAdmissionInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.classForAdmission, id: "classForAdmission", info: t("formClassForAdmissionInfo"), label: t("formClassForAdmissionLabel"), onChange: (e) => handleChange("classForAdmission", e.target.value), placeholder: t("formClassForAdmissionPlaceholder"), required: true, type: "text", value: classForAdmission || "" }), _jsx(EnhancedInput, { error: errors.previousSchool, id: "previousSchool", info: t("formPreviousSchoolInfo"), label: t("formPreviousSchoolLabel"), onChange: (e) => handleChange("previousSchool", e.target.value), placeholder: t("formPreviousSchoolPlaceholder"), type: "text", value: previousSchool || "" }), _jsx(EnhancedTextarea, { error: errors.siblings, id: "siblings", info: t("formSiblingsInfo"), label: t("formSiblingsLabel"), onChange: (e) => handleChange("siblings", e.target.value), placeholder: t("formSiblingsPlaceholder"), rows: 3, value: siblings || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionOfficeUse") }), _jsxs("div", { className: "grid grid-cols-4 gap-4", children: [_jsx(EnhancedTextarea, { error: errors.notes, id: "notes", info: t("formNotesInfo"), label: t("formNotesLabel"), onChange: (e) => handleChange("notes", e.target.value), placeholder: t("formNotesPlaceholder"), rows: 3, value: notes || "" }), _jsx(EnhancedTextarea, { error: errors.admissionNotes, id: "admissionNotes", info: t("formAdmissionNotesInfo"), label: t("formAdmissionNotesLabel"), onChange: (e) => handleChange("admissionNotes", e.target.value), placeholder: t("formAdmissionNotesPlaceholder"), rows: 3, value: admissionNotes || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionDocumentsLabel") }), _jsx(EnhancedDropzone, { accept: [
|
|
114
|
+
return (_jsxs("div", { className: "grid grid-cols-1 gap-2 space-y-2", children: [_jsx("h4", { className: "m-0 p-0", children: t("formSectionStudentInformation") }), _jsxs("div", { className: "grid grid-cols-5 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "firstName", t }), id: "firstName", info: t("formFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: firstName || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "lastName", t }), id: "lastName", info: t("formLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: lastName || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "studentIdNumber", t }), id: "studentIdNumber", info: t("formStudentIdNumberInfo"), label: t("formStudentIdNumberLabel"), onChange: (e) => handleChange("studentIdNumber", e.target.value), placeholder: t("formStudentIdNumberPlaceholder"), required: true, type: "text", value: studentIdNumber || "" }), genderCombo, _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "dob", t }), id: "dob", info: t("formDobInfo"), label: t("formDobLabel"), onChange: (e) => handleChange("dob", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, placeholder: t("formDobPlaceholder"), required: true, type: "date", value: dob || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "registrationCode", t }), id: "registrationCode", info: t("formRegistrationCodeInfo"), label: t("formRegistrationCodeLabel"), onChange: (e) => handleChange("registrationCode", e.target.value), placeholder: t("formRegistrationCodePlaceholder"), required: true, type: "text", value: registrationCode || "", disabled: true }), discountCodeCombo, _jsx(EnhancedCheckbox, { label: t("formHafizLabel"), id: "hafiz", info: t("formHafizInfo"), onCheckedChange: (checked) => handleChange("hafiz", checked) }), _jsx(EnhancedCheckbox, { label: t("formOrphanLabel"), id: "orphan", info: t("formOrphanInfo"), onCheckedChange: (checked) => handleChange("orphan", checked) })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionFatherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "fatherFirstName", t }), id: "fatherFirstName", info: t("formFatherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("fatherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: fatherFirstName || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "fatherLastName", t }), id: "fatherLastName", info: t("formFatherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("fatherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: fatherLastName || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "fatherIdNumber", t }), id: "fatherIdNumber", info: t("formFatherIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("fatherIdNumber", e.target.value), placeholder: t("formIdNumberPlaceholder"), required: true, type: "text", value: fatherIdNumber || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "fatherMobile", t }), id: "fatherMobile", info: t("formFatherMobileInfo"), label: t("formMobileLabel"), onChange: (e) => handleChange("fatherMobile", e.target.value), placeholder: "+923001234567", required: true, type: "text", value: fatherMobile || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "fatherOccupation", t }), id: "fatherOccupation", info: t("formFatherOccupationInfo"), label: t("formOccupationLabel"), onChange: (e) => handleChange("fatherOccupation", e.target.value), placeholder: t("formOccupationPlaceholder"), required: false, type: "text", value: fatherOccupation || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "fatherOrganization", t }), id: "fatherOrganization", info: t("formFatherOrganizationInfo"), label: t("formOrganizationLabel"), onChange: (e) => handleChange("fatherOrganization", e.target.value), placeholder: t("formOrganizationPlaceholder"), required: false, type: "text", value: fatherOrganization || "" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactFather", info: t("formFatherEmergencyContactInfo"), checked: emergencyContact === "Father", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Father" : "") })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionMotherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "motherFirstName", t }), id: "motherFirstName", info: t("formMotherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("motherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: motherFirstName || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "motherLastName", t }), id: "motherLastName", info: t("formMotherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("motherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: motherLastName || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "motherIdNumber", t }), id: "motherIdNumber", info: t("formMotherIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("motherIdNumber", e.target.value), placeholder: t("formIdNumberPlaceholder"), required: true, type: "text", value: motherIdNumber || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "motherMobile", t }), id: "motherMobile", info: t("formMotherMobileInfo"), label: t("formMobileLabel"), onChange: (e) => handleChange("motherMobile", e.target.value), placeholder: "+923001234567", required: true, type: "text", value: motherMobile || "" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactMother", info: t("formMotherEmergencyContactInfo"), checked: emergencyContact === "Mother", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Mother" : "") })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionHomeInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "address", t }), id: "homeAddress", info: t("formHomeAddressInfo"), label: t("formHomeAddressLabel"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("formHomeAddressPlaceholder"), required: true, rows: 2, value: address || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "city", t }), id: "city", info: t("formCityInfo"), label: t("formCityLabel"), onChange: (e) => handleChange("city", e.target.value), placeholder: t("formCityPlaceholder"), required: true, type: "text", value: city || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "state", t }), id: "state", info: t("formStateInfo"), label: t("formStateLabel"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("formStatePlaceholder"), required: true, type: "text", value: provinceState || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "country", t }), id: "country", info: t("formCountryInfo"), label: t("formCountryLabel"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("formCountryPlaceholder"), required: true, type: "text", value: country || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionAdmissionInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "classForAdmission", t }), id: "classForAdmission", info: t("formClassForAdmissionInfo"), label: t("formClassForAdmissionLabel"), onChange: (e) => handleChange("classForAdmission", e.target.value), placeholder: t("formClassForAdmissionPlaceholder"), required: true, type: "text", value: classForAdmission || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "previousSchool", t }), id: "previousSchool", info: t("formPreviousSchoolInfo"), label: t("formPreviousSchoolLabel"), onChange: (e) => handleChange("previousSchool", e.target.value), placeholder: t("formPreviousSchoolPlaceholder"), type: "text", value: previousSchool || "" }), _jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "siblings", t }), id: "siblings", info: t("formSiblingsInfo"), label: t("formSiblingsLabel"), onChange: (e) => handleChange("siblings", e.target.value), placeholder: t("formSiblingsPlaceholder"), rows: 3, value: siblings || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionOfficeUse") }), _jsxs("div", { className: "grid grid-cols-4 gap-4", children: [_jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "notes", t }), id: "notes", info: t("formNotesInfo"), label: t("formNotesLabel"), onChange: (e) => handleChange("notes", e.target.value), placeholder: t("formNotesPlaceholder"), rows: 3, value: notes || "" }), _jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "admissionNotes", t }), id: "admissionNotes", info: t("formAdmissionNotesInfo"), label: t("formAdmissionNotesLabel"), onChange: (e) => handleChange("admissionNotes", e.target.value), placeholder: t("formAdmissionNotesPlaceholder"), rows: 3, value: admissionNotes || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionDocumentsLabel") }), _jsx(EnhancedDropzone, { accept: [
|
|
136
115
|
"application/pdf",
|
|
137
116
|
"image/jpeg",
|
|
138
117
|
"image/png",
|
|
139
118
|
"image/webp",
|
|
140
119
|
"application/msword",
|
|
141
120
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
142
|
-
], error:
|
|
121
|
+
], error: undefined, id: "documents", info: t("formDocumentsInfo"), label: t("formDocumentsLabel"), maxFiles: 10, maxSize: 10 * 1024 * 1024, onChange: (files) => dispatch({
|
|
143
122
|
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
144
123
|
payload: { key: "documentsFiles", value: files },
|
|
145
124
|
}), value: documents || [] })] }));
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"use client";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import { useMemo } from "react";
|
|
18
|
+
import { useTranslations } from "next-intl";
|
|
18
19
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
19
20
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
20
21
|
import { useAdmissionModule, AdmissionProvider, ADMISSION_DRAWER, ADMISSION_ACTION_TYPES, } from "./context";
|
|
@@ -23,33 +24,15 @@ import { AdmissionForm } from "./form";
|
|
|
23
24
|
import { AdmissionView } from "./view";
|
|
24
25
|
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
25
26
|
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
26
|
-
import { AdmissionMoreActions } from "./more-actions";
|
|
27
27
|
// ============================================================================
|
|
28
28
|
// TABLE COLUMN CONFIGURATION (static — no runtime deps)
|
|
29
29
|
// ============================================================================
|
|
30
|
-
const tableBodyCols = [
|
|
31
|
-
{ componentType: COMPONENT_TYPE.ID, key: "id" },
|
|
32
|
-
{ componentType: COMPONENT_TYPE.OBJECT, key: ["studentDetails:firstName"] },
|
|
33
|
-
{ componentType: COMPONENT_TYPE.OBJECT, key: ["studentDetails:lastName"] },
|
|
34
|
-
{
|
|
35
|
-
componentType: COMPONENT_TYPE.OBJECT,
|
|
36
|
-
key: ["studentDetails:registrationCode"],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
componentType: COMPONENT_TYPE.OBJECT,
|
|
40
|
-
key: ["admissionDetails:classForAdmission"],
|
|
41
|
-
},
|
|
42
|
-
{ componentType: COMPONENT_TYPE.TEXT, key: "status" },
|
|
43
|
-
{ componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
|
|
44
|
-
{ componentType: COMPONENT_TYPE.ACTIONS },
|
|
45
|
-
];
|
|
46
30
|
// ============================================================================
|
|
47
31
|
// COMPONENT FACTORY (creates JSX elements when config is created, not during render)
|
|
48
32
|
// ============================================================================
|
|
49
33
|
const createComponentInstances = () => ({
|
|
50
34
|
filter: _jsx(AdmissionFilter, {}),
|
|
51
35
|
form: _jsx(AdmissionForm, {}),
|
|
52
|
-
moreActions: _jsx(AdmissionMoreActions, {}),
|
|
53
36
|
view: _jsx(AdmissionView, {}),
|
|
54
37
|
});
|
|
55
38
|
const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
|
|
@@ -77,7 +60,7 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerFilterDesc
|
|
|
77
60
|
drawerViewTitle,
|
|
78
61
|
filterContent: components.filter,
|
|
79
62
|
formContent: components.form,
|
|
80
|
-
moreActionsContent:
|
|
63
|
+
moreActionsContent: null,
|
|
81
64
|
saveLabel,
|
|
82
65
|
searchPlaceholder,
|
|
83
66
|
tableDescription,
|
|
@@ -95,6 +78,40 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerFilterDesc
|
|
|
95
78
|
const GenericAdmissionPage = createGenericModulePage();
|
|
96
79
|
const AdmissionPageInner = (props) => {
|
|
97
80
|
const context = useAdmissionModule();
|
|
81
|
+
const t = useTranslations("admission");
|
|
82
|
+
const statusLabels = useMemo(() => ({
|
|
83
|
+
PENDING: t("formOptionPending"),
|
|
84
|
+
APPROVED: t("formOptionApproved"),
|
|
85
|
+
REJECTED: t("formOptionRejected"),
|
|
86
|
+
ENROLLED: t("formOptionEnrolled"),
|
|
87
|
+
CANCELLED: t("formOptionCancelled"),
|
|
88
|
+
}), [t]);
|
|
89
|
+
const tableBodyCols = useMemo(() => [
|
|
90
|
+
{ componentType: COMPONENT_TYPE.ID, key: "id" },
|
|
91
|
+
{
|
|
92
|
+
componentType: COMPONENT_TYPE.OBJECT,
|
|
93
|
+
key: ["studentDetails:firstName"],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
componentType: COMPONENT_TYPE.OBJECT,
|
|
97
|
+
key: ["studentDetails:lastName"],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
componentType: COMPONENT_TYPE.OBJECT,
|
|
101
|
+
key: ["studentDetails:registrationCode"],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
componentType: COMPONENT_TYPE.OBJECT,
|
|
105
|
+
key: ["admissionDetails:classForAdmission"],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
componentType: COMPONENT_TYPE.TEXT,
|
|
109
|
+
key: "status",
|
|
110
|
+
textFormatter: (value) => { var _a; return (_a = statusLabels[String(value !== null && value !== void 0 ? value : "")]) !== null && _a !== void 0 ? _a : String(value !== null && value !== void 0 ? value : ""); },
|
|
111
|
+
},
|
|
112
|
+
{ componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
|
|
113
|
+
{ componentType: COMPONENT_TYPE.ACTIONS },
|
|
114
|
+
], [statusLabels]);
|
|
98
115
|
// Memoize config creation - destructure props to avoid object reference changes
|
|
99
116
|
const admissionConfig = useMemo(() => createAdmissionConfig({
|
|
100
117
|
dispatch: context.dispatch,
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Admission Validation Schema
|
|
3
3
|
*
|
|
4
|
-
* Zod validation schema for admission form with i18n keys
|
|
4
|
+
* Zod validation schema for admission form with i18n keys.
|
|
5
5
|
*/
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { GENDER } from "../../type";
|
|
8
|
+
export declare const VALIDATION_KEYS: {
|
|
9
|
+
readonly registrationCode: "validationRequiredRegistrationCode";
|
|
10
|
+
readonly firstName: "validationRequiredFirstName";
|
|
11
|
+
readonly lastName: "validationRequiredLastName";
|
|
12
|
+
readonly studentIdNumber: "validationRequiredStudentIdNumber";
|
|
13
|
+
readonly dob: "validationRequiredDateOfBirth";
|
|
14
|
+
readonly ageRange: "validationAdmissionAgeRange";
|
|
15
|
+
readonly gender: "validationRequiredGender";
|
|
16
|
+
readonly fatherFirstName: "validationRequiredFatherFirstName";
|
|
17
|
+
readonly fatherLastName: "validationRequiredFatherLastName";
|
|
18
|
+
readonly fatherIdNumber: "validationRequiredFatherIdNumber";
|
|
19
|
+
readonly fatherMobile: "validationRequiredFatherMobile";
|
|
20
|
+
readonly motherFirstName: "validationRequiredMotherFirstName";
|
|
21
|
+
readonly motherLastName: "validationRequiredMotherLastName";
|
|
22
|
+
readonly motherIdNumber: "validationRequiredMotherIdNumber";
|
|
23
|
+
readonly motherMobile: "validationRequiredMotherMobile";
|
|
24
|
+
readonly address: "validationRequiredHomeAddress";
|
|
25
|
+
readonly city: "validationRequiredCity";
|
|
26
|
+
readonly state: "validationRequiredState";
|
|
27
|
+
readonly country: "validationRequiredCountry";
|
|
28
|
+
readonly classForAdmission: "validationRequiredClassForAdmission";
|
|
29
|
+
};
|
|
8
30
|
export declare const admissionFormValidation: z.ZodObject<{
|
|
9
31
|
registrationCode: z.ZodString;
|
|
10
32
|
firstName: z.ZodString;
|
|
@@ -1,21 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Admission Validation Schema
|
|
3
3
|
*
|
|
4
|
-
* Zod validation schema for admission form with i18n keys
|
|
4
|
+
* Zod validation schema for admission form with i18n keys.
|
|
5
5
|
*/
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { GENDER } from "../../type";
|
|
8
8
|
import { normalizeIdNumber } from "../../utils/id-number";
|
|
9
9
|
import { toE164Phone } from "../../utils/to-e164-phone";
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// VALIDATION KEYS
|
|
12
|
+
// ============================================================================
|
|
13
|
+
export const VALIDATION_KEYS = {
|
|
14
|
+
registrationCode: "validationRequiredRegistrationCode",
|
|
15
|
+
firstName: "validationRequiredFirstName",
|
|
16
|
+
lastName: "validationRequiredLastName",
|
|
17
|
+
studentIdNumber: "validationRequiredStudentIdNumber",
|
|
18
|
+
dob: "validationRequiredDateOfBirth",
|
|
19
|
+
ageRange: "validationAdmissionAgeRange",
|
|
20
|
+
gender: "validationRequiredGender",
|
|
21
|
+
fatherFirstName: "validationRequiredFatherFirstName",
|
|
22
|
+
fatherLastName: "validationRequiredFatherLastName",
|
|
23
|
+
fatherIdNumber: "validationRequiredFatherIdNumber",
|
|
24
|
+
fatherMobile: "validationRequiredFatherMobile",
|
|
25
|
+
motherFirstName: "validationRequiredMotherFirstName",
|
|
26
|
+
motherLastName: "validationRequiredMotherLastName",
|
|
27
|
+
motherIdNumber: "validationRequiredMotherIdNumber",
|
|
28
|
+
motherMobile: "validationRequiredMotherMobile",
|
|
29
|
+
address: "validationRequiredHomeAddress",
|
|
30
|
+
city: "validationRequiredCity",
|
|
31
|
+
state: "validationRequiredState",
|
|
32
|
+
country: "validationRequiredCountry",
|
|
33
|
+
classForAdmission: "validationRequiredClassForAdmission",
|
|
34
|
+
};
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// VALIDATION SCHEMA
|
|
37
|
+
// ============================================================================
|
|
10
38
|
export const admissionFormValidation = z.object({
|
|
11
39
|
// Student Information
|
|
12
|
-
registrationCode: z.string().min(1,
|
|
13
|
-
firstName: z.string().min(1,
|
|
14
|
-
lastName: z.string().min(1,
|
|
15
|
-
studentIdNumber: z
|
|
40
|
+
registrationCode: z.string().min(1, VALIDATION_KEYS.registrationCode),
|
|
41
|
+
firstName: z.string().min(1, VALIDATION_KEYS.firstName),
|
|
42
|
+
lastName: z.string().min(1, VALIDATION_KEYS.lastName),
|
|
43
|
+
studentIdNumber: z
|
|
44
|
+
.string()
|
|
45
|
+
.min(1, VALIDATION_KEYS.studentIdNumber)
|
|
46
|
+
.transform(normalizeIdNumber),
|
|
16
47
|
dob: z
|
|
17
48
|
.string()
|
|
18
|
-
.min(1,
|
|
49
|
+
.min(1, VALIDATION_KEYS.dob)
|
|
19
50
|
.refine((dateStr) => {
|
|
20
51
|
const birthDate = new Date(dateStr);
|
|
21
52
|
const today = new Date();
|
|
@@ -27,36 +58,42 @@ export const admissionFormValidation = z.object({
|
|
|
27
58
|
? age - 1
|
|
28
59
|
: age;
|
|
29
60
|
return adjustedAge >= 2 && adjustedAge <= 25;
|
|
30
|
-
},
|
|
31
|
-
gender: z.nativeEnum(GENDER, { error:
|
|
61
|
+
}, VALIDATION_KEYS.ageRange),
|
|
62
|
+
gender: z.nativeEnum(GENDER, { error: VALIDATION_KEYS.gender }),
|
|
32
63
|
discountCodeId: z.string().optional(),
|
|
33
64
|
hafiz: z.boolean().optional(),
|
|
34
65
|
orphan: z.boolean().optional(),
|
|
35
66
|
// Father Information
|
|
36
|
-
fatherFirstName: z.string().min(1,
|
|
37
|
-
fatherLastName: z.string().min(1,
|
|
38
|
-
fatherIdNumber: z
|
|
67
|
+
fatherFirstName: z.string().min(1, VALIDATION_KEYS.fatherFirstName),
|
|
68
|
+
fatherLastName: z.string().min(1, VALIDATION_KEYS.fatherLastName),
|
|
69
|
+
fatherIdNumber: z
|
|
70
|
+
.string()
|
|
71
|
+
.min(1, VALIDATION_KEYS.fatherIdNumber)
|
|
72
|
+
.transform(normalizeIdNumber),
|
|
39
73
|
fatherMobile: z
|
|
40
74
|
.string()
|
|
41
|
-
.min(1,
|
|
75
|
+
.min(1, VALIDATION_KEYS.fatherMobile)
|
|
42
76
|
.transform((val) => { var _a; return (_a = toE164Phone(val)) !== null && _a !== void 0 ? _a : val; }),
|
|
43
77
|
fatherOccupation: z.string().optional(),
|
|
44
78
|
fatherOrganization: z.string().optional(),
|
|
45
79
|
// Mother Information
|
|
46
|
-
motherFirstName: z.string().min(1,
|
|
47
|
-
motherLastName: z.string().min(1,
|
|
48
|
-
motherIdNumber: z
|
|
80
|
+
motherFirstName: z.string().min(1, VALIDATION_KEYS.motherFirstName),
|
|
81
|
+
motherLastName: z.string().min(1, VALIDATION_KEYS.motherLastName),
|
|
82
|
+
motherIdNumber: z
|
|
83
|
+
.string()
|
|
84
|
+
.min(1, VALIDATION_KEYS.motherIdNumber)
|
|
85
|
+
.transform(normalizeIdNumber),
|
|
49
86
|
motherMobile: z
|
|
50
87
|
.string()
|
|
51
|
-
.min(1,
|
|
88
|
+
.min(1, VALIDATION_KEYS.motherMobile)
|
|
52
89
|
.transform((val) => { var _a; return (_a = toE164Phone(val)) !== null && _a !== void 0 ? _a : val; }),
|
|
53
90
|
// Home Information
|
|
54
|
-
address: z.string().min(1,
|
|
55
|
-
city: z.string().min(1,
|
|
56
|
-
state: z.string().min(1,
|
|
57
|
-
country: z.string().min(1,
|
|
91
|
+
address: z.string().min(1, VALIDATION_KEYS.address),
|
|
92
|
+
city: z.string().min(1, VALIDATION_KEYS.city),
|
|
93
|
+
state: z.string().min(1, VALIDATION_KEYS.state),
|
|
94
|
+
country: z.string().min(1, VALIDATION_KEYS.country),
|
|
58
95
|
// Admission Information
|
|
59
|
-
classForAdmission: z.string().min(1,
|
|
96
|
+
classForAdmission: z.string().min(1, VALIDATION_KEYS.classForAdmission),
|
|
60
97
|
previousSchool: z.string().optional(),
|
|
61
98
|
siblings: z.string().optional(),
|
|
62
99
|
// Office Use
|
|
@@ -11,6 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
*/
|
|
12
12
|
import { useMemo } from "react";
|
|
13
13
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
14
|
+
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
14
15
|
import { useAdmissionModule } from "./context";
|
|
15
16
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@appcorp/shadcn/components/ui/card";
|
|
16
17
|
import { Badge } from "@appcorp/shadcn/components/ui/badge";
|
|
@@ -24,12 +25,24 @@ import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/genera
|
|
|
24
25
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
25
26
|
import { ADMISSION_STATUS } from "../../type";
|
|
26
27
|
export const AdmissionView = () => {
|
|
27
|
-
var _a, _b, _c;
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
28
29
|
const { state, handleAnalyze, handleRemoveDocument } = useAdmissionModule();
|
|
29
30
|
const { address, admissionNotes, aiAnalysis, analyzeLoading, analyzeError, studentIdNumber, city, classForAdmission, country, discountCodeId, dob, documents, emergencyContact, enabled, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, hafiz, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, orphan, postalCode, previousSchool, registrationCode, siblings, state: provinceState, status, } = state;
|
|
30
31
|
const workspace = getCachedWorkspaceSync();
|
|
31
32
|
const hasGeminiSecrets = Boolean(((_a = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _a === void 0 ? void 0 : _a.GEMINI_API_KEY) && ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _b === void 0 ? void 0 : _b.GEMINI_MODEL));
|
|
32
33
|
const t = useTranslations("admission");
|
|
34
|
+
const statusLabels = {
|
|
35
|
+
PENDING: t("formOptionPending"),
|
|
36
|
+
APPROVED: t("formOptionApproved"),
|
|
37
|
+
REJECTED: t("formOptionRejected"),
|
|
38
|
+
ENROLLED: t("formOptionEnrolled"),
|
|
39
|
+
CANCELLED: t("formOptionCancelled"),
|
|
40
|
+
};
|
|
41
|
+
const decisionLabels = {
|
|
42
|
+
APPROVED: t("formOptionApproved"),
|
|
43
|
+
REJECTED: t("formOptionRejected"),
|
|
44
|
+
REVIEW_REQUIRED: t("aiDecisionReviewRequired"),
|
|
45
|
+
};
|
|
33
46
|
const { data: discountCodesData } = useFetch("/api/v1/discount-code", {
|
|
34
47
|
params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
|
|
35
48
|
method: "GET",
|
|
@@ -55,11 +68,21 @@ export const AdmissionView = () => {
|
|
|
55
68
|
};
|
|
56
69
|
return (_jsxs("div", { className: "space-y-6", children: [hasGeminiSecrets && (_jsxs(Card, { className: "border-primary/20 border-2", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Brain, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAiAnalysis") })] }), status === ADMISSION_STATUS.PENDING && (_jsxs(Button, { variant: "outline", size: "sm", disabled: analyzeLoading, onClick: () => handleAnalyze({ id }), children: [analyzeLoading ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(RefreshCw, { className: "mr-2 h-4 w-4" })), aiAnalysis
|
|
57
70
|
? t("viewButtonReRunAnalysis")
|
|
58
|
-
: t("viewButtonAnalyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("viewFieldGeminiPoweredAdmissionScoring") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [analyzeLoading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: t("viewTextRunningAiAnalysis") })] })), analyzeError && !analyzeLoading && (_jsxs("div", { className: "text-destructive flex items-center gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "h-4 w-4" }), _jsx("span", { children: analyzeError })] })), !analyzeLoading && aiAnalysis && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsxs("div", { className: "bg-muted flex flex-col items-center rounded-lg px-6 py-3", children: [_jsx("span", { className: "text-primary text-3xl font-bold", children: aiAnalysis.score }), _jsx("span", { className: "text-muted-foreground text-xs tracking-wide uppercase", children: "/ 100" })] }), _jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium ${decisionColor(aiAnalysis.decision)}`, children: [decisionIcon(aiAnalysis.decision), aiAnalysis.decision.replace("_", " ")] }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [_jsxs("span", { className: "font-medium", children: [t("viewFieldConfidence"), ":", " "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("viewFieldAiReasoningAndRiskFlags") }), _jsx("ul", { className: "space-y-1.5", children: aiAnalysis.reasons.map((reason, i) => (_jsxs("li", { className: "flex items-start gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-yellow-500" }), _jsx("span", { children: reason })] }, i))) })] })), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t("viewFieldLastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("viewTextNoAiAnalysisYet") }))] })] })), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdmissionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionRegistrationAndAdmissionInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRegistrationCode") }), _jsx("p", { className: "font-mono text-base", children: formatValue(registrationCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassForAdmission") }), _jsx("p", { className: "text-base", children: formatValue(classForAdmission) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx("p", { className: "text-base", children: formatValue(status) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPreviousSchool") }), _jsx("p", { className: "text-base", children: formatValue(previousSchool) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSiblings") }), _jsx("p", { className: "text-base", children: formatValue(siblings) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionStudentInformation") })] }), _jsx(CardDescription, { children: t("viewSectionPersonalDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(firstName), " ", formatValue(lastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDateOfBirth") }), _jsx("p", { className: "text-base", children: formatDate(String(dob), DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), _jsx("p", { className: "text-base", children: formatValue(gender) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudentIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(studentIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDiscountCode") }), _jsx("p", { className: "text-base", children: discountCodeId
|
|
59
|
-
? ((
|
|
71
|
+
: t("viewButtonAnalyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("viewFieldGeminiPoweredAdmissionScoring") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [analyzeLoading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: t("viewTextRunningAiAnalysis") })] })), analyzeError && !analyzeLoading && (_jsxs("div", { className: "text-destructive flex items-center gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "h-4 w-4" }), _jsx("span", { children: analyzeError })] })), !analyzeLoading && aiAnalysis && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsxs("div", { className: "bg-muted flex flex-col items-center rounded-lg px-6 py-3", children: [_jsx("span", { className: "text-primary text-3xl font-bold", children: aiAnalysis.score }), _jsx("span", { className: "text-muted-foreground text-xs tracking-wide uppercase", children: "/ 100" })] }), _jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium ${decisionColor(aiAnalysis.decision)}`, children: [decisionIcon(aiAnalysis.decision), (_c = decisionLabels[aiAnalysis.decision]) !== null && _c !== void 0 ? _c : aiAnalysis.decision.replace("_", " ")] }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [_jsxs("span", { className: "font-medium", children: [t("viewFieldConfidence"), ":", " "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("viewFieldAiReasoningAndRiskFlags") }), _jsx("ul", { className: "space-y-1.5", children: aiAnalysis.reasons.map((reason, i) => (_jsxs("li", { className: "flex items-start gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-yellow-500" }), _jsx("span", { children: reason })] }, i))) })] })), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t("viewFieldLastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("viewTextNoAiAnalysisYet") }))] })] })), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdmissionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionRegistrationAndAdmissionInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRegistrationCode") }), _jsx("p", { className: "font-mono text-base", children: formatValue(registrationCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassForAdmission") }), _jsx("p", { className: "text-base", children: formatValue(classForAdmission) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx("p", { className: "text-base", children: (_d = statusLabels[String(status !== null && status !== void 0 ? status : "")]) !== null && _d !== void 0 ? _d : formatValue(status) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPreviousSchool") }), _jsx("p", { className: "text-base", children: formatValue(previousSchool) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSiblings") }), _jsx("p", { className: "text-base", children: formatValue(siblings) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionStudentInformation") })] }), _jsx(CardDescription, { children: t("viewSectionPersonalDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(firstName), " ", formatValue(lastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDateOfBirth") }), _jsx("p", { className: "text-base", children: formatDate(String(dob), DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), _jsx("p", { className: "text-base", children: formatValue(gender) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudentIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(studentIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDiscountCode") }), _jsx("p", { className: "text-base", children: discountCodeId
|
|
72
|
+
? ((_e = discountCode === null || discountCode === void 0 ? void 0 : discountCode.code) !== null && _e !== void 0 ? _e : discountCodeId)
|
|
60
73
|
: "N/A" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmergencyContact") }), _jsx("p", { className: "text-base", children: formatValue(emergencyContact) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldHafizEQuran") }), _jsx("p", { className: "text-base", children: hafiz ? t("badgeYes") : t("badgeNo") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrphan") }), _jsx("p", { className: "text-base", children: orphan ? t("badgeYes") : t("badgeNo") })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionFatherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionFatherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(fatherFirstName), " ", formatValue(fatherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(fatherIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(fatherMobile) || formatValue(fatherMobile) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOccupation") }), _jsx("p", { className: "text-base", children: formatValue(fatherOccupation) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrganization") }), _jsx("p", { className: "text-base", children: formatValue(fatherOrganization) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionMotherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionMotherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(motherFirstName), " ", formatValue(motherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(motherIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(motherMobile) || formatValue(motherMobile) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Home, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionHomeDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAddressInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCity") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldState") }), _jsx("p", { className: "text-base", children: formatValue(provinceState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCountry") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPostalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionOfficeUse") })] }), _jsx(CardDescription, { children: t("viewSectionInternalNotesAndProcessingInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldNotes") }), _jsx("p", { className: "text-base", children: formatValue(notes) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAdmissionNotes") }), _jsx("p", { className: "text-base", children: formatValue(admissionNotes) })] })] }) })] }), _jsxs(Card, { children: [_jsx(CardHeader, { className: "pb-3", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionDocumentsLabel") })] }) }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: documents && documents.length > 0 ? (_jsx("div", { className: "space-y-2", children: documents.map((url, idx) => {
|
|
61
74
|
var _a;
|
|
62
75
|
const fileName = ((_a = url.split("/").pop()) === null || _a === void 0 ? void 0 : _a.split("-").slice(1).join("-")) || url;
|
|
63
|
-
return (_jsxs("div", { className: "flex items-center justify-between gap-3 rounded-lg border
|
|
76
|
+
return (_jsxs("div", { className: "bg-muted/50 flex items-center justify-between gap-3 rounded-lg border p-3", children: [_jsxs("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "flex-1 truncate text-sm hover:underline", children: [fileName, _jsx(ExternalLink, { className: "text-muted-foreground ml-2 inline h-3.5 w-3.5" })] }), _jsx(Button, { type: "button", size: "icon", variant: "ghost", className: "h-8 w-8 shrink-0", "aria-label": "Remove document", onClick: () => {
|
|
77
|
+
if (!confirm(t("messagesDocumentRemoveConfirmation"))) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
void handleRemoveDocument(url).catch(() => {
|
|
81
|
+
generateThemeToast({
|
|
82
|
+
description: t("messagesDocumentRemoveFailed"),
|
|
83
|
+
variant: TOAST_VARIANT.ERROR,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}, children: _jsx(Trash2, { className: "h-4 w-4" }) })] }, `${url}-${idx}`));
|
|
64
87
|
}) })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: t("viewTextNoDocuments") })) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionRecordStatus") })] }), _jsx(CardDescription, { children: t("viewFieldRecordStateAndMetadata") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEnabled") }), _jsxs(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] }) })] })] }));
|
|
65
88
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type RowAction, type TableRow } from "@appcorp/shadcn/components/enhanced-table";
|
|
2
|
+
import { AttendanceBE, ATTENDANCE_STATUS } from "../../../type";
|
|
3
|
+
export declare const useAttendanceModule: () => {
|
|
4
|
+
applyFilters: () => void;
|
|
5
|
+
byIdLoading: boolean;
|
|
6
|
+
clearFilters: () => void;
|
|
7
|
+
clearSearch: () => void;
|
|
8
|
+
closeDrawer: () => void;
|
|
9
|
+
deleteLoading: boolean;
|
|
10
|
+
handleChange: (field: string, value: string | number | boolean | undefined) => void;
|
|
11
|
+
handleCreate: () => void;
|
|
12
|
+
handleDelete: (row?: TableRow) => void;
|
|
13
|
+
handleEdit: (row?: TableRow) => void;
|
|
14
|
+
handleFilters: () => void;
|
|
15
|
+
handleMoreActions: () => void;
|
|
16
|
+
handlePageChange: (pageOrEvent?: unknown) => void;
|
|
17
|
+
handlePageLimitChange: (k: string, value: object) => void;
|
|
18
|
+
handleSearch: (query: string) => void;
|
|
19
|
+
handleSubmit: () => void;
|
|
20
|
+
handleView: (row?: TableRow) => void;
|
|
21
|
+
headerActions: {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
handleOnClick: () => void;
|
|
24
|
+
label: string;
|
|
25
|
+
order: number;
|
|
26
|
+
}[];
|
|
27
|
+
listFetchNow: (url?: string, config?: import("@react-pakistan/util-functions/hooks/use-fetch").FetchConfig) => void;
|
|
28
|
+
listLoading: boolean;
|
|
29
|
+
rowActions: RowAction[];
|
|
30
|
+
updateLoading: boolean;
|
|
31
|
+
handleCloseDrawer?: () => void;
|
|
32
|
+
state: {
|
|
33
|
+
items: AttendanceBE[];
|
|
34
|
+
count: number;
|
|
35
|
+
currentPage: number;
|
|
36
|
+
pageLimit: number;
|
|
37
|
+
searchQuery: string;
|
|
38
|
+
disableSaveButton: boolean;
|
|
39
|
+
drawer: string | null;
|
|
40
|
+
date: string;
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
errors: Record<string, string>;
|
|
43
|
+
filterEnabled: boolean | undefined;
|
|
44
|
+
filterStatus: string | undefined;
|
|
45
|
+
filterStartDate: string | undefined;
|
|
46
|
+
filterEndDate: string | undefined;
|
|
47
|
+
appliedFilterEnabled: boolean | undefined;
|
|
48
|
+
appliedFilterStatus: string | undefined;
|
|
49
|
+
appliedFilterStartDate: string | undefined;
|
|
50
|
+
appliedFilterEndDate: string | undefined;
|
|
51
|
+
id: string;
|
|
52
|
+
remarks: string;
|
|
53
|
+
schoolId: string;
|
|
54
|
+
status: ATTENDANCE_STATUS;
|
|
55
|
+
studentProfileId: string;
|
|
56
|
+
school: import("../../../types").SchoolBE | undefined;
|
|
57
|
+
studentProfile: import("../../../types").StudentProfileBE | undefined;
|
|
58
|
+
};
|
|
59
|
+
dispatch: React.Dispatch<any>;
|
|
60
|
+
};
|