@appcorp/fusion-storybook 0.2.86 → 0.2.89

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.
Files changed (147) hide show
  1. package/base-modules/admission/filter.js +3 -3
  2. package/base-modules/admission/form.js +1 -1
  3. package/base-modules/admission/more-actions.js +288 -2
  4. package/base-modules/admission/view.js +1 -1
  5. package/base-modules/attendance/form.js +3 -3
  6. package/base-modules/campus/form.js +2 -1
  7. package/base-modules/campus/validate.d.ts +13 -5
  8. package/base-modules/campus/validate.js +24 -19
  9. package/base-modules/class/form.js +2 -1
  10. package/base-modules/class/more-actions.js +2 -2
  11. package/base-modules/class/validate.d.ts +10 -5
  12. package/base-modules/class/validate.js +18 -16
  13. package/base-modules/class/view.js +2 -2
  14. package/base-modules/course/form.js +2 -1
  15. package/base-modules/course/validate.d.ts +7 -5
  16. package/base-modules/course/validate.js +12 -13
  17. package/base-modules/course/view.js +3 -3
  18. package/base-modules/discount-code/constants.d.ts +1 -1
  19. package/base-modules/discount-code/constants.js +1 -1
  20. package/base-modules/discount-code/form.js +2 -1
  21. package/base-modules/discount-code/more-actions.js +1 -1
  22. package/base-modules/discount-code/page.d.ts +10 -10
  23. package/base-modules/discount-code/page.js +31 -31
  24. package/base-modules/discount-code/validate.d.ts +5 -0
  25. package/base-modules/discount-code/validate.js +8 -3
  26. package/base-modules/discount-code/view.js +2 -2
  27. package/base-modules/enrollment/form.js +3 -2
  28. package/base-modules/enrollment/more-actions.js +5 -5
  29. package/base-modules/enrollment/page.d.ts +10 -10
  30. package/base-modules/enrollment/page.js +31 -31
  31. package/base-modules/enrollment/validate.d.ts +6 -0
  32. package/base-modules/enrollment/validate.js +13 -5
  33. package/base-modules/enrollment/view.js +2 -2
  34. package/base-modules/expense/filter.js +1 -1
  35. package/base-modules/expense/form.js +3 -3
  36. package/base-modules/expense/more-actions.js +6 -6
  37. package/base-modules/expense/page.d.ts +11 -11
  38. package/base-modules/expense/page.js +34 -34
  39. package/base-modules/expense/validate.d.ts +8 -0
  40. package/base-modules/expense/validate.js +13 -5
  41. package/base-modules/expense/view.js +2 -2
  42. package/base-modules/family/context.js +1 -1
  43. package/base-modules/family/form.js +1 -1
  44. package/base-modules/family/more-actions.js +2 -2
  45. package/base-modules/family/page.d.ts +10 -10
  46. package/base-modules/family/page.js +31 -31
  47. package/base-modules/family/validate.d.ts +4 -0
  48. package/base-modules/family/validate.js +8 -1
  49. package/base-modules/family/view.js +1 -1
  50. package/base-modules/family-member/context.js +1 -1
  51. package/base-modules/family-member/form.js +2 -1
  52. package/base-modules/family-member/more-actions.js +5 -5
  53. package/base-modules/family-member/page.d.ts +40 -13
  54. package/base-modules/family-member/page.js +34 -34
  55. package/base-modules/family-member/validate.d.ts +8 -0
  56. package/base-modules/family-member/validate.js +20 -5
  57. package/base-modules/family-member/view.js +3 -3
  58. package/base-modules/fee-structure/form.js +5 -4
  59. package/base-modules/fee-structure/more-actions.js +2 -2
  60. package/base-modules/fee-structure/page.d.ts +11 -11
  61. package/base-modules/fee-structure/page.js +34 -34
  62. package/base-modules/fee-structure/validate.d.ts +6 -0
  63. package/base-modules/fee-structure/validate.js +12 -3
  64. package/base-modules/fee-structure/view.js +3 -3
  65. package/base-modules/rbac/assign-permissions.js +9 -5
  66. package/base-modules/rbac/filter.js +5 -3
  67. package/base-modules/rbac/form.js +2 -1
  68. package/base-modules/rbac/more-actions.d.ts +0 -5
  69. package/base-modules/rbac/more-actions.js +3 -1
  70. package/base-modules/rbac/validate.d.ts +3 -0
  71. package/base-modules/rbac/validate.js +7 -1
  72. package/base-modules/rbac/view.js +7 -5
  73. package/base-modules/school/drawer.js +3 -1
  74. package/base-modules/school/form.js +2 -1
  75. package/base-modules/school/validate.d.ts +8 -0
  76. package/base-modules/school/validate.js +17 -6
  77. package/base-modules/school/view.js +2 -2
  78. package/base-modules/section/filter.js +1 -1
  79. package/base-modules/section/form.js +3 -2
  80. package/base-modules/section/page.d.ts +8 -8
  81. package/base-modules/section/page.js +25 -25
  82. package/base-modules/section/validate.d.ts +7 -0
  83. package/base-modules/section/validate.js +15 -5
  84. package/base-modules/section/view.js +3 -3
  85. package/base-modules/student-fee/filter.js +1 -1
  86. package/base-modules/student-fee/form.js +3 -2
  87. package/base-modules/student-fee/more-actions.js +11 -10
  88. package/base-modules/student-fee/page.d.ts +13 -13
  89. package/base-modules/student-fee/page.js +40 -40
  90. package/base-modules/student-fee/validate.d.ts +11 -3
  91. package/base-modules/student-fee/validate.js +20 -12
  92. package/base-modules/student-fee/view.js +4 -4
  93. package/base-modules/student-profile/context/use-student-profile-module.js +2 -2
  94. package/base-modules/student-profile/filter.js +2 -2
  95. package/base-modules/student-profile/form.js +6 -5
  96. package/base-modules/student-profile/page.d.ts +10 -10
  97. package/base-modules/student-profile/page.js +31 -31
  98. package/base-modules/student-profile/validate.d.ts +8 -2
  99. package/base-modules/student-profile/validate.js +13 -10
  100. package/base-modules/student-profile/view.js +2 -2
  101. package/base-modules/subject/filter.js +1 -1
  102. package/base-modules/subject/form.js +2 -1
  103. package/base-modules/subject/more-actions.js +3 -3
  104. package/base-modules/subject/page.d.ts +9 -9
  105. package/base-modules/subject/page.js +28 -28
  106. package/base-modules/subject/validate.d.ts +12 -1
  107. package/base-modules/subject/validate.js +24 -10
  108. package/base-modules/subject/view.js +3 -3
  109. package/base-modules/teacher/context.js +3 -3
  110. package/base-modules/teacher/filter.js +1 -1
  111. package/base-modules/teacher/form.js +9 -32
  112. package/base-modules/teacher/more-actions.js +2 -2
  113. package/base-modules/teacher/page.d.ts +10 -10
  114. package/base-modules/teacher/page.js +31 -31
  115. package/base-modules/teacher/validate.d.ts +5 -1
  116. package/base-modules/teacher/validate.js +10 -25
  117. package/base-modules/teacher/view.js +3 -3
  118. package/base-modules/user/filter.js +1 -1
  119. package/base-modules/user/form.js +3 -2
  120. package/base-modules/user/page.d.ts +9 -9
  121. package/base-modules/user/page.js +28 -28
  122. package/base-modules/user/validate.d.ts +8 -1
  123. package/base-modules/user/validate.js +16 -6
  124. package/base-modules/user/view.js +1 -1
  125. package/base-modules/workspace/context.js +3 -3
  126. package/base-modules/workspace/drawer.js +1 -1
  127. package/base-modules/workspace/filter.js +1 -1
  128. package/base-modules/workspace/form.js +2 -1
  129. package/base-modules/workspace/more-actions.js +1 -1
  130. package/base-modules/workspace/page.d.ts +1 -1
  131. package/base-modules/workspace/page.js +2 -2
  132. package/base-modules/workspace/validate.d.ts +4 -0
  133. package/base-modules/workspace/validate.js +6 -2
  134. package/base-modules/workspace/view.js +2 -2
  135. package/base-modules/workspace-user/context.js +6 -6
  136. package/base-modules/workspace-user/form.js +2 -1
  137. package/base-modules/workspace-user/page.d.ts +9 -9
  138. package/base-modules/workspace-user/page.js +28 -28
  139. package/base-modules/workspace-user/validate.d.ts +4 -5
  140. package/base-modules/workspace-user/validate.js +6 -10
  141. package/base-modules/workspace-user/view.js +1 -1
  142. package/constants.d.ts +5 -1
  143. package/constants.js +2 -0
  144. package/package.json +1 -1
  145. package/tsconfig.build.tsbuildinfo +1 -1
  146. package/utils/get-translated-error.d.ts +5 -0
  147. package/utils/get-translated-error.js +5 -0
@@ -30,8 +30,8 @@ export const AdmissionFilter = () => {
30
30
  : "false";
31
31
  const { enhancedComboboxElement: filterAdmissionStatusCombo } = useEnhancedCombobox({
32
32
  id: "filterAdmissionStatus",
33
- label: t("filterAdmissionStatusLabel"),
34
- info: t("filterByAdmissionStatus"),
33
+ label: t("drawerFilterAdmissionStatusLabel"),
34
+ info: t("drawerFilterAdmissionStatusInfo"),
35
35
  options: ADMISSION_STATUS_OPTIONS.map((opt) => ({
36
36
  value: opt.value,
37
37
  label: admissionStatusLabelMap[opt.value] || opt.label,
@@ -48,7 +48,7 @@ export const AdmissionFilter = () => {
48
48
  });
49
49
  },
50
50
  });
51
- return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [filterAdmissionStatusCombo, _jsxs("div", { children: [_jsx("label", { htmlFor: "startDate", className: "text-foreground mb-1 block text-sm font-medium", children: t("filterStartDateLabel") }), _jsx("input", { id: "startDate", type: "date", value: filterStartDate || "", onChange: (e) => handleSetStartDate(e.target.value), className: "border-input bg-background text-foreground focus:ring-ring w-full rounded-md border px-3 py-2 focus:border-transparent focus:ring-2 focus:outline-none" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "endDate", className: "text-foreground mb-1 block text-sm font-medium", children: t("filterEndDateLabel") }), _jsx("input", { id: "endDate", type: "date", value: filterEndDate || "", onChange: (e) => handleSetEndDate(e.target.value), className: "border-input bg-background text-foreground focus:ring-ring w-full rounded-md border px-3 py-2 focus:border-transparent focus:ring-2 focus:outline-none" })] }), _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
51
+ return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [filterAdmissionStatusCombo, _jsxs("div", { children: [_jsx("label", { htmlFor: "startDate", className: "text-foreground mb-1 block text-sm font-medium", children: t("drawerFilterStartDateLabel") }), _jsx("input", { id: "startDate", type: "date", value: filterStartDate || "", onChange: (e) => handleSetStartDate(e.target.value), className: "border-input bg-background text-foreground focus:ring-ring w-full rounded-md border px-3 py-2 focus:border-transparent focus:ring-2 focus:outline-none" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "endDate", className: "text-foreground mb-1 block text-sm font-medium", children: t("drawerFilterEndDateLabel") }), _jsx("input", { id: "endDate", type: "date", value: filterEndDate || "", onChange: (e) => handleSetEndDate(e.target.value), className: "border-input bg-background text-foreground focus:ring-ring w-full rounded-md border px-3 py-2 focus:border-transparent focus:ring-2 focus:outline-none" })] }), _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
52
52
  { label: t("filterOptionAll"), value: "undefined" },
53
53
  { label: t("filterOptionEnabled"), value: "true" },
54
54
  { label: t("filterOptionDisabled"), value: "false" },
@@ -129,5 +129,5 @@ export const AdmissionForm = () => {
129
129
  }
130
130
  // eslint-disable-next-line react-hooks/exhaustive-deps
131
131
  }, [id, dispatch]);
132
- 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), 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("formCheckboxHafizLabel"), id: "hafiz", info: t("formHafizInfo"), onCheckedChange: (checked) => handleChange("hafiz", checked) }), _jsx(EnhancedCheckbox, { label: t("formCheckboxOrphanLabel"), 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 || "" })] })] }));
132
+ 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), 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 || "" })] })] }));
133
133
  };
@@ -1,5 +1,291 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { downloadFromUrl } from "@react-pakistan/util-functions";
4
+ import { showErrorToast, showSuccessToast, showInfoToast, } from "@appcorp/shadcn/lib/toast-utils";
5
+ import { getCachedWorkspaceSync } from "../workspace/cache";
6
+ import converter from "json-2-csv";
7
+ import { Timeline } from "../../components/timeline";
8
+ import { useTranslations } from "next-intl";
9
+ import { pageLimit } from "./constants";
10
+ import { ADMISSION_API_ROUTES } from "../../constants";
11
+ import { ADMISSION_ACTION_TYPES, useAdmissionContext, } from "./context";
12
+ import { useRef, useEffect, useCallback } from "react";
13
+ const workspace = getCachedWorkspaceSync();
14
+ const POLL_INTERVAL_MS = 2000;
15
+ const POLL_TIMEOUT_MS = 300000;
16
+ const handleGetAllRecords = async (schoolId, pageLimit) => {
17
+ const response = await fetch(`${ADMISSION_API_ROUTES.UNIT}?pageLimit=${pageLimit}&currentPage=1&schoolId=${schoolId}`);
18
+ const result = await response.json();
19
+ const csv = await converter.json2csv(result.items || [], {});
20
+ const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
21
+ await downloadFromUrl(blob, "admission.csv");
22
+ };
23
+ async function submitBulkJob(csvData, method, signal) {
24
+ var _a;
25
+ const schoolId = ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "";
26
+ if (!schoolId)
27
+ throw new Error("School ID not found");
28
+ const res = await fetch(ADMISSION_API_ROUTES.BULK, {
29
+ method,
30
+ headers: {
31
+ "Content-Type": "application/json",
32
+ },
33
+ body: JSON.stringify({ schoolId, csvData }),
34
+ signal,
35
+ });
36
+ if (!res.ok) {
37
+ const errorData = (await res.json().catch(() => ({})));
38
+ throw new Error(errorData.error || `Bulk operation failed with status ${res.status}`);
39
+ }
40
+ const data = (await res.json());
41
+ return data.jobId;
42
+ }
43
+ async function pollBulkJob(jobId, signal, onProgress) {
44
+ const startTime = Date.now();
45
+ let lastProgressToast = 0;
46
+ while (true) {
47
+ if (signal.aborted)
48
+ throw new Error("Polling cancelled");
49
+ if (Date.now() - startTime > POLL_TIMEOUT_MS) {
50
+ throw new Error("Bulk operation timed out");
51
+ }
52
+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
53
+ if (signal.aborted)
54
+ throw new Error("Polling cancelled");
55
+ const res = await fetch(ADMISSION_API_ROUTES.BULK_STATUS(jobId), {
56
+ signal,
57
+ });
58
+ if (!res.ok)
59
+ continue;
60
+ const data = (await res.json());
61
+ if (data.status === "completed" || data.status === "failed") {
62
+ return data;
63
+ }
64
+ if (data.status === "running" && Date.now() - lastProgressToast > 10000) {
65
+ lastProgressToast = Date.now();
66
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(data.processed, data.total);
67
+ }
68
+ }
69
+ }
70
+ function formatErrorSummary(t, errors) {
71
+ if (!(errors === null || errors === void 0 ? void 0 : errors.length))
72
+ return "";
73
+ const lines = errors
74
+ .slice(0, 5)
75
+ .map((e) => t("messagesBulkRowError", { row: e.row, error: e.error }));
76
+ const remaining = errors.length - 5;
77
+ if (remaining > 0)
78
+ lines.push(t("messagesBulkMoreRows", { count: remaining }));
79
+ return lines.join("\n");
80
+ }
3
81
  export const AdmissionMoreActions = () => {
4
- return _jsx("div", { className: "space-y-4", children: "More actions for admissions" });
82
+ const t = useTranslations("admission");
83
+ const { dispatch } = useAdmissionContext();
84
+ const abortRef = useRef(null);
85
+ useEffect(() => {
86
+ return () => {
87
+ var _a;
88
+ (_a = abortRef.current) === null || _a === void 0 ? void 0 : _a.abort();
89
+ };
90
+ }, []);
91
+ const handleBulkFlow = useCallback(async (files, method) => {
92
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
93
+ const closeDrawer = () => {
94
+ dispatch({
95
+ type: ADMISSION_ACTION_TYPES.SET_DRAWER,
96
+ payload: { drawer: null },
97
+ });
98
+ };
99
+ (_a = abortRef.current) === null || _a === void 0 ? void 0 : _a.abort();
100
+ const controller = new AbortController();
101
+ abortRef.current = controller;
102
+ const { signal } = controller;
103
+ const label = method === "POST" ? "create" : "update";
104
+ const file = files[0];
105
+ const text = await file.text();
106
+ const records = converter.csv2json(text);
107
+ if (!Array.isArray(records) || records.length === 0) {
108
+ showErrorToast(t("messagesBulkCsvEmpty"));
109
+ return;
110
+ }
111
+ const validationErrors = [];
112
+ for (let i = 0; i < records.length; i++) {
113
+ const row = records[i];
114
+ const msgs = [];
115
+ if (method === "POST") {
116
+ if (!((_b = row.firstName) === null || _b === void 0 ? void 0 : _b.trim()))
117
+ msgs.push(t("validationRequiredFirstName"));
118
+ if (!((_c = row.lastName) === null || _c === void 0 ? void 0 : _c.trim()))
119
+ msgs.push(t("validationRequiredLastName"));
120
+ if (!((_d = row.registrationCode) === null || _d === void 0 ? void 0 : _d.trim()))
121
+ msgs.push(t("validationRequiredRegistrationCode"));
122
+ if (!((_e = row.studentIdNumber) === null || _e === void 0 ? void 0 : _e.trim()))
123
+ msgs.push(t("validationRequiredStudentIdNumber"));
124
+ if (!((_f = row.dob) === null || _f === void 0 ? void 0 : _f.trim()))
125
+ msgs.push(t("validationRequiredDateOfBirth"));
126
+ if (!((_g = row.gender) === null || _g === void 0 ? void 0 : _g.trim()))
127
+ msgs.push(t("validationRequiredGender"));
128
+ if (!((_h = row.fatherFirstName) === null || _h === void 0 ? void 0 : _h.trim()))
129
+ msgs.push(t("validationRequiredFatherFirstName"));
130
+ if (!((_j = row.fatherLastName) === null || _j === void 0 ? void 0 : _j.trim()))
131
+ msgs.push(t("validationRequiredFatherLastName"));
132
+ if (!((_k = row.fatherIdNumber) === null || _k === void 0 ? void 0 : _k.trim()))
133
+ msgs.push(t("validationRequiredFatherIdNumber"));
134
+ if (!((_l = row.fatherMobile) === null || _l === void 0 ? void 0 : _l.trim()))
135
+ msgs.push(t("validationRequiredFatherMobile"));
136
+ if (!((_m = row.motherFirstName) === null || _m === void 0 ? void 0 : _m.trim()))
137
+ msgs.push(t("validationRequiredMotherFirstName"));
138
+ if (!((_o = row.motherLastName) === null || _o === void 0 ? void 0 : _o.trim()))
139
+ msgs.push(t("validationRequiredMotherLastName"));
140
+ if (!((_p = row.motherIdNumber) === null || _p === void 0 ? void 0 : _p.trim()))
141
+ msgs.push(t("validationRequiredMotherIdNumber"));
142
+ if (!((_q = row.motherMobile) === null || _q === void 0 ? void 0 : _q.trim()))
143
+ msgs.push(t("validationRequiredMotherMobile"));
144
+ if (!((_r = row.address) === null || _r === void 0 ? void 0 : _r.trim()))
145
+ msgs.push(t("validationRequiredHomeAddress"));
146
+ if (!((_s = row.city) === null || _s === void 0 ? void 0 : _s.trim()))
147
+ msgs.push(t("validationRequiredCity"));
148
+ if (!((_t = row.state) === null || _t === void 0 ? void 0 : _t.trim()))
149
+ msgs.push(t("validationRequiredState"));
150
+ if (!((_u = row.country) === null || _u === void 0 ? void 0 : _u.trim()))
151
+ msgs.push(t("validationRequiredCountry"));
152
+ if (!((_v = row.classForAdmission) === null || _v === void 0 ? void 0 : _v.trim()))
153
+ msgs.push(t("validationRequiredClassForAdmission"));
154
+ }
155
+ else {
156
+ if (!((_w = row.id) === null || _w === void 0 ? void 0 : _w.trim()))
157
+ msgs.push(t("validationRequiredIdForUpdate"));
158
+ }
159
+ if (msgs.length > 0) {
160
+ validationErrors.push({ row: i + 1, messages: msgs });
161
+ }
162
+ }
163
+ if (validationErrors.length > 0) {
164
+ const summary = validationErrors
165
+ .slice(0, 5)
166
+ .map((e) => t("messagesBulkRowError", {
167
+ row: e.row,
168
+ error: e.messages.join("; "),
169
+ }))
170
+ .join("\n");
171
+ showErrorToast(t("messagesBulkValidationFailed", {
172
+ count: validationErrors.length,
173
+ errors: summary,
174
+ }));
175
+ return;
176
+ }
177
+ try {
178
+ showInfoToast(t("messagesBulkJobQueued", { action: label, count: records.length }));
179
+ let jobId;
180
+ try {
181
+ jobId = await submitBulkJob(text, method, signal);
182
+ }
183
+ catch (submitError) {
184
+ showErrorToast(t("messagesBulkJobSubmitFailed", {
185
+ action: label,
186
+ error: submitError instanceof Error
187
+ ? submitError.message
188
+ : t("unknownError"),
189
+ }));
190
+ return;
191
+ }
192
+ const status = await pollBulkJob(jobId, signal, (processed, total) => {
193
+ showInfoToast(t("messagesBulkProgress", { processed, total }));
194
+ });
195
+ if (signal.aborted)
196
+ return;
197
+ if (status.status === "completed") {
198
+ const r = status.results;
199
+ if (r && ((_x = r.errors) === null || _x === void 0 ? void 0 : _x.length) > 0) {
200
+ const summary = formatErrorSummary(t, r.errors);
201
+ showSuccessToast(t("messagesBulkResults", {
202
+ created: r.created,
203
+ updated: r.updated,
204
+ skipped: r.skipped,
205
+ }) +
206
+ "\n" +
207
+ summary);
208
+ }
209
+ else if (r) {
210
+ showSuccessToast(t("messagesBulkResults", {
211
+ created: r.created,
212
+ updated: r.updated,
213
+ skipped: r.skipped,
214
+ }));
215
+ }
216
+ else {
217
+ showSuccessToast(t("messagesBulkSuccess"));
218
+ }
219
+ const schoolId = ((_y = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _y === void 0 ? void 0 : _y.id) || "";
220
+ fetch(`${ADMISSION_API_ROUTES.UNIT}?currentPage=1&pageLimit=${pageLimit}&schoolId=${schoolId}`, {
221
+ headers: {
222
+ "Content-Type": "application/json",
223
+ },
224
+ })
225
+ .then(async (res) => {
226
+ var _a, _b;
227
+ if (!res.ok)
228
+ return;
229
+ const data = await res.json();
230
+ dispatch({
231
+ type: ADMISSION_ACTION_TYPES.SET_ITEMS,
232
+ payload: {
233
+ items: (_a = data.items) !== null && _a !== void 0 ? _a : [],
234
+ count: (_b = data.count) !== null && _b !== void 0 ? _b : 0,
235
+ },
236
+ });
237
+ })
238
+ .catch(() => { });
239
+ closeDrawer();
240
+ }
241
+ else {
242
+ const r = status.results;
243
+ const detail = ((_z = r === null || r === void 0 ? void 0 : r.errors) === null || _z === void 0 ? void 0 : _z.length)
244
+ ? formatErrorSummary(t, r.errors)
245
+ : t("unknownError");
246
+ showErrorToast(t("messagesBulkFailed", { action: label }) + "\n" + detail);
247
+ }
248
+ }
249
+ catch (error) {
250
+ if (error.message === "Polling cancelled")
251
+ return;
252
+ showErrorToast(t("messagesBulkFailedDetail", {
253
+ action: label,
254
+ error: error instanceof Error ? error.message : t("unknownError"),
255
+ }));
256
+ }
257
+ }, [dispatch, t]);
258
+ const handleBulkCreate = useCallback((files) => handleBulkFlow(files, "POST"), [handleBulkFlow]);
259
+ const handleBulkUpdate = useCallback((files) => handleBulkFlow(files, "PUT"), [handleBulkFlow]);
260
+ const create = [
261
+ {
262
+ id: "1",
263
+ title: t("downloadEmptyCsvTemplate"),
264
+ handleOnClick: async () => {
265
+ var _a;
266
+ await handleGetAllRecords(((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "", 1);
267
+ },
268
+ },
269
+ { id: "2", title: t("addYourDataToTheCsv") },
270
+ {
271
+ id: "3",
272
+ title: t("uploadTheCompletedCsvToTheSystem"),
273
+ },
274
+ ];
275
+ const update = [
276
+ {
277
+ id: "1",
278
+ title: t("downloadPopulatedCsvTemplate"),
279
+ handleOnClick: async () => {
280
+ var _a;
281
+ await handleGetAllRecords(((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "", 5000);
282
+ },
283
+ },
284
+ { id: "2", title: t("updateYourDataInTheCsv") },
285
+ {
286
+ id: "3",
287
+ title: t("uploadTheCompletedCsvToTheSystem"),
288
+ },
289
+ ];
290
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Timeline, { events: create, heading: t("bulkCreate"), handleOnBulkCreate: handleBulkCreate }), _jsx(Timeline, { events: update, heading: t("bulkUpdate"), handleOnBulkCreate: handleBulkUpdate })] }));
5
291
  };
@@ -44,5 +44,5 @@ export const AdmissionView = () => {
44
44
  };
45
45
  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
46
46
  ? t("viewButtonReRunAnalysis")
47
- : 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("viewFieldDob") }), _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: formatValue(discountCode) })] }), _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("viewFieldYes") : t("viewFieldNo") })] }), _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("viewFieldYes") : t("viewFieldNo") })] })] }) })] }), _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: [_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")] })] }) })] })] }));
47
+ : 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: formatValue(discountCode) })] }), _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: [_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")] })] }) })] })] }));
48
48
  };
@@ -39,7 +39,7 @@ export const AttendanceForm = () => {
39
39
  const { enhancedComboboxElement: statusCombo } = useEnhancedCombobox({
40
40
  id: "status",
41
41
  info: t("formStatusInfo"),
42
- label: t("formOptionStatus"),
42
+ label: t("formStatusLabel"),
43
43
  onValueChange: (value) => handleChange("status", value),
44
44
  options: ATTENDANCE_STATUS_OPTIONS.map((opt) => ({
45
45
  value: opt.value,
@@ -62,7 +62,7 @@ export const AttendanceForm = () => {
62
62
  const { enhancedComboboxElement: studentProfile } = useEnhancedCombobox({
63
63
  id: "studentProfile",
64
64
  info: t("formStudentProfileInfo"),
65
- label: t("formOptionStudentProfile"),
65
+ label: t("formStudentProfileLabel"),
66
66
  onValueChange: (value) => handleChange("studentProfile", value),
67
67
  options: ((studentProfileData === null || studentProfileData === void 0 ? void 0 : studentProfileData.items) || []).map((opt) => {
68
68
  var _a, _b;
@@ -85,5 +85,5 @@ export const AttendanceForm = () => {
85
85
  },
86
86
  value: status,
87
87
  });
88
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.date, id: "date", info: t("formDateInfo"), label: t("formDateLabel"), onChange: (e) => handleChange("date", e.target.value), placeholder: t("formDatePlaceholder"), required: true, type: "date", value: date }), statusCombo, studentProfile, _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: t("formRemarksInfo"), label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), rows: 3, value: remarks !== null && remarks !== void 0 ? remarks : "" }), _jsx(EnhancedCheckbox, { defaultChecked: enabled, label: t("formActiveAttendanceRecordLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
88
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.date, id: "date", info: t("formDateInfo"), label: t("formDateLabel"), onChange: (e) => handleChange("date", e.target.value), placeholder: t("formDatePlaceholder"), required: true, type: "date", value: date }), statusCombo, studentProfile, _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: t("formRemarksInfo"), label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), rows: 3, value: remarks !== null && remarks !== void 0 ? remarks : "" }), _jsx(EnhancedCheckbox, { defaultChecked: enabled, label: t("formActiveRecordLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
89
89
  };
@@ -9,9 +9,10 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
9
9
  import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
10
10
  import { useCampusModule } from "./context";
11
11
  import { useTranslations } from "next-intl";
12
+ import { getTranslatedError } from "../../utils/get-translated-error";
12
13
  export const CampusForm = () => {
13
14
  const { state, handleChange } = useCampusModule();
14
15
  const { address, city, code, country, enabled, errors, name, phone, state: campusState, } = state;
15
16
  const t = useTranslations("campus");
16
- return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors.name, id: "name", info: t("formCampusNameInfo"), label: t("formCampusNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formCampusNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: errors.code, id: "code", info: t("formCampusCodeInfo"), label: t("formCampusCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formCampusCodePlaceholder"), required: true, value: code }), _jsx(EnhancedInput, { error: errors.address, id: "address", info: t("formAddressInfo"), label: t("formAddressLabel"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("formAddressPlaceholder"), 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"), 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"), value: campusState || "" }), _jsx(EnhancedInput, { error: errors.country, id: "country", info: t("formCountryInfo"), label: t("formCountryLabel"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("formCountryPlaceholder"), value: country || "" }), _jsx(EnhancedInput, { error: errors.phone, id: "phone", info: t("formPhoneInfo"), label: t("formPhoneLabel"), onChange: (e) => handleChange("phone", e.target.value), placeholder: t("formPhonePlaceholder"), value: phone || "" }), _jsx(EnhancedCheckbox, { info: t("formActiveCampusInfo"), label: t("formActiveCampusLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
17
+ return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "name", t }), id: "name", info: t("formCampusNameInfo"), label: t("formCampusNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formCampusNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "code", t }), id: "code", info: t("formCampusCodeInfo"), label: t("formCampusCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formCampusCodePlaceholder"), required: true, value: code }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "address", t }), id: "address", info: t("formAddressInfo"), label: t("formAddressLabel"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("formAddressPlaceholder"), 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"), 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"), value: campusState || "" }), _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"), value: country || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "phone", t }), id: "phone", info: t("formPhoneInfo"), label: t("formPhoneLabel"), onChange: (e) => handleChange("phone", e.target.value), placeholder: t("formPhonePlaceholder"), value: phone || "" }), _jsx(EnhancedCheckbox, { info: t("formActiveCampusInfo"), label: t("formActiveCampusLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
17
18
  };
@@ -1,9 +1,17 @@
1
- /**
2
- * Campus Validation Schema
3
- *
4
- * Zod validation schemas for campus form data with business rules.
5
- */
6
1
  import { z } from "zod";
2
+ export declare const VALIDATION_KEYS: {
3
+ readonly nameRequired: "validationCampusNameRequired";
4
+ readonly nameMaxLength: "validationCampusNameMaxLength";
5
+ readonly codeRequired: "validationCampusCodeRequired";
6
+ readonly codeMaxLength: "validationCampusCodeMaxLength";
7
+ readonly codeFormat: "validationCampusCodeFormat";
8
+ readonly codeMinLength: "validationCampusCodeMinLength";
9
+ readonly addressMaxLength: "validationCampusAddressMaxLength";
10
+ readonly cityMaxLength: "validationCampusCityMaxLength";
11
+ readonly stateMaxLength: "validationCampusStateMaxLength";
12
+ readonly countryMaxLength: "validationCampusCountryMaxLength";
13
+ readonly phoneMaxLength: "validationCampusPhoneMaxLength";
14
+ };
7
15
  export declare const campusFormValidation: z.ZodObject<{
8
16
  name: z.ZodString;
9
17
  code: z.ZodString;
@@ -1,46 +1,51 @@
1
- /**
2
- * Campus Validation Schema
3
- *
4
- * Zod validation schemas for campus form data with business rules.
5
- */
6
1
  import { z } from "zod";
7
- // ============================================================================
8
- // VALIDATION SCHEMA
9
- // ============================================================================
2
+ export const VALIDATION_KEYS = {
3
+ nameRequired: "validationCampusNameRequired",
4
+ nameMaxLength: "validationCampusNameMaxLength",
5
+ codeRequired: "validationCampusCodeRequired",
6
+ codeMaxLength: "validationCampusCodeMaxLength",
7
+ codeFormat: "validationCampusCodeFormat",
8
+ codeMinLength: "validationCampusCodeMinLength",
9
+ addressMaxLength: "validationCampusAddressMaxLength",
10
+ cityMaxLength: "validationCampusCityMaxLength",
11
+ stateMaxLength: "validationCampusStateMaxLength",
12
+ countryMaxLength: "validationCampusCountryMaxLength",
13
+ phoneMaxLength: "validationCampusPhoneMaxLength",
14
+ };
10
15
  export const campusFormValidation = z.object({
11
16
  name: z
12
17
  .string()
13
- .min(1, "Name is required")
14
- .max(100, "Name must be less than 100 characters"),
18
+ .min(1, VALIDATION_KEYS.nameRequired)
19
+ .max(100, VALIDATION_KEYS.nameMaxLength),
15
20
  code: z
16
21
  .string()
17
- .min(1, "Code is required")
18
- .max(20, "Code must be less than 20 characters")
19
- .regex(/^[A-Z0-9\-_]+$/, "Code must be uppercase letters, numbers, hyphens, or underscores")
20
- .refine((code) => code.length >= 2, "Code must be at least 2 characters"),
22
+ .min(1, VALIDATION_KEYS.codeRequired)
23
+ .max(20, VALIDATION_KEYS.codeMaxLength)
24
+ .regex(/^[A-Z0-9\-_]+$/, VALIDATION_KEYS.codeFormat)
25
+ .refine((code) => code.length >= 2, VALIDATION_KEYS.codeMinLength),
21
26
  address: z
22
27
  .string()
23
- .max(255, "Address must be less than 255 characters")
28
+ .max(255, VALIDATION_KEYS.addressMaxLength)
24
29
  .optional()
25
30
  .nullable(),
26
31
  city: z
27
32
  .string()
28
- .max(100, "City must be less than 100 characters")
33
+ .max(100, VALIDATION_KEYS.cityMaxLength)
29
34
  .optional()
30
35
  .nullable(),
31
36
  state: z
32
37
  .string()
33
- .max(100, "State must be less than 100 characters")
38
+ .max(100, VALIDATION_KEYS.stateMaxLength)
34
39
  .optional()
35
40
  .nullable(),
36
41
  country: z
37
42
  .string()
38
- .max(100, "Country must be less than 100 characters")
43
+ .max(100, VALIDATION_KEYS.countryMaxLength)
39
44
  .optional()
40
45
  .nullable(),
41
46
  phone: z
42
47
  .string()
43
- .max(30, "Phone must be less than 30 characters")
48
+ .max(30, VALIDATION_KEYS.phoneMaxLength)
44
49
  .optional()
45
50
  .nullable(),
46
51
  enabled: z.boolean().optional(),
@@ -10,9 +10,10 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
10
10
  import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
11
11
  import { useClassModule } from "./context";
12
12
  import { useTranslations } from "next-intl";
13
+ import { getTranslatedError } from "../../utils/get-translated-error";
13
14
  export const ClassForm = () => {
14
15
  const { state, handleChange } = useClassModule();
15
16
  const { code, description, enabled, errors, name } = state;
16
17
  const t = useTranslations("class");
17
- return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors.name, id: "name", info: t("formClassNameInfo"), label: t("formClassNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formClassNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: errors.code, id: "code", info: t("formClassCodeInfo"), label: t("formClassCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formClassCodePlaceholder"), required: true, value: code }), _jsx(EnhancedTextarea, { error: errors.description, id: "description", info: t("formDescriptionInfo"), label: t("formDescriptionLabel"), onChange: (e) => handleChange("description", e.target.value), placeholder: t("formDescriptionPlaceholder"), rows: 3, value: description || "" }), _jsx(EnhancedCheckbox, { label: t("formActiveClassLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("actionToggleActivateOrDeactivateClass") })] }) }));
18
+ return (_jsx("div", { className: "space-y-4", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "name", t }), id: "name", info: t("formClassNameInfo"), label: t("formClassNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formClassNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "code", t }), id: "code", info: t("formClassCodeInfo"), label: t("formClassCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formClassCodePlaceholder"), required: true, value: code }), _jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "description", t }), id: "description", info: t("formDescriptionInfo"), label: t("formDescriptionLabel"), onChange: (e) => handleChange("description", e.target.value), placeholder: t("formDescriptionPlaceholder"), rows: 3, value: description || "" }), _jsx(EnhancedCheckbox, { label: t("formActiveClassLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("formActiveClassInfo") })] }) }));
18
19
  };