@appcorp/fusion-storybook 0.5.34 → 0.5.36
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 +140 -37
- package/base-modules/admission/context.d.ts +45 -0
- package/base-modules/admission/context.js +9 -0
- package/base-modules/admission/form.js +45 -2
- package/base-modules/admission/validate.d.ts +12 -3
- package/base-modules/admission/validate.js +52 -4
- package/base-modules/admission/view.js +18 -3
- package/base-modules/family-member/context.d.ts +12 -0
- package/base-modules/family-member/context.js +15 -3
- package/base-modules/family-member/form.js +3 -2
- package/base-modules/family-member/validate.d.ts +3 -0
- package/base-modules/family-member/validate.js +35 -2
- package/base-modules/family-member/view.js +12 -3
- package/components/government-id-type-select.d.ts +18 -0
- package/components/government-id-type-select.js +16 -0
- package/package.json +1 -1
- package/pdf-templates/admission-form-template.d.ts +3 -0
- package/pdf-templates/admission-form-template.js +20 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/academics.d.ts +3 -1
- package/types/admission.d.ts +7 -1
- package/types/enums.d.ts +14 -0
- package/types/enums.js +15 -0
- package/utils/government-id.d.ts +51 -0
- package/utils/government-id.js +71 -0
- package/utils/id-number.d.ts +10 -1
- package/utils/id-number.js +12 -1
|
@@ -20,6 +20,7 @@ import { useAdmissionModule, ADMISSION_ACTION_TYPES } from "./context";
|
|
|
20
20
|
import { useEffect } from "react";
|
|
21
21
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
22
22
|
import { PhoneInput } from "../../components/phone-input";
|
|
23
|
+
import { GovernmentIdTypeSelect } from "../../components/government-id-type-select";
|
|
23
24
|
import { VALUE_DELIMITER } from "@react-pakistan/util-functions/constants/select-value-delimiter";
|
|
24
25
|
import { v4 as uuidv4 } from "uuid";
|
|
25
26
|
import { GENDER_OPTIONS } from "./constants";
|
|
@@ -29,7 +30,7 @@ import { getTranslatedError } from "../../utils/get-translated-error";
|
|
|
29
30
|
export const AdmissionForm = () => {
|
|
30
31
|
var _a, _b, _c;
|
|
31
32
|
const { state, handleChange, dispatch, discountCodes } = useAdmissionModule();
|
|
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;
|
|
33
|
+
const { address, admissionNotes, studentIdType, studentIdNumber, studentIdImages, city, classForAdmission, country, discountCodeId, dob, documents, emergencyContact, errors, fatherIdType, fatherIdNumber, fatherIdImages, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, id, lastName, motherIdType, motherIdNumber, motherIdImages, motherFirstName, motherLastName, motherMobile, notes, previousSchool, registrationCode, siblings, state: provinceState, } = state;
|
|
33
34
|
const t = useTranslations("admission");
|
|
34
35
|
const genderLabelMap = {
|
|
35
36
|
MALE: t("formOptionMale"),
|
|
@@ -97,7 +98,49 @@ export const AdmissionForm = () => {
|
|
|
97
98
|
}
|
|
98
99
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
99
100
|
}, [id, dispatch]);
|
|
100
|
-
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(PhoneInput, { error: getTranslatedError({ errors, key: "fatherMobile", t }), id: "fatherMobile", info: t("formFatherMobileInfo"), label: t("formMobileLabel"), onChange: (value) => handleChange("fatherMobile", value), placeholder: t("formPhonePlaceholder"), required: true, value: fatherMobile || "", defaultCountry: country || ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.country) || "PK", className: "col-span-2" }), _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(PhoneInput, { error: getTranslatedError({ errors, key: "motherMobile", t }), id: "motherMobile", info: t("formMotherMobileInfo"), label: t("formMobileLabel"), onChange: (value) => handleChange("motherMobile", value), placeholder: t("formPhonePlaceholder"), required: true, value: motherMobile || "", defaultCountry: country || ((_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.country) || "PK", className: "col-span-2" }), _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: [
|
|
101
|
+
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(GovernmentIdTypeSelect, { error: getTranslatedError({ errors, key: "studentIdType", t }), id: "studentIdType", onChange: (value) => handleChange("studentIdType", value), required: true, value: studentIdType }), _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(EnhancedDropzone, { accept: [
|
|
102
|
+
"application/pdf",
|
|
103
|
+
"image/jpeg",
|
|
104
|
+
"image/png",
|
|
105
|
+
"image/webp",
|
|
106
|
+
], id: "studentIdImages", info: t("formStudentIdImagesInfo"), label: t("formStudentIdImagesLabel"), maxFiles: 4, maxSize: 10 * 1024 * 1024, onChange: (files) => dispatch({
|
|
107
|
+
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
108
|
+
payload: { key: "studentIdImagesFiles", value: files },
|
|
109
|
+
}), onRemoveRemote: (url) => dispatch({
|
|
110
|
+
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
111
|
+
payload: {
|
|
112
|
+
key: "studentIdImages",
|
|
113
|
+
value: (studentIdImages || []).filter((item) => item !== url),
|
|
114
|
+
},
|
|
115
|
+
}), value: studentIdImages || [] }), _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(GovernmentIdTypeSelect, { error: getTranslatedError({ errors, key: "fatherIdType", t }), id: "fatherIdType", onChange: (value) => handleChange("fatherIdType", value), required: true, value: fatherIdType }), _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(PhoneInput, { error: getTranslatedError({ errors, key: "fatherMobile", t }), id: "fatherMobile", info: t("formFatherMobileInfo"), label: t("formMobileLabel"), onChange: (value) => handleChange("fatherMobile", value), placeholder: t("formPhonePlaceholder"), required: true, value: fatherMobile || "", defaultCountry: country || ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.country) || "PK", className: "col-span-2" }), _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(EnhancedDropzone, { accept: [
|
|
116
|
+
"application/pdf",
|
|
117
|
+
"image/jpeg",
|
|
118
|
+
"image/png",
|
|
119
|
+
"image/webp",
|
|
120
|
+
], id: "fatherIdImages", info: t("formFatherIdImagesInfo"), label: t("formFatherIdImagesLabel"), maxFiles: 4, maxSize: 10 * 1024 * 1024, onChange: (files) => dispatch({
|
|
121
|
+
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
122
|
+
payload: { key: "fatherIdImagesFiles", value: files },
|
|
123
|
+
}), onRemoveRemote: (url) => dispatch({
|
|
124
|
+
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
125
|
+
payload: {
|
|
126
|
+
key: "fatherIdImages",
|
|
127
|
+
value: (fatherIdImages || []).filter((item) => item !== url),
|
|
128
|
+
},
|
|
129
|
+
}), value: fatherIdImages || [] }), _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(GovernmentIdTypeSelect, { error: getTranslatedError({ errors, key: "motherIdType", t }), id: "motherIdType", onChange: (value) => handleChange("motherIdType", value), required: true, value: motherIdType }), _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(PhoneInput, { error: getTranslatedError({ errors, key: "motherMobile", t }), id: "motherMobile", info: t("formMotherMobileInfo"), label: t("formMobileLabel"), onChange: (value) => handleChange("motherMobile", value), placeholder: t("formPhonePlaceholder"), required: true, value: motherMobile || "", defaultCountry: country || ((_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.country) || "PK", className: "col-span-2" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactMother", info: t("formMotherEmergencyContactInfo"), checked: emergencyContact === "Mother", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Mother" : "") })] }), _jsx(EnhancedDropzone, { accept: [
|
|
130
|
+
"application/pdf",
|
|
131
|
+
"image/jpeg",
|
|
132
|
+
"image/png",
|
|
133
|
+
"image/webp",
|
|
134
|
+
], id: "motherIdImages", info: t("formMotherIdImagesInfo"), label: t("formMotherIdImagesLabel"), maxFiles: 4, maxSize: 10 * 1024 * 1024, onChange: (files) => dispatch({
|
|
135
|
+
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
136
|
+
payload: { key: "motherIdImagesFiles", value: files },
|
|
137
|
+
}), onRemoveRemote: (url) => dispatch({
|
|
138
|
+
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
139
|
+
payload: {
|
|
140
|
+
key: "motherIdImages",
|
|
141
|
+
value: (motherIdImages || []).filter((item) => item !== url),
|
|
142
|
+
},
|
|
143
|
+
}), value: motherIdImages || [] }), _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: [
|
|
101
144
|
"application/pdf",
|
|
102
145
|
"image/jpeg",
|
|
103
146
|
"image/png",
|
|
@@ -9,17 +9,23 @@ export declare const VALIDATION_KEYS: {
|
|
|
9
9
|
readonly registrationCode: "validationRequiredRegistrationCode";
|
|
10
10
|
readonly firstName: "validationRequiredFirstName";
|
|
11
11
|
readonly lastName: "validationRequiredLastName";
|
|
12
|
+
readonly studentIdType: "validationRequiredStudentIdType";
|
|
12
13
|
readonly studentIdNumber: "validationRequiredStudentIdNumber";
|
|
14
|
+
readonly invalidStudentIdNumber: "validationInvalidStudentIdNumber";
|
|
13
15
|
readonly dob: "validationRequiredDateOfBirth";
|
|
14
16
|
readonly ageRange: "validationAdmissionAgeRange";
|
|
15
17
|
readonly gender: "validationRequiredGender";
|
|
16
18
|
readonly fatherFirstName: "validationRequiredFatherFirstName";
|
|
17
19
|
readonly fatherLastName: "validationRequiredFatherLastName";
|
|
20
|
+
readonly fatherIdType: "validationRequiredFatherIdType";
|
|
18
21
|
readonly fatherIdNumber: "validationRequiredFatherIdNumber";
|
|
22
|
+
readonly invalidFatherIdNumber: "validationInvalidFatherIdNumber";
|
|
19
23
|
readonly fatherMobile: "validationRequiredFatherMobile";
|
|
20
24
|
readonly motherFirstName: "validationRequiredMotherFirstName";
|
|
21
25
|
readonly motherLastName: "validationRequiredMotherLastName";
|
|
26
|
+
readonly motherIdType: "validationRequiredMotherIdType";
|
|
22
27
|
readonly motherIdNumber: "validationRequiredMotherIdNumber";
|
|
28
|
+
readonly invalidMotherIdNumber: "validationInvalidMotherIdNumber";
|
|
23
29
|
readonly motherMobile: "validationRequiredMotherMobile";
|
|
24
30
|
readonly address: "validationRequiredHomeAddress";
|
|
25
31
|
readonly city: "validationRequiredCity";
|
|
@@ -32,7 +38,8 @@ export declare const admissionFormValidation: z.ZodObject<{
|
|
|
32
38
|
registrationCode: z.ZodString;
|
|
33
39
|
firstName: z.ZodString;
|
|
34
40
|
lastName: z.ZodString;
|
|
35
|
-
|
|
41
|
+
studentIdType: z.ZodString & z.ZodType<"OTHER" | "NATIONAL_ID" | "PASSPORT" | "DRIVING_LICENCE" | "BIRTH_CERTIFICATE" | "VOTER_ID" | "RESIDENCE_PERMIT" | "REFUGEE_ID" | "MILITARY_ID", string, z.core.$ZodTypeInternals<"OTHER" | "NATIONAL_ID" | "PASSPORT" | "DRIVING_LICENCE" | "BIRTH_CERTIFICATE" | "VOTER_ID" | "RESIDENCE_PERMIT" | "REFUGEE_ID" | "MILITARY_ID", string>>;
|
|
42
|
+
studentIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
36
43
|
dob: z.ZodString;
|
|
37
44
|
gender: z.ZodEnum<typeof GENDER>;
|
|
38
45
|
discountCodeId: z.ZodOptional<z.ZodString>;
|
|
@@ -40,13 +47,15 @@ export declare const admissionFormValidation: z.ZodObject<{
|
|
|
40
47
|
orphan: z.ZodOptional<z.ZodBoolean>;
|
|
41
48
|
fatherFirstName: z.ZodString;
|
|
42
49
|
fatherLastName: z.ZodString;
|
|
43
|
-
|
|
50
|
+
fatherIdType: z.ZodString & z.ZodType<"OTHER" | "NATIONAL_ID" | "PASSPORT" | "DRIVING_LICENCE" | "BIRTH_CERTIFICATE" | "VOTER_ID" | "RESIDENCE_PERMIT" | "REFUGEE_ID" | "MILITARY_ID", string, z.core.$ZodTypeInternals<"OTHER" | "NATIONAL_ID" | "PASSPORT" | "DRIVING_LICENCE" | "BIRTH_CERTIFICATE" | "VOTER_ID" | "RESIDENCE_PERMIT" | "REFUGEE_ID" | "MILITARY_ID", string>>;
|
|
51
|
+
fatherIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
44
52
|
fatherMobile: z.ZodPreprocess<z.ZodPipe<z.ZodNullable<z.ZodOptional<z.ZodString>>, z.ZodTransform<string | null | undefined, string | null | undefined>>, unknown>;
|
|
45
53
|
fatherOccupation: z.ZodOptional<z.ZodString>;
|
|
46
54
|
fatherOrganization: z.ZodOptional<z.ZodString>;
|
|
47
55
|
motherFirstName: z.ZodString;
|
|
48
56
|
motherLastName: z.ZodString;
|
|
49
|
-
|
|
57
|
+
motherIdType: z.ZodString & z.ZodType<"OTHER" | "NATIONAL_ID" | "PASSPORT" | "DRIVING_LICENCE" | "BIRTH_CERTIFICATE" | "VOTER_ID" | "RESIDENCE_PERMIT" | "REFUGEE_ID" | "MILITARY_ID", string, z.core.$ZodTypeInternals<"OTHER" | "NATIONAL_ID" | "PASSPORT" | "DRIVING_LICENCE" | "BIRTH_CERTIFICATE" | "VOTER_ID" | "RESIDENCE_PERMIT" | "REFUGEE_ID" | "MILITARY_ID", string>>;
|
|
58
|
+
motherIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
50
59
|
motherMobile: z.ZodPreprocess<z.ZodPipe<z.ZodNullable<z.ZodOptional<z.ZodString>>, z.ZodTransform<string | null | undefined, string | null | undefined>>, unknown>;
|
|
51
60
|
address: z.ZodString;
|
|
52
61
|
city: z.ZodString;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { GENDER } from "../../type";
|
|
8
8
|
import { normalizeIdNumber } from "../../utils/id-number";
|
|
9
|
+
import { isGovernmentIdType, isValidIdNumberForType, } from "../../utils/government-id";
|
|
9
10
|
import { phoneSchema } from "../../utils/phone-validation";
|
|
10
11
|
// ============================================================================
|
|
11
12
|
// VALIDATION KEYS
|
|
@@ -14,17 +15,23 @@ export const VALIDATION_KEYS = {
|
|
|
14
15
|
registrationCode: "validationRequiredRegistrationCode",
|
|
15
16
|
firstName: "validationRequiredFirstName",
|
|
16
17
|
lastName: "validationRequiredLastName",
|
|
18
|
+
studentIdType: "validationRequiredStudentIdType",
|
|
17
19
|
studentIdNumber: "validationRequiredStudentIdNumber",
|
|
20
|
+
invalidStudentIdNumber: "validationInvalidStudentIdNumber",
|
|
18
21
|
dob: "validationRequiredDateOfBirth",
|
|
19
22
|
ageRange: "validationAdmissionAgeRange",
|
|
20
23
|
gender: "validationRequiredGender",
|
|
21
24
|
fatherFirstName: "validationRequiredFatherFirstName",
|
|
22
25
|
fatherLastName: "validationRequiredFatherLastName",
|
|
26
|
+
fatherIdType: "validationRequiredFatherIdType",
|
|
23
27
|
fatherIdNumber: "validationRequiredFatherIdNumber",
|
|
28
|
+
invalidFatherIdNumber: "validationInvalidFatherIdNumber",
|
|
24
29
|
fatherMobile: "validationRequiredFatherMobile",
|
|
25
30
|
motherFirstName: "validationRequiredMotherFirstName",
|
|
26
31
|
motherLastName: "validationRequiredMotherLastName",
|
|
32
|
+
motherIdType: "validationRequiredMotherIdType",
|
|
27
33
|
motherIdNumber: "validationRequiredMotherIdNumber",
|
|
34
|
+
invalidMotherIdNumber: "validationInvalidMotherIdNumber",
|
|
28
35
|
motherMobile: "validationRequiredMotherMobile",
|
|
29
36
|
address: "validationRequiredHomeAddress",
|
|
30
37
|
city: "validationRequiredCity",
|
|
@@ -36,15 +43,21 @@ export const VALIDATION_KEYS = {
|
|
|
36
43
|
// ============================================================================
|
|
37
44
|
// VALIDATION SCHEMA
|
|
38
45
|
// ============================================================================
|
|
39
|
-
|
|
46
|
+
const governmentIdTypeSchema = (requiredKey) => z
|
|
47
|
+
.string()
|
|
48
|
+
.min(1, requiredKey)
|
|
49
|
+
.refine((value) => isGovernmentIdType(value), requiredKey);
|
|
50
|
+
export const admissionFormValidation = z
|
|
51
|
+
.object({
|
|
40
52
|
// Student Information
|
|
41
53
|
registrationCode: z.string().min(1, VALIDATION_KEYS.registrationCode),
|
|
42
54
|
firstName: z.string().min(1, VALIDATION_KEYS.firstName),
|
|
43
55
|
lastName: z.string().min(1, VALIDATION_KEYS.lastName),
|
|
56
|
+
studentIdType: governmentIdTypeSchema(VALIDATION_KEYS.studentIdType),
|
|
44
57
|
studentIdNumber: z
|
|
45
58
|
.string()
|
|
46
59
|
.min(1, VALIDATION_KEYS.studentIdNumber)
|
|
47
|
-
.transform(normalizeIdNumber),
|
|
60
|
+
.transform((value) => { var _a; return (_a = normalizeIdNumber(value)) !== null && _a !== void 0 ? _a : value; }),
|
|
48
61
|
dob: z
|
|
49
62
|
.string()
|
|
50
63
|
.min(1, VALIDATION_KEYS.dob)
|
|
@@ -67,10 +80,11 @@ export const admissionFormValidation = z.object({
|
|
|
67
80
|
// Father Information
|
|
68
81
|
fatherFirstName: z.string().min(1, VALIDATION_KEYS.fatherFirstName),
|
|
69
82
|
fatherLastName: z.string().min(1, VALIDATION_KEYS.fatherLastName),
|
|
83
|
+
fatherIdType: governmentIdTypeSchema(VALIDATION_KEYS.fatherIdType),
|
|
70
84
|
fatherIdNumber: z
|
|
71
85
|
.string()
|
|
72
86
|
.min(1, VALIDATION_KEYS.fatherIdNumber)
|
|
73
|
-
.transform(normalizeIdNumber),
|
|
87
|
+
.transform((value) => { var _a; return (_a = normalizeIdNumber(value)) !== null && _a !== void 0 ? _a : value; }),
|
|
74
88
|
fatherMobile: phoneSchema(VALIDATION_KEYS.phoneInvalid, {
|
|
75
89
|
required: true,
|
|
76
90
|
requiredErrorKey: VALIDATION_KEYS.fatherMobile,
|
|
@@ -80,10 +94,11 @@ export const admissionFormValidation = z.object({
|
|
|
80
94
|
// Mother Information
|
|
81
95
|
motherFirstName: z.string().min(1, VALIDATION_KEYS.motherFirstName),
|
|
82
96
|
motherLastName: z.string().min(1, VALIDATION_KEYS.motherLastName),
|
|
97
|
+
motherIdType: governmentIdTypeSchema(VALIDATION_KEYS.motherIdType),
|
|
83
98
|
motherIdNumber: z
|
|
84
99
|
.string()
|
|
85
100
|
.min(1, VALIDATION_KEYS.motherIdNumber)
|
|
86
|
-
.transform(normalizeIdNumber),
|
|
101
|
+
.transform((value) => { var _a; return (_a = normalizeIdNumber(value)) !== null && _a !== void 0 ? _a : value; }),
|
|
87
102
|
motherMobile: phoneSchema(VALIDATION_KEYS.phoneInvalid, {
|
|
88
103
|
required: true,
|
|
89
104
|
requiredErrorKey: VALIDATION_KEYS.motherMobile,
|
|
@@ -101,4 +116,37 @@ export const admissionFormValidation = z.object({
|
|
|
101
116
|
notes: z.string().optional(),
|
|
102
117
|
admissionNotes: z.string().optional(),
|
|
103
118
|
emergencyContact: z.string().optional(),
|
|
119
|
+
})
|
|
120
|
+
.superRefine((data, ctx) => {
|
|
121
|
+
const checks = [
|
|
122
|
+
{
|
|
123
|
+
number: data.studentIdNumber,
|
|
124
|
+
type: data.studentIdType,
|
|
125
|
+
path: "studentIdNumber",
|
|
126
|
+
key: VALIDATION_KEYS.invalidStudentIdNumber,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
number: data.fatherIdNumber,
|
|
130
|
+
type: data.fatherIdType,
|
|
131
|
+
path: "fatherIdNumber",
|
|
132
|
+
key: VALIDATION_KEYS.invalidFatherIdNumber,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
number: data.motherIdNumber,
|
|
136
|
+
type: data.motherIdType,
|
|
137
|
+
path: "motherIdNumber",
|
|
138
|
+
key: VALIDATION_KEYS.invalidMotherIdNumber,
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
for (const check of checks) {
|
|
142
|
+
if (!isGovernmentIdType(check.type))
|
|
143
|
+
continue;
|
|
144
|
+
if (!isValidIdNumberForType(check.number, check.type)) {
|
|
145
|
+
ctx.addIssue({
|
|
146
|
+
code: z.ZodIssueCode.custom,
|
|
147
|
+
path: [check.path],
|
|
148
|
+
message: check.key,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
104
152
|
});
|
|
@@ -24,13 +24,28 @@ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/forma
|
|
|
24
24
|
import { formatDate, DATE_FORMATS, } from "@react-pakistan/util-functions/general/format-date";
|
|
25
25
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
26
26
|
import { ADMISSION_STATUS } from "../../type";
|
|
27
|
+
import { governmentIdTypeLabelKey } from "../../utils/government-id";
|
|
27
28
|
export const AdmissionView = () => {
|
|
28
29
|
var _a, _b, _c, _d, _e;
|
|
29
30
|
const { state, handleAnalyze, handleRemoveDocument } = useAdmissionModule();
|
|
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;
|
|
31
|
+
const { address, admissionNotes, aiAnalysis, analyzeLoading, analyzeError, studentIdType, studentIdNumber, studentIdImages, city, classForAdmission, country, discountCodeId, dob, documents, emergencyContact, enabled, fatherIdType, fatherIdNumber, fatherIdImages, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, hafiz, id, lastName, motherIdType, motherIdNumber, motherIdImages, motherFirstName, motherLastName, motherMobile, notes, orphan, postalCode, previousSchool, registrationCode, siblings, state: provinceState, status, } = state;
|
|
31
32
|
const workspace = getCachedWorkspaceSync();
|
|
32
33
|
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));
|
|
33
34
|
const t = useTranslations("admission");
|
|
35
|
+
const governmentIdT = useTranslations("governmentId");
|
|
36
|
+
const formatIdType = (value) => {
|
|
37
|
+
const key = governmentIdTypeLabelKey(value);
|
|
38
|
+
return key ? governmentIdT(key) : "—";
|
|
39
|
+
};
|
|
40
|
+
const renderIdImages = (urls) => {
|
|
41
|
+
if (!urls || urls.length === 0) {
|
|
42
|
+
return (_jsx("p", { className: "text-muted-foreground text-sm", children: governmentIdT("imagesEmpty") }));
|
|
43
|
+
}
|
|
44
|
+
return (_jsx("div", { className: "space-y-2", children: urls.map((url, idx) => {
|
|
45
|
+
const fileName = url.split("/").pop() || url;
|
|
46
|
+
return (_jsxs("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "bg-muted/50 flex items-center gap-2 rounded-lg border p-3 text-sm hover:underline", children: [_jsx("span", { className: "flex-1 truncate", children: fileName }), _jsx(ExternalLink, { className: "text-muted-foreground h-3.5 w-3.5 shrink-0" })] }, `${url}-${idx}`));
|
|
47
|
+
}) }));
|
|
48
|
+
};
|
|
34
49
|
const statusLabels = {
|
|
35
50
|
PENDING: t("formOptionPending"),
|
|
36
51
|
APPROVED: t("formOptionApproved"),
|
|
@@ -68,9 +83,9 @@ export const AdmissionView = () => {
|
|
|
68
83
|
};
|
|
69
84
|
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
|
|
70
85
|
? t("viewButtonReRunAnalysis")
|
|
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
|
|
86
|
+
: 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("viewFieldIdType") }), _jsx("p", { className: "text-base", children: formatIdType(studentIdType) })] }), _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
87
|
? ((_e = discountCode === null || discountCode === void 0 ? void 0 : discountCode.code) !== null && _e !== void 0 ? _e : discountCodeId)
|
|
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) => {
|
|
88
|
+
: "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("viewFieldIdType") }), _jsx("p", { className: "text-base", children: formatIdType(fatherIdType) })] }), _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("viewFieldIdType") }), _jsx("p", { className: "text-base", children: formatIdType(motherIdType) })] }), _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: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShieldCheck, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: governmentIdT("imagesLabel") })] }), _jsx(CardDescription, { children: governmentIdT("imagesInfo") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-6 pt-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium", children: t("viewSectionStudentInformation") }), renderIdImages(studentIdImages)] }), _jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium", children: t("viewSectionFatherInformation") }), renderIdImages(fatherIdImages)] }), _jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-medium", children: t("viewSectionMotherInformation") }), renderIdImages(motherIdImages)] })] })] }), _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) => {
|
|
74
89
|
var _a;
|
|
75
90
|
const fileName = ((_a = url.split("/").pop()) === null || _a === void 0 ? void 0 : _a.split("-").slice(1).join("-")) || url;
|
|
76
91
|
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: () => {
|
|
@@ -40,7 +40,9 @@ export declare const FAMILY_MEMBER_ACTION_TYPES: {
|
|
|
40
40
|
gender: string;
|
|
41
41
|
id: string;
|
|
42
42
|
hasStudentProfile: boolean;
|
|
43
|
+
idType: string;
|
|
43
44
|
idNumber: string;
|
|
45
|
+
idImages: string[];
|
|
44
46
|
isPrimary: boolean;
|
|
45
47
|
lastName: string;
|
|
46
48
|
occupation: string;
|
|
@@ -69,7 +71,9 @@ export declare const FAMILY_MEMBER_ACTION_TYPES: {
|
|
|
69
71
|
gender: string;
|
|
70
72
|
id: string;
|
|
71
73
|
hasStudentProfile: boolean;
|
|
74
|
+
idType: string;
|
|
72
75
|
idNumber: string;
|
|
76
|
+
idImages: string[];
|
|
73
77
|
isPrimary: boolean;
|
|
74
78
|
lastName: string;
|
|
75
79
|
occupation: string;
|
|
@@ -100,7 +104,9 @@ export declare const FAMILY_MEMBER_ACTION_TYPES: {
|
|
|
100
104
|
gender: string;
|
|
101
105
|
id: string;
|
|
102
106
|
hasStudentProfile: boolean;
|
|
107
|
+
idType: string;
|
|
103
108
|
idNumber: string;
|
|
109
|
+
idImages: string[];
|
|
104
110
|
isPrimary: boolean;
|
|
105
111
|
lastName: string;
|
|
106
112
|
occupation: string;
|
|
@@ -129,7 +135,9 @@ export declare const FAMILY_MEMBER_ACTION_TYPES: {
|
|
|
129
135
|
gender: string;
|
|
130
136
|
id: string;
|
|
131
137
|
hasStudentProfile: boolean;
|
|
138
|
+
idType: string;
|
|
132
139
|
idNumber: string;
|
|
140
|
+
idImages: string[];
|
|
133
141
|
isPrimary: boolean;
|
|
134
142
|
lastName: string;
|
|
135
143
|
occupation: string;
|
|
@@ -158,7 +166,9 @@ export declare const FAMILY_MEMBER_ACTION_TYPES: {
|
|
|
158
166
|
gender: string;
|
|
159
167
|
id: string;
|
|
160
168
|
hasStudentProfile: boolean;
|
|
169
|
+
idType: string;
|
|
161
170
|
idNumber: string;
|
|
171
|
+
idImages: string[];
|
|
162
172
|
isPrimary: boolean;
|
|
163
173
|
lastName: string;
|
|
164
174
|
occupation: string;
|
|
@@ -215,7 +225,9 @@ export declare const useFamilyMemberModule: () => {
|
|
|
215
225
|
gender: string;
|
|
216
226
|
id: string;
|
|
217
227
|
hasStudentProfile: boolean;
|
|
228
|
+
idType: string;
|
|
218
229
|
idNumber: string;
|
|
230
|
+
idImages: string[];
|
|
219
231
|
isPrimary: boolean;
|
|
220
232
|
lastName: string;
|
|
221
233
|
occupation: string;
|
|
@@ -28,6 +28,7 @@ import { createGenericModule } from "@react-pakistan/util-functions/factory/gene
|
|
|
28
28
|
import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
29
29
|
import { pageLimit } from "./constants";
|
|
30
30
|
import { normalizeIdNumber } from "../../utils/id-number";
|
|
31
|
+
import { isGovernmentIdType } from "../../utils/government-id";
|
|
31
32
|
import { FAMILY_MEMBER_API_ROUTES } from "../../constants";
|
|
32
33
|
import { familyMemberFormValidation } from "./validate";
|
|
33
34
|
import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
|
|
@@ -80,7 +81,9 @@ const familyMemberConfig = {
|
|
|
80
81
|
gender: "",
|
|
81
82
|
id: "",
|
|
82
83
|
hasStudentProfile: false,
|
|
84
|
+
idType: "",
|
|
83
85
|
idNumber: "",
|
|
86
|
+
idImages: [],
|
|
84
87
|
isPrimary: false,
|
|
85
88
|
lastName: "",
|
|
86
89
|
occupation: "",
|
|
@@ -141,7 +144,9 @@ export const useFamilyMemberModule = () => {
|
|
|
141
144
|
relationship: state.relationship,
|
|
142
145
|
occupation: state.occupation,
|
|
143
146
|
emergencyPhone: toE164Phone(state.emergencyPhone, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.country),
|
|
147
|
+
idType: state.idType,
|
|
144
148
|
idNumber: state.idNumber,
|
|
149
|
+
idImages: state.idImages,
|
|
145
150
|
avatar: state.avatar,
|
|
146
151
|
isPrimary: state.isPrimary,
|
|
147
152
|
enabled: state.enabled,
|
|
@@ -159,7 +164,9 @@ export const useFamilyMemberModule = () => {
|
|
|
159
164
|
state.firstName,
|
|
160
165
|
state.gender,
|
|
161
166
|
state.id,
|
|
167
|
+
state.idImages,
|
|
162
168
|
state.idNumber,
|
|
169
|
+
state.idType,
|
|
163
170
|
state.isPrimary,
|
|
164
171
|
state.lastName,
|
|
165
172
|
state.occupation,
|
|
@@ -240,7 +247,7 @@ export const useFamilyMemberModule = () => {
|
|
|
240
247
|
}
|
|
241
248
|
}, [showToast, t, resetFormAndCloseDrawer]);
|
|
242
249
|
const byIdCallback = useCallback(({ data, error }) => {
|
|
243
|
-
var _a, _b, _c, _d;
|
|
250
|
+
var _a, _b, _c, _d, _e, _f;
|
|
244
251
|
if (error) {
|
|
245
252
|
showToast(t("messagesDetailsFetchFailed"), TOAST_VARIANT.ERROR);
|
|
246
253
|
return;
|
|
@@ -262,10 +269,12 @@ export const useFamilyMemberModule = () => {
|
|
|
262
269
|
gender: member.gender,
|
|
263
270
|
hasStudentProfile: Boolean(member.studentProfile),
|
|
264
271
|
id: member.id,
|
|
272
|
+
idType: (_d = member.idType) !== null && _d !== void 0 ? _d : "",
|
|
265
273
|
idNumber: member.idNumber,
|
|
274
|
+
idImages: (_e = member.idImages) !== null && _e !== void 0 ? _e : [],
|
|
266
275
|
isPrimary: member.isPrimary,
|
|
267
276
|
lastName: member.lastName,
|
|
268
|
-
occupation: (
|
|
277
|
+
occupation: (_f = member.occupation) !== null && _f !== void 0 ? _f : "",
|
|
269
278
|
phone: member.phone || "",
|
|
270
279
|
relationship: member.relationship,
|
|
271
280
|
role: member.role,
|
|
@@ -414,8 +423,11 @@ export const useFamilyMemberModule = () => {
|
|
|
414
423
|
params: updateParams,
|
|
415
424
|
schema: familyMemberFormValidation,
|
|
416
425
|
successCallback: () => {
|
|
426
|
+
const idType = isGovernmentIdType(updateParams.idType)
|
|
427
|
+
? updateParams.idType
|
|
428
|
+
: undefined;
|
|
417
429
|
updateFetchNow(undefined, {
|
|
418
|
-
body: JSON.stringify(Object.assign(Object.assign({}, updateParams), { idNumber: normalizeIdNumber(updateParams.idNumber) })),
|
|
430
|
+
body: JSON.stringify(Object.assign(Object.assign({}, updateParams), { idType: idType !== null && idType !== void 0 ? idType : null, idNumber: normalizeIdNumber(updateParams.idNumber, idType) })),
|
|
419
431
|
});
|
|
420
432
|
},
|
|
421
433
|
errorCallback: (errors) => {
|
|
@@ -11,6 +11,7 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
11
11
|
import { useFamilyMemberModule } from "./context";
|
|
12
12
|
import { useTranslations } from "next-intl";
|
|
13
13
|
import { PhoneInput } from "../../components/phone-input";
|
|
14
|
+
import { GovernmentIdTypeSelect } from "../../components/government-id-type-select";
|
|
14
15
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
15
16
|
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
16
17
|
import { FAMILY_MEMBER_ROLE_OPTIONS, GENDER_OPTIONS } from "./constants";
|
|
@@ -18,7 +19,7 @@ import { toDateInput } from "./date";
|
|
|
18
19
|
export const FamilyMemberForm = () => {
|
|
19
20
|
var _a, _b;
|
|
20
21
|
const { handleChange, state } = useFamilyMemberModule();
|
|
21
|
-
const { bloodGroup, dateOfBirth, email, emergencyPhone, enabled, errors, firstName, gender, hasStudentProfile, idNumber, isPrimary, lastName, occupation, phone, relationship, role, } = state;
|
|
22
|
+
const { bloodGroup, dateOfBirth, email, emergencyPhone, enabled, errors, firstName, gender, hasStudentProfile, idType, idNumber, isPrimary, lastName, occupation, phone, relationship, role, } = state;
|
|
22
23
|
const t = useTranslations("familyMember");
|
|
23
24
|
const workspace = getCachedWorkspaceSync();
|
|
24
25
|
const roleLabelMap = {
|
|
@@ -41,5 +42,5 @@ export const FamilyMemberForm = () => {
|
|
|
41
42
|
})), placeholder: t("formRolePlaceholder"), required: true, searchPlaceholder: t("formRolePlaceholder"), value: role }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "dateOfBirth", t }), id: "dateOfBirth", info: t("formDateOfBirthInfo"), label: t("formDateOfBirthLabel"), onChange: (e) => handleChange("dateOfBirth", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, placeholder: "YYYY-MM-DD", type: "date", value: toDateInput(dateOfBirth) })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsx(EnhancedCombobox, { emptyText: t("formNoGenderEmpty"), error: getTranslatedError({ errors, key: "gender", t }), id: "gender", info: t("formGenderInfo"), label: t("formGenderLabel"), onValueChange: (value) => handleChange("gender", value), options: GENDER_OPTIONS.map((opt) => ({
|
|
42
43
|
value: opt.value,
|
|
43
44
|
label: genderLabelMap[opt.value] || opt.label,
|
|
44
|
-
})), placeholder: t("formGenderPlaceholder"), searchPlaceholder: t("formGenderPlaceholder"), value: gender }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "bloodGroup", t }), id: "bloodGroup", info: t("formBloodGroupInfo"), label: t("formBloodGroupLabel"), onChange: (e) => handleChange("bloodGroup", e.target.value), placeholder: t("formBloodGroupPlaceholder"), value: bloodGroup })] }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "idNumber", t }), id: "idNumber", info: t("formIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("idNumber", e.target.value), placeholder: t("formIdNumberPlaceholder"), value: idNumber })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionContactInformation") }), _jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsx(PhoneInput, { error: getTranslatedError({ errors, key: "phone", t }), id: "phone", info: t("formPhoneInfo"), label: t("formPhoneLabel"), onChange: (value) => handleChange("phone", value), placeholder: t("formPhonePlaceholder"), value: phone || "", defaultCountry: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.country) || "PK" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "email", t }), id: "email", info: t("formEmailInfo"), label: t("formEmailLabel"), onChange: (e) => handleChange("email", e.target.value), placeholder: t("formEmailPlaceholder"), type: "email", value: email })] }), _jsx(PhoneInput, { error: getTranslatedError({ errors, key: "emergencyPhone", t }), id: "emergencyPhone", info: t("formEmergencyPhoneInfo"), label: t("formEmergencyPhoneLabel"), onChange: (value) => handleChange("emergencyPhone", value), placeholder: t("formEmergencyPhonePlaceholder"), value: emergencyPhone || "", defaultCountry: ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.country) || "PK" })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionAdditionalInformation") }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "relationship", t }), id: "relationship", info: t("formRelationshipInfo"), label: t("formRelationshipLabel"), onChange: (e) => handleChange("relationship", e.target.value), placeholder: t("formRelationshipPlaceholder"), value: relationship }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "occupation", t }), id: "occupation", info: t("formOccupationInfo"), label: t("formOccupationLabel"), onChange: (e) => handleChange("occupation", e.target.value), placeholder: t("formOccupationPlaceholder"), value: occupation })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionStatus") }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(EnhancedCheckbox, { checked: isPrimary, id: "isPrimary", label: t("formPrimaryContactLabel"), onCheckedChange: (checked) => handleChange("isPrimary", checked === true) }), _jsx(EnhancedCheckbox, { checked: enabled, id: "enabled", label: t("badgeActive"), onCheckedChange: (checked) => handleChange("enabled", checked === true) })] })] })] }));
|
|
45
|
+
})), placeholder: t("formGenderPlaceholder"), searchPlaceholder: t("formGenderPlaceholder"), value: gender }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "bloodGroup", t }), id: "bloodGroup", info: t("formBloodGroupInfo"), label: t("formBloodGroupLabel"), onChange: (e) => handleChange("bloodGroup", e.target.value), placeholder: t("formBloodGroupPlaceholder"), value: bloodGroup })] }), _jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsx(GovernmentIdTypeSelect, { error: getTranslatedError({ errors, key: "idType", t }), id: "idType", onChange: (value) => handleChange("idType", value), required: Boolean(idNumber), value: idType }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "idNumber", t }), id: "idNumber", info: t("formIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("idNumber", e.target.value), placeholder: t("formIdNumberPlaceholder"), value: idNumber })] })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionContactInformation") }), _jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsx(PhoneInput, { error: getTranslatedError({ errors, key: "phone", t }), id: "phone", info: t("formPhoneInfo"), label: t("formPhoneLabel"), onChange: (value) => handleChange("phone", value), placeholder: t("formPhonePlaceholder"), value: phone || "", defaultCountry: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.country) || "PK" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "email", t }), id: "email", info: t("formEmailInfo"), label: t("formEmailLabel"), onChange: (e) => handleChange("email", e.target.value), placeholder: t("formEmailPlaceholder"), type: "email", value: email })] }), _jsx(PhoneInput, { error: getTranslatedError({ errors, key: "emergencyPhone", t }), id: "emergencyPhone", info: t("formEmergencyPhoneInfo"), label: t("formEmergencyPhoneLabel"), onChange: (value) => handleChange("emergencyPhone", value), placeholder: t("formEmergencyPhonePlaceholder"), value: emergencyPhone || "", defaultCountry: ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.country) || "PK" })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionAdditionalInformation") }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "relationship", t }), id: "relationship", info: t("formRelationshipInfo"), label: t("formRelationshipLabel"), onChange: (e) => handleChange("relationship", e.target.value), placeholder: t("formRelationshipPlaceholder"), value: relationship }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "occupation", t }), id: "occupation", info: t("formOccupationInfo"), label: t("formOccupationLabel"), onChange: (e) => handleChange("occupation", e.target.value), placeholder: t("formOccupationPlaceholder"), value: occupation })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-lg font-semibold", children: t("formSectionStatus") }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(EnhancedCheckbox, { checked: isPrimary, id: "isPrimary", label: t("formPrimaryContactLabel"), onCheckedChange: (checked) => handleChange("isPrimary", checked === true) }), _jsx(EnhancedCheckbox, { checked: enabled, id: "enabled", label: t("badgeActive"), onCheckedChange: (checked) => handleChange("enabled", checked === true) })] })] })] }));
|
|
45
46
|
};
|
|
@@ -12,6 +12,8 @@ export declare const VALIDATION_KEYS: {
|
|
|
12
12
|
readonly emailInvalid: "validationFamilyMemberEmailInvalid";
|
|
13
13
|
readonly idForUpdate: "validationFamilyMemberIdForUpdateRequired";
|
|
14
14
|
readonly phoneInvalid: "validationFamilyMemberPhoneInvalid";
|
|
15
|
+
readonly idTypeRequired: "validationFamilyMemberIdTypeRequired";
|
|
16
|
+
readonly idNumberInvalid: "validationFamilyMemberIdNumberInvalid";
|
|
15
17
|
};
|
|
16
18
|
export declare const familyMemberFormValidation: z.ZodObject<{
|
|
17
19
|
familyId: z.ZodString;
|
|
@@ -26,6 +28,7 @@ export declare const familyMemberFormValidation: z.ZodObject<{
|
|
|
26
28
|
relationship: z.ZodOptional<z.ZodString>;
|
|
27
29
|
occupation: z.ZodOptional<z.ZodString>;
|
|
28
30
|
emergencyPhone: z.ZodPreprocess<z.ZodPipe<z.ZodNullable<z.ZodOptional<z.ZodString>>, z.ZodTransform<string | null | undefined, string | null | undefined>>, unknown>;
|
|
31
|
+
idType: z.ZodOptional<z.ZodString>;
|
|
29
32
|
idNumber: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | null | undefined, string | undefined>>;
|
|
30
33
|
avatar: z.ZodOptional<z.ZodString>;
|
|
31
34
|
isPrimary: z.ZodOptional<z.ZodBoolean>;
|