@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
@@ -1,26 +1,29 @@
1
1
  /**
2
- * Student Validation Schema
2
+ * Student Profile Validation Schema
3
3
  *
4
- * Zod validation schemas for student form data.
4
+ * Zod validation schemas for student profile form data.
5
5
  */
6
6
  import { z } from "zod";
7
- // ============================================================================
8
- // VALIDATION SCHEMA
9
- // ============================================================================
7
+ export const VALIDATION_KEYS = {
8
+ firstNameRequired: "validationStudentProfileFirstNameRequired",
9
+ lastNameRequired: "validationStudentProfileLastNameRequired",
10
+ phoneInvalid: "validationStudentProfilePhoneInvalid",
11
+ statusRequired: "validationStudentProfileStatusRequired",
12
+ };
10
13
  export const studentProfileFormValidation = z.object({
11
- firstName: z.string().min(1, "First name is required"),
12
- lastName: z.string().min(1, "Last name is required"),
14
+ firstName: z.string().min(1, VALIDATION_KEYS.firstNameRequired),
15
+ lastName: z.string().min(1, VALIDATION_KEYS.lastNameRequired),
13
16
  phone: z
14
17
  .string()
15
18
  .optional()
16
19
  .refine((val) => !val ||
17
- /^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)]?)?([-]?[\s]?[0-9])+$/.test(val), "Invalid phone number format"),
20
+ /^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)]?)?([-]?[\s]?[0-9])+$/.test(val), VALIDATION_KEYS.phoneInvalid),
18
21
  emergencyPhone: z
19
22
  .string()
20
23
  .optional()
21
24
  .refine((val) => !val ||
22
- /^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)]?)?([-]?[\s]?[0-9])+$/.test(val), "Invalid phone number format"),
23
- status: z.string().min(1, "Status is required"),
25
+ /^([+]?[\s0-9]+)?(\d{3}|[(]?[0-9]+[)]?)?([-]?[\s]?[0-9])+$/.test(val), VALIDATION_KEYS.phoneInvalid),
26
+ status: z.string().min(1, VALIDATION_KEYS.statusRequired),
24
27
  dateOfBirth: z.string().optional(),
25
28
  enrollmentDate: z.string().optional(),
26
29
  gender: z.string().optional(),
@@ -22,8 +22,8 @@ export const StudentProfileView = () => {
22
22
  return "\u2014";
23
23
  return formatDate(new Date(date).toISOString(), DATE_FORMATS.LOCALE_DATE);
24
24
  };
25
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsxs(Avatar, { className: "h-24 w-24", children: [_jsx(AvatarImage, { src: avatar || undefined, alt: fullName }), _jsx(AvatarFallback, { className: "text-2xl", children: initials })] }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: fullName }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("viewFieldStudentCode"), ": ", studentCode || "N/A"] }), email && (_jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: email }))] })] }) }) }), _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("viewSectionPersonalInformation") })] }), _jsx(CardDescription, { children: t("viewSectionBasicPersonalDetails") })] }), _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("viewFieldFirstName") }), _jsx("p", { className: "text-base", children: formatValue(firstName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldLastName") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDateOfBirth") })] }), _jsx("p", { className: "text-base", children: formatDateValue(dateOfBirth) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), _jsx(Badge, { variant: "secondary", className: "capitalize", children: formatValue(gender === null || gender === void 0 ? void 0 : gender.toLowerCase()) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionContactInformation") })] }), _jsx(CardDescription, { children: t("viewFieldContactDetailsAndLocation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [email && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmail") }), _jsx("p", { className: "text-base", children: formatValue(email) })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPhone") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(phone) || formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmergencyPhone") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(emergencyPhone) ||
26
- formatValue(emergencyPhone) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MapPin, { className: "text-muted-foreground h-4 w-4" }), _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("viewFieldStateProvince") }), _jsx("p", { className: "text-base", children: formatValue(stateValue) })] }), _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(GraduationCap, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAcademicInformation") })] }), _jsx(CardDescription, { children: t("viewFieldEnrollmentAndAcademicStatus") })] }), _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("viewFieldStatus") }), _jsx(Badge, { variant: status === "ACTIVE"
25
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsxs(Avatar, { className: "h-24 w-24", children: [_jsx(AvatarImage, { src: avatar || undefined, alt: fullName }), _jsx(AvatarFallback, { className: "text-2xl", children: initials })] }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: fullName }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("tableColumnHeaderStudentCode"), ": ", studentCode || "N/A"] }), email && (_jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: email }))] })] }) }) }), _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("viewSectionPersonalInformation") })] }), _jsx(CardDescription, { children: t("viewSectionBasicPersonalDetails") })] }), _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("formFirstNameLabel") }), _jsx("p", { className: "text-base", children: formatValue(firstName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formLastNameLabel") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDateOfBirthLabel") })] }), _jsx("p", { className: "text-base", children: formatDateValue(dateOfBirth) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formGenderLabel") }), _jsx(Badge, { variant: "secondary", className: "capitalize", children: formatValue(gender === null || gender === void 0 ? void 0 : gender.toLowerCase()) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionContactInformation") })] }), _jsx(CardDescription, { children: t("viewFieldContactDetailsAndLocation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [email && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmail") }), _jsx("p", { className: "text-base", children: formatValue(email) })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formPhoneLabel") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(phone) || formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formEmergencyPhoneLabel") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(emergencyPhone) ||
26
+ formatValue(emergencyPhone) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MapPin, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAddressLabel") })] }), _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("formCityLabel") }), _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("formStateProvinceLabel") }), _jsx("p", { className: "text-base", children: formatValue(stateValue) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formCountryLabel") }), _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("formPostalCodeLabel") }), _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(GraduationCap, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAcademicInformation") })] }), _jsx(CardDescription, { children: t("viewFieldEnrollmentAndAcademicStatus") })] }), _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("formStatusLabel") }), _jsx(Badge, { variant: status === "ACTIVE"
27
27
  ? "default"
28
28
  : status === "GRADUATED"
29
29
  ? "secondary"
@@ -17,7 +17,7 @@ export const SubjectFilter = () => {
17
17
  : filterEnabled
18
18
  ? "true"
19
19
  : "false";
20
- return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "grid grid-cols-1 gap-4", children: _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
20
+ return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "grid grid-cols-1 gap-4", children: _jsx(EnhancedRadio, { label: t("filterEnabledLabel"), name: "filterEnabled", value: filterEnabledValue, options: [
21
21
  { label: t("filterOptionAll"), value: "undefined" },
22
22
  { label: t("filterOptionEnabled"), value: "true" },
23
23
  { label: t("filterOptionDisabled"), value: "false" },
@@ -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 { useSubjectModule } from "./context";
12
12
  import { useTranslations } from "next-intl";
13
+ import { getTranslatedError } from "../../utils/get-translated-error";
13
14
  export const SubjectForm = () => {
14
15
  const { state, handleChange } = useSubjectModule();
15
16
  const { code, description, enabled, errors, name } = state;
16
17
  const t = useTranslations("subject");
17
- return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors.name, id: "name", info: t("formSubjectNameInfo"), label: t("formSubjectNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formSubjectNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: errors.code, id: "code", info: t("formCodeInfo"), label: t("formSubjectCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formCodePlaceholder"), 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"), value: description !== null && description !== void 0 ? description : "" }), _jsx(EnhancedCheckbox, { label: t("formActiveSubjectLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("actionToggleEnableOrDisableSubject") })] }));
18
+ return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "name", t }), id: "name", info: t("formNameInfo"), label: t("formNameLabel"), onChange: (e) => handleChange("name", e.target.value), placeholder: t("formNamePlaceholder"), required: true, value: name }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "code", t }), id: "code", info: t("formCodeInfo"), label: t("formCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formCodePlaceholder"), 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"), value: description !== null && description !== void 0 ? description : "" }), _jsx(EnhancedCheckbox, { label: t("formEnabledLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("formEnabledInfo") })] }));
18
19
  };
@@ -121,13 +121,13 @@ export const SubjectMoreActions = () => {
121
121
  const msgs = [];
122
122
  if (method === "POST") {
123
123
  if (!((_b = row.code) === null || _b === void 0 ? void 0 : _b.trim()))
124
- msgs.push(t("validationRequiredCode"));
124
+ msgs.push(t("validationSubjectCodeRequired"));
125
125
  if (!((_c = row.name) === null || _c === void 0 ? void 0 : _c.trim()))
126
- msgs.push(t("validationRequiredName"));
126
+ msgs.push(t("validationSubjectNameRequired"));
127
127
  }
128
128
  else {
129
129
  if (!((_d = row.id) === null || _d === void 0 ? void 0 : _d.trim()))
130
- msgs.push(t("validationRequiredIdForUpdate"));
130
+ msgs.push(t("validationSubjectIdRequired"));
131
131
  }
132
132
  if (msgs.length > 0) {
133
133
  validationErrors.push({ row: i + 1, messages: msgs });
@@ -18,7 +18,8 @@
18
18
  import { FC } from "react";
19
19
  import { USER_ROLE } from "../../type";
20
20
  interface Props {
21
- cancelLabel: string;
21
+ drawerButtonCancel: string;
22
+ drawerButtonSave: string;
22
23
  drawerFilterDescription: string;
23
24
  drawerFilterTitle: string;
24
25
  drawerFormDescription: string;
@@ -27,15 +28,14 @@ interface Props {
27
28
  drawerMoreActionsTitle: string;
28
29
  drawerViewDescription: string;
29
30
  drawerViewTitle: string;
30
- labelActions: string;
31
- labelCode: string;
32
- labelDescription: string;
33
- labelEnabled: string;
34
- labelId: string;
35
- labelName: string;
36
- saveLabel: string;
37
- searchPlaceholder: string;
31
+ tableColumnHeaderActions: string;
32
+ tableColumnHeaderCode: string;
33
+ tableColumnHeaderDescription: string;
34
+ tableColumnHeaderEnabled: string;
35
+ tableColumnHeaderId: string;
36
+ tableColumnHeaderName: string;
38
37
  tableDescription: string;
38
+ tableSearchPlaceholder: string;
39
39
  tableTitle: string;
40
40
  userRole: USER_ROLE;
41
41
  }
@@ -47,19 +47,19 @@ const createComponentInstances = () => ({
47
47
  moreActions: _jsx(SubjectMoreActions, {}),
48
48
  view: _jsx(SubjectView, {}),
49
49
  });
50
- const createSubjectConfig = ({ cancelLabel, dispatch, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, labelActions, labelCode, labelDescription, labelEnabled, labelId, labelName, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
50
+ const createSubjectConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderCode, tableColumnHeaderDescription, tableColumnHeaderEnabled, tableColumnHeaderId, tableColumnHeaderName, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
51
51
  const components = createComponentInstances();
52
52
  return {
53
53
  moduleName: "subject",
54
54
  tableColumns: [
55
- { label: labelId, width: "5%" },
56
- { label: labelCode, width: "15%" },
57
- { label: labelName, width: "25%" },
58
- { label: labelDescription, width: "35%" },
59
- { label: labelEnabled, width: "15%" },
60
- { label: labelActions, width: "5%" },
55
+ { label: tableColumnHeaderId, width: "5%" },
56
+ { label: tableColumnHeaderCode, width: "15%" },
57
+ { label: tableColumnHeaderName, width: "25%" },
58
+ { label: tableColumnHeaderDescription, width: "35%" },
59
+ { label: tableColumnHeaderEnabled, width: "15%" },
60
+ { label: tableColumnHeaderActions, width: "5%" },
61
61
  ],
62
- cancelLabel,
62
+ cancelLabel: drawerButtonCancel,
63
63
  drawerFilterDescription,
64
64
  drawerFilterTitle,
65
65
  drawerFormDescription,
@@ -71,8 +71,8 @@ const createSubjectConfig = ({ cancelLabel, dispatch, drawerFilterDescription, d
71
71
  filterContent: components.filter,
72
72
  formContent: components.form,
73
73
  moreActionsContent: components.moreActions,
74
- saveLabel,
75
- searchPlaceholder,
74
+ saveLabel: drawerButtonSave,
75
+ searchPlaceholder: tableSearchPlaceholder,
76
76
  tableDescription,
77
77
  tableTitle,
78
78
  viewContent: components.view,
@@ -89,7 +89,8 @@ const SubjectPageInner = (props) => {
89
89
  const context = useSubjectModule();
90
90
  const subjectConfig = useMemo(() => createSubjectConfig({
91
91
  dispatch: context.dispatch,
92
- cancelLabel: props.cancelLabel,
92
+ drawerButtonCancel: props.drawerButtonCancel,
93
+ drawerButtonSave: props.drawerButtonSave,
93
94
  drawerFormTitle: props.drawerFormTitle,
94
95
  drawerFormDescription: props.drawerFormDescription,
95
96
  drawerViewTitle: props.drawerViewTitle,
@@ -98,19 +99,19 @@ const SubjectPageInner = (props) => {
98
99
  drawerFilterDescription: props.drawerFilterDescription,
99
100
  drawerMoreActionsTitle: props.drawerMoreActionsTitle,
100
101
  drawerMoreActionsDescription: props.drawerMoreActionsDescription,
101
- labelActions: props.labelActions,
102
- labelCode: props.labelCode,
103
- labelDescription: props.labelDescription,
104
- labelEnabled: props.labelEnabled,
105
- labelId: props.labelId,
106
- labelName: props.labelName,
107
- saveLabel: props.saveLabel,
108
- searchPlaceholder: props.searchPlaceholder,
102
+ tableColumnHeaderActions: props.tableColumnHeaderActions,
103
+ tableColumnHeaderCode: props.tableColumnHeaderCode,
104
+ tableColumnHeaderDescription: props.tableColumnHeaderDescription,
105
+ tableColumnHeaderEnabled: props.tableColumnHeaderEnabled,
106
+ tableColumnHeaderId: props.tableColumnHeaderId,
107
+ tableColumnHeaderName: props.tableColumnHeaderName,
109
108
  tableDescription: props.tableDescription,
109
+ tableSearchPlaceholder: props.tableSearchPlaceholder,
110
110
  tableTitle: props.tableTitle,
111
111
  }), [
112
112
  context.dispatch,
113
- props.cancelLabel,
113
+ props.drawerButtonCancel,
114
+ props.drawerButtonSave,
114
115
  props.drawerFormTitle,
115
116
  props.drawerFormDescription,
116
117
  props.drawerViewTitle,
@@ -119,15 +120,14 @@ const SubjectPageInner = (props) => {
119
120
  props.drawerFilterDescription,
120
121
  props.drawerMoreActionsTitle,
121
122
  props.drawerMoreActionsDescription,
122
- props.labelActions,
123
- props.labelCode,
124
- props.labelDescription,
125
- props.labelEnabled,
126
- props.labelId,
127
- props.labelName,
128
- props.saveLabel,
129
- props.searchPlaceholder,
123
+ props.tableColumnHeaderActions,
124
+ props.tableColumnHeaderCode,
125
+ props.tableColumnHeaderDescription,
126
+ props.tableColumnHeaderEnabled,
127
+ props.tableColumnHeaderId,
128
+ props.tableColumnHeaderName,
130
129
  props.tableDescription,
130
+ props.tableSearchPlaceholder,
131
131
  props.tableTitle,
132
132
  ]);
133
133
  const hasPermission = resolveRbacPermissions({
@@ -1,9 +1,20 @@
1
1
  /**
2
2
  * Subject Validation Schema
3
3
  *
4
- * Zod validation schemas for subject form data.
4
+ * Zod validation schemas for subject form data with i18n-ready error keys.
5
5
  */
6
6
  import { z } from "zod";
7
+ export declare const VALIDATION_KEYS: {
8
+ readonly name: "validationSubjectNameRequired";
9
+ readonly nameMin: "validationSubjectNameMinLength";
10
+ readonly nameMax: "validationSubjectNameMaxLength";
11
+ readonly nameInvalid: "validationSubjectNameInvalid";
12
+ readonly code: "validationSubjectCodeRequired";
13
+ readonly codeMin: "validationSubjectCodeMinLength";
14
+ readonly codeMax: "validationSubjectCodeMaxLength";
15
+ readonly codeInvalid: "validationSubjectCodeInvalid";
16
+ readonly descriptionMax: "validationSubjectDescriptionMaxLength";
17
+ };
7
18
  export declare const subjectFormValidation: z.ZodObject<{
8
19
  name: z.ZodString;
9
20
  code: z.ZodString;
@@ -1,28 +1,42 @@
1
1
  /**
2
2
  * Subject Validation Schema
3
3
  *
4
- * Zod validation schemas for subject form data.
4
+ * Zod validation schemas for subject form data with i18n-ready error keys.
5
5
  */
6
6
  import { z } from "zod";
7
7
  // ============================================================================
8
+ // VALIDATION KEYS
9
+ // ============================================================================
10
+ export const VALIDATION_KEYS = {
11
+ name: "validationSubjectNameRequired",
12
+ nameMin: "validationSubjectNameMinLength",
13
+ nameMax: "validationSubjectNameMaxLength",
14
+ nameInvalid: "validationSubjectNameInvalid",
15
+ code: "validationSubjectCodeRequired",
16
+ codeMin: "validationSubjectCodeMinLength",
17
+ codeMax: "validationSubjectCodeMaxLength",
18
+ codeInvalid: "validationSubjectCodeInvalid",
19
+ descriptionMax: "validationSubjectDescriptionMaxLength",
20
+ };
21
+ // ============================================================================
8
22
  // VALIDATION SCHEMA
9
23
  // ============================================================================
10
24
  export const subjectFormValidation = z.object({
11
25
  name: z
12
26
  .string()
13
- .min(1, "Name is required")
14
- .min(2, "Name must be at least 2 characters")
15
- .max(100, "Name must be less than 100 characters")
16
- .regex(/^[a-zA-Z\s]+$/, "Name can only contain letters and spaces"),
27
+ .min(1, VALIDATION_KEYS.name)
28
+ .min(2, VALIDATION_KEYS.nameMin)
29
+ .max(100, VALIDATION_KEYS.nameMax)
30
+ .regex(/^[a-zA-Z\s]+$/, VALIDATION_KEYS.nameInvalid),
17
31
  code: z
18
32
  .string()
19
- .min(1, "Code is required")
20
- .min(2, "Code must be at least 2 characters")
21
- .max(20, "Code must be less than 20 characters")
22
- .regex(/^[A-Z0-9_-]+$/, "Code can only contain uppercase letters, numbers, underscores, and hyphens"),
33
+ .min(1, VALIDATION_KEYS.code)
34
+ .min(2, VALIDATION_KEYS.codeMin)
35
+ .max(20, VALIDATION_KEYS.codeMax)
36
+ .regex(/^[A-Z0-9_-]+$/, VALIDATION_KEYS.codeInvalid),
23
37
  description: z
24
38
  .string()
25
- .max(500, "Description must be less than 500 characters")
39
+ .max(500, VALIDATION_KEYS.descriptionMax)
26
40
  .optional(),
27
41
  enabled: z.boolean().optional(),
28
42
  });
@@ -16,7 +16,7 @@ export const SubjectView = () => {
16
16
  const { state } = useSubjectModule();
17
17
  const { code, description, enabled, name } = state;
18
18
  const t = useTranslations("subject");
19
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookOpen, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: name }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsx("p", { className: "text-muted-foreground mt-1", children: code })] })] }) }) }), _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("viewSectionSubjectDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteSubjectInformation") })] }), _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("viewFieldSubjectName") }), _jsx("p", { className: "text-base", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubjectCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), description && (_jsxs("div", { className: "col-span-full space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: description })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
20
- ? t("viewFieldStatusActive")
21
- : t("viewFieldStatusInactive") })] })] }) })] })] }));
19
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookOpen, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: name }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsx("p", { className: "text-muted-foreground mt-1", children: code })] })] }) }) }), _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("viewSectionSubjectDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteSubjectInformation") })] }), _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("formNameLabel") }), _jsx("p", { className: "text-base", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formCodeLabel") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), description && (_jsxs("div", { className: "col-span-full space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDescriptionLabel") }), _jsx("p", { className: "text-base", children: description })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
20
+ ? t("badgeActive")
21
+ : t("badgeInactive") })] })] }) })] })] }));
22
22
  };
@@ -414,7 +414,7 @@ export const useTeacherModule = () => {
414
414
  }
415
415
  const teacherId = state.id;
416
416
  if (!teacherId) {
417
- showToast("Please save the teacher record first before uploading an avatar", TOAST_VARIANT.ERROR);
417
+ showToast(t("messagesAvatarSaveRequired"), TOAST_VARIANT.ERROR);
418
418
  uploadInProgressRef.current = false;
419
419
  return;
420
420
  }
@@ -445,12 +445,12 @@ export const useTeacherModule = () => {
445
445
  type: TEACHER_ACTION_TYPES.SET_INPUT_FIELD,
446
446
  payload: { key: "avatar", value: avatarUrl },
447
447
  });
448
- showToast("Avatar uploaded successfully", TOAST_VARIANT.SUCCESS);
448
+ showToast(t("messagesAvatarUploadSuccess"), TOAST_VARIANT.SUCCESS);
449
449
  }
450
450
  catch (error) {
451
451
  const errorMessage = error instanceof Error
452
452
  ? error.message
453
- : "Unknown error uploading avatar";
453
+ : t("messagesAvatarUploadError");
454
454
  showToast(errorMessage, TOAST_VARIANT.ERROR);
455
455
  }
456
456
  finally {
@@ -18,7 +18,7 @@ export const TeacherFilter = () => {
18
18
  : filterEnabled
19
19
  ? "true"
20
20
  : "false";
21
- return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "grid grid-cols-1 gap-4", children: _jsx(EnhancedRadio, { label: t("filterOptionEnabled"), name: "filterEnabled", value: filterEnabledValue, options: [
21
+ return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "grid grid-cols-1 gap-4", children: _jsx(EnhancedRadio, { label: t("filterEnabledLabel"), name: "filterEnabled", value: filterEnabledValue, options: [
22
22
  { label: t("filterOptionAll"), value: "undefined" },
23
23
  { label: t("filterOptionEnabled"), value: "true" },
24
24
  { label: t("filterOptionDisabled"), value: "false" },
@@ -9,6 +9,7 @@ import { useTranslations } from "next-intl";
9
9
  import { useTeacherModule } from "./context";
10
10
  import { GENDER_OPTIONS } from "./constants";
11
11
  import { TEACHER_API_ROUTES } from "../../constants";
12
+ import { getTranslatedError } from "../../utils/get-translated-error";
12
13
  export const TeacherForm = () => {
13
14
  const t = useTranslations("teacher");
14
15
  const genderLabelMap = {
@@ -17,36 +18,12 @@ export const TeacherForm = () => {
17
18
  PREFER_NOT_TO_SAY: t("formOptionPreferNotToSay"),
18
19
  };
19
20
  const context = useTeacherModule();
20
- const { address, avatar, bio, city, country, dateOfBirth, emergencyPhone, enabled, errors, experience, firstName, gender, joiningDate, lastName, phone, postalCode, qualification, specialization,
21
- // userId,
22
- } = context.state;
21
+ const { address, avatar, bio, city, country, dateOfBirth, emergencyPhone, enabled, errors, experience, firstName, gender, joiningDate, lastName, phone, postalCode, qualification, specialization, } = context.state;
23
22
  const stateValue = context.state.state;
24
23
  const { handleChange, handleAvatarUpload } = context;
25
- // const users = getCachedUsersSync();
26
- // const { enhancedComboboxElement: userIdCombo } = useEnhancedCombobox({
27
- // emptyText: t("formNoTeacherUsersEmpty"),
28
- // id: "userId",
29
- // info: t("formLinkedSystemUserLabel"),
30
- // label: t("formTeacherUserPlaceholder"),
31
- // onValueChange: (value) => handleChange("userId", value || null),
32
- // options: users.items
33
- // ?.filter(
34
- // ({ workspaces }) =>
35
- // workspaces?.filter(({ role }) => role?.userRole === USER_ROLE.TEACHER)
36
- // .length
37
- // )
38
- // .map((u) => ({
39
- // id: u.id,
40
- // name: u?.name || u?.email || u.id,
41
- // })),
42
- // placeholder: t("formSelectLinkedUserPlaceholder"),
43
- // searchEndpoint: TEACHER_API_ROUTES.UNIT,
44
- // searchPlaceholder: t("formSearchUsersPlaceholder"),
45
- // value: userId || "",
46
- // });
47
24
  const { enhancedComboboxElement: genderCombo } = useEnhancedCombobox({
48
25
  id: "gender",
49
- info: t("formTeachersGenderPlaceholder"),
26
+ info: t("formGenderInfo"),
50
27
  label: t("formGenderLabel"),
51
28
  onValueChange: (value) => handleChange("gender", value || null),
52
29
  options: GENDER_OPTIONS.map((opt) => ({
@@ -64,13 +41,13 @@ export const TeacherForm = () => {
64
41
  },
65
42
  value: gender || "",
66
43
  });
67
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formTeachersFirstNameLabel"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, value: firstName }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formTeachersLastNameLabel"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, value: lastName }), _jsx(EnhancedInput, { error: errors.joiningDate, id: "joiningDate", info: t("formDateTeacherJoinedTheSchoolLabel"), label: t("formJoiningDateLabel"), onChange: (e) => handleChange("joiningDate", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, required: true, type: "date", value: joiningDate
68
- ? new Date(joiningDate).toISOString().split("formTLabel")[0]
69
- : "" }), genderCombo, _jsx(EnhancedInput, { error: errors.dateOfBirth, id: "dateOfBirth", info: t("formTeachersDateOfBirthLabel"), 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); }, type: "date", value: dateOfBirth
70
- ? new Date(dateOfBirth).toISOString().split("formTLabel")[0]
71
- : "" }), _jsx(EnhancedInput, { error: errors.phone, id: "phone", info: t("formTeachersPhoneNumberLabel"), label: t("formPhoneLabel"), onChange: (e) => handleChange("phone", e.target.value), placeholder: t("formPhonePlaceholder"), type: "tel", value: phone || "" }), _jsx(EnhancedInput, { error: errors.emergencyPhone, id: "emergencyPhone", info: t("formEmergencyContactNumberLabel"), label: t("formEmergencyPhoneLabel"), onChange: (e) => handleChange("emergencyPhone", e.target.value), placeholder: t("formEmergencyPhonePlaceholder"), type: "tel", value: emergencyPhone || "" }), _jsx(EnhancedInput, { error: errors.qualification, id: "qualification", info: t("formTeachersEducationalQualificationLabel"), label: t("formQualificationLabel"), onChange: (e) => handleChange("qualification", e.target.value), placeholder: t("formQualificationPlaceholder"), value: qualification || "" }), _jsx(EnhancedInput, { error: errors.specialization, id: "specialization", info: t("formTeachersAreaOfSpecializationLabel"), label: t("formSpecializationLabel"), onChange: (e) => handleChange("specialization", e.target.value), placeholder: t("formSpecializationPlaceholder"), value: specialization || "" }), _jsx(EnhancedInput, { error: errors.experience, id: "experience", info: t("formYearsOfTeachingExperienceLabel"), label: t("formExperienceLabel"), onChange: (e) => handleChange("experience", parseInt(e.target.value) || null), placeholder: t("formExperiencePlaceholder"), type: "number", value: (experience === null || experience === void 0 ? void 0 : experience.toString()) || "" }), _jsx(EnhancedInput, { error: errors.address, id: "address", info: t("formStreetAddressLabel"), label: t("formAddressLabel"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("formAddressPlaceholder"), value: address || "" }), _jsx(EnhancedInput, { error: errors.city, id: "city", info: t("formCityNameLabel"), label: t("formCityLabel"), onChange: (e) => handleChange("city", e.target.value), placeholder: t("formCityPlaceholder"), value: city || "" }), _jsx(EnhancedInput, { error: errors.state, id: "state", info: t("formStateOrProvinceLabel"), label: t("formStateProvinceLabel"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("formStatePlaceholder"), value: stateValue || "" }), _jsx(EnhancedInput, { error: errors.country, id: "country", info: t("formCountryNameLabel"), label: t("formCountryLabel"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("formCountryPlaceholder"), value: country || "" }), _jsx(EnhancedInput, { error: errors.postalCode, id: "postalCode", info: t("formPostalOrZipCodeLabel"), label: t("formPostalCodeLabel"), onChange: (e) => handleChange("postalCode", e.target.value), placeholder: t("formPostalCodePlaceholder"), value: postalCode || "" }), _jsx(EnhancedDropzone, { accept: ["image/*"], error: errors.avatar, id: "avatar", info: t("formUploadTeachersPhoto"), label: t("formAvatarLabel"), maxFiles: 1, maxSize: 100 * 1024, onChange: (files) => {
44
+ return (_jsxs("div", { className: "space-y-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, 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, value: lastName }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "joiningDate", t }), id: "joiningDate", info: t("formJoiningDateInfo"), label: t("formJoiningDateLabel"), onChange: (e) => handleChange("joiningDate", e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, required: true, type: "date", value: joiningDate
45
+ ? new Date(joiningDate).toISOString().split("T")[0]
46
+ : "" }), genderCombo, _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); }, type: "date", value: dateOfBirth
47
+ ? new Date(dateOfBirth).toISOString().split("T")[0]
48
+ : "" }), _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"), type: "tel", value: phone || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "emergencyPhone", t }), id: "emergencyPhone", info: t("formEmergencyPhoneInfo"), label: t("formEmergencyPhoneLabel"), onChange: (e) => handleChange("emergencyPhone", e.target.value), placeholder: t("formEmergencyPhonePlaceholder"), type: "tel", value: emergencyPhone || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "qualification", t }), id: "qualification", info: t("formQualificationInfo"), label: t("formQualificationLabel"), onChange: (e) => handleChange("qualification", e.target.value), placeholder: t("formQualificationPlaceholder"), value: qualification || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "specialization", t }), id: "specialization", info: t("formSpecializationInfo"), label: t("formSpecializationLabel"), onChange: (e) => handleChange("specialization", e.target.value), placeholder: t("formSpecializationPlaceholder"), value: specialization || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "experience", t }), id: "experience", info: t("formExperienceInfo"), label: t("formExperienceLabel"), onChange: (e) => handleChange("experience", parseInt(e.target.value) || null), placeholder: t("formExperiencePlaceholder"), type: "number", value: (experience === null || experience === void 0 ? void 0 : experience.toString()) || "" }), _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("formStateProvinceInfo"), label: t("formStateProvinceLabel"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("formStatePlaceholder"), value: stateValue || "" }), _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: "postalCode", t }), id: "postalCode", info: t("formPostalCodeInfo"), label: t("formPostalCodeLabel"), onChange: (e) => handleChange("postalCode", e.target.value), placeholder: t("formPostalCodePlaceholder"), value: postalCode || "" }), _jsx(EnhancedDropzone, { accept: ["image/*"], error: getTranslatedError({ errors, key: "avatar", t }), id: "avatar", info: t("formAvatarInfo"), label: t("formAvatarLabel"), maxFiles: 1, maxSize: 100 * 1024, onChange: (files) => {
72
49
  if (files.length > 0) {
73
50
  handleAvatarUpload === null || handleAvatarUpload === void 0 ? void 0 : handleAvatarUpload(files[0]);
74
51
  }
75
- }, onRemoveRemote: () => handleChange("avatar", null), value: avatar ? [avatar] : [] }), _jsx(EnhancedTextarea, { error: errors.bio, id: "bio", info: t("formBriefBiographyOrDescriptionLabel"), label: t("formBioLabel"), onChange: (e) => handleChange("bio", e.target.value), placeholder: t("formBioPlaceholder"), rows: 4, value: bio || "" }), _jsx(EnhancedCheckbox, { checked: enabled, info: t("actionToggleActivateOrDeactivateTeacher"), label: t("formActiveTeacherLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
52
+ }, onRemoveRemote: () => handleChange("avatar", null), value: avatar ? [avatar] : [] }), _jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "bio", t }), id: "bio", info: t("formBioInfo"), label: t("formBioLabel"), onChange: (e) => handleChange("bio", e.target.value), placeholder: t("formBioPlaceholder"), rows: 4, value: bio || "" }), _jsx(EnhancedCheckbox, { checked: enabled, info: t("formEnabledInfo"), label: t("formEnabledLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
76
53
  };
@@ -129,12 +129,12 @@ export const TeacherMoreActions = () => {
129
129
  if (method === "POST") {
130
130
  const result = teacherFormValidation.safeParse(records[i]);
131
131
  if (!result.success) {
132
- msgs.push(...result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`));
132
+ msgs.push(...result.error.issues.map((issue) => t(issue.message)));
133
133
  }
134
134
  }
135
135
  else {
136
136
  if (!((_b = row.id) === null || _b === void 0 ? void 0 : _b.trim()))
137
- msgs.push(t("validationRequiredIdForUpdate"));
137
+ msgs.push(t("validationTeacherIdRequired"));
138
138
  }
139
139
  if (msgs.length > 0) {
140
140
  validationErrors.push({ row: i + 1, messages: msgs });
@@ -18,7 +18,8 @@
18
18
  import { FC } from "react";
19
19
  import { USER_ROLE } from "../../type";
20
20
  interface Props {
21
- cancelLabel: string;
21
+ drawerButtonCancel: string;
22
+ drawerButtonSave: string;
22
23
  drawerFilterDescription: string;
23
24
  drawerFilterTitle: string;
24
25
  drawerFormDescription: string;
@@ -27,16 +28,15 @@ interface Props {
27
28
  drawerMoreActionsTitle: string;
28
29
  drawerViewDescription: string;
29
30
  drawerViewTitle: string;
30
- labelActions: string;
31
- labelEnabled: string;
32
- labelId: string;
33
- labelName: string;
34
- labelPhone: string;
35
- labelSpecialization: string;
36
- labelTeacherCode: string;
37
- saveLabel: string;
38
- searchPlaceholder: string;
31
+ tableColumnHeaderActions: string;
32
+ tableColumnHeaderEnabled: string;
33
+ tableColumnHeaderId: string;
34
+ tableColumnHeaderName: string;
35
+ tableColumnHeaderPhone: string;
36
+ tableColumnHeaderSpecialization: string;
37
+ tableColumnHeaderTeacherCode: string;
39
38
  tableDescription: string;
39
+ tableSearchPlaceholder: string;
40
40
  tableTitle: string;
41
41
  userRole: USER_ROLE;
42
42
  }