@appcorp/fusion-storybook 0.3.34 → 0.3.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ export declare const useAdmissionModule: () => {
42
42
  errors: Record<string, string>;
43
43
  id: string;
44
44
  studentIdNumber: string;
45
- discountCode: string;
45
+ discountCodeId: string | null;
46
46
  dob: string;
47
47
  emergencyContact: string;
48
48
  firstName: string;
@@ -5,9 +5,10 @@ import { useTranslations } from "next-intl";
5
5
  import { validateForm, isCreatedOrUpdated, API_METHODS, fetchData, } from "@react-pakistan/util-functions";
6
6
  import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
7
7
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
8
+ import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
8
9
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
9
10
  import { ADMISSION_STATUS, GENDER, } from "../../../type";
10
- import { ADMISSION_API_ROUTES } from "../../../constants";
11
+ import { ADMISSION_API_ROUTES, DISCOUNT_CODE_API_ROUTES, } from "../../../constants";
11
12
  import { admissionFormValidation } from "../validate";
12
13
  import { getCachedWorkspaceSync } from "../../workspace/cache";
13
14
  import { generateAdmissionReceiptPDF, } from "../../../utils/admission-pdf";
@@ -29,6 +30,15 @@ export const useAdmissionModule = () => {
29
30
  const workspace = getCachedWorkspaceSync();
30
31
  const listFetchNowRef = useRef(null);
31
32
  const debouncedQuery = useDebounce(state.searchQuery, 800);
33
+ const { data: discountCodesData } = useFetch(DISCOUNT_CODE_API_ROUTES.UNIT, {
34
+ params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
35
+ method: API_METHODS.GET,
36
+ });
37
+ const discountCodeMap = useMemo(() => {
38
+ var _a;
39
+ const data = discountCodesData === null || discountCodesData === void 0 ? void 0 : discountCodesData.data;
40
+ return new Map((_a = data === null || data === void 0 ? void 0 : data.items.map((dc) => [dc.id, dc])) !== null && _a !== void 0 ? _a : []);
41
+ }, [discountCodesData]);
32
42
  // ============================================================================
33
43
  // 1.4.2 API PARAMETERS
34
44
  // ============================================================================
@@ -61,7 +71,7 @@ export const useAdmissionModule = () => {
61
71
  city: state.city || "",
62
72
  classForAdmission: state.classForAdmission || "",
63
73
  country: state.country || "",
64
- discountCode: state.discountCode || "",
74
+ discountCodeId: state.discountCodeId || "",
65
75
  dob: state.dob || null,
66
76
  emergencyContact: state.emergencyContact || "",
67
77
  enabled: (_a = state.enabled) !== null && _a !== void 0 ? _a : true,
@@ -95,7 +105,7 @@ export const useAdmissionModule = () => {
95
105
  state.city,
96
106
  state.classForAdmission,
97
107
  state.country,
98
- state.discountCode,
108
+ state.discountCodeId,
99
109
  state.dob,
100
110
  state.emergencyContact,
101
111
  state.enabled,
@@ -225,7 +235,7 @@ export const useAdmissionModule = () => {
225
235
  setField("gender", normalizedGender);
226
236
  setField("dob", (_g = admission.studentDetails) === null || _g === void 0 ? void 0 : _g.dob);
227
237
  setField("registrationCode", (_h = admission.studentDetails) === null || _h === void 0 ? void 0 : _h.registrationCode);
228
- setField("discountCode", (_j = admission.studentDetails) === null || _j === void 0 ? void 0 : _j.discountCode);
238
+ setField("discountCodeId", (_j = admission.studentDetails) === null || _j === void 0 ? void 0 : _j.discountCodeId);
229
239
  setField("hafiz", (_k = admission.studentDetails) === null || _k === void 0 ? void 0 : _k.hafiz);
230
240
  setField("orphan", (_l = admission.studentDetails) === null || _l === void 0 ? void 0 : _l.orphan);
231
241
  setField("fatherFirstName", (_m = admission.fatherDetails) === null || _m === void 0 ? void 0 : _m.fatherFirstName);
@@ -398,7 +408,7 @@ export const useAdmissionModule = () => {
398
408
  });
399
409
  }, [dispatch]);
400
410
  const handlePrint = useCallback(async (row) => {
401
- var _a, _b, _c, _d, _e;
411
+ var _a, _b, _c, _d, _e, _f, _g;
402
412
  if (!row)
403
413
  return;
404
414
  const logoBase64Res = await fetch(`/api/v1/auth/image-url-to-base64`, {
@@ -424,7 +434,9 @@ export const useAdmissionModule = () => {
424
434
  gender: studentDetails.gender || "",
425
435
  dob: studentDetails.dob || "",
426
436
  registrationCode: studentDetails.registrationCode || "",
427
- discountCode: studentDetails.discountCode,
437
+ discountCode: studentDetails.discountCodeId
438
+ ? ((_c = (_b = discountCodeMap.get(studentDetails.discountCodeId)) === null || _b === void 0 ? void 0 : _b.code) !== null && _c !== void 0 ? _c : studentDetails.discountCodeId)
439
+ : undefined,
428
440
  fatherFirstName: fatherDetails.fatherFirstName || "",
429
441
  fatherLastName: fatherDetails.fatherLastName || "",
430
442
  fatherIdNumber: fatherDetails.fatherIdNumber || "",
@@ -444,10 +456,10 @@ export const useAdmissionModule = () => {
444
456
  siblings: admissionDetails.siblings,
445
457
  notes: admissionDetails.notes,
446
458
  admissionNotes: admissionDetails.admissionNotes,
447
- schoolName: ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.name) || undefined,
448
- schoolAddress: ((_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.address) || undefined,
449
- schoolPhone: ((_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.phone) || undefined,
450
- schoolEmail: ((_e = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _e === void 0 ? void 0 : _e.email) || undefined,
459
+ schoolName: ((_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.name) || undefined,
460
+ schoolAddress: ((_e = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _e === void 0 ? void 0 : _e.address) || undefined,
461
+ schoolPhone: ((_f = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _f === void 0 ? void 0 : _f.phone) || undefined,
462
+ schoolEmail: ((_g = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _g === void 0 ? void 0 : _g.email) || undefined,
451
463
  submissionDate: (row === null || row === void 0 ? void 0 : row.createdAt)
452
464
  ? new Date(row === null || row === void 0 ? void 0 : row.createdAt).toLocaleDateString()
453
465
  : undefined,
@@ -456,10 +468,10 @@ export const useAdmissionModule = () => {
456
468
  };
457
469
  await generateAdmissionReceiptPDF(pdfData);
458
470
  }
459
- catch (_f) {
471
+ catch (_h) {
460
472
  showToast(t("messagesPrintFailed"), TOAST_VARIANT.ERROR);
461
473
  }
462
- }, [workspace, t, showToast]);
474
+ }, [workspace, discountCodeMap, t, showToast]);
463
475
  const handleAddStudent = useCallback(async (row) => {
464
476
  var _a;
465
477
  const tableRow = row;
@@ -586,7 +598,7 @@ export const useAdmissionModule = () => {
586
598
  },
587
599
  studentDetails: {
588
600
  studentIdNumber: normalizeIdNumber(updateParams.studentIdNumber),
589
- discountCode: updateParams.discountCode,
601
+ discountCodeId: updateParams.discountCodeId,
590
602
  dob: updateParams.dob,
591
603
  firstName: updateParams.firstName,
592
604
  gender: updateParams.gender,
@@ -28,7 +28,7 @@ export declare const ADMISSION_ACTION_TYPES: {
28
28
  errors: Record<string, string>;
29
29
  id: string;
30
30
  studentIdNumber: string;
31
- discountCode: string;
31
+ discountCodeId: string | null;
32
32
  dob: string;
33
33
  emergencyContact: string;
34
34
  firstName: string;
@@ -80,7 +80,7 @@ export declare const ADMISSION_ACTION_TYPES: {
80
80
  errors: Record<string, string>;
81
81
  id: string;
82
82
  studentIdNumber: string;
83
- discountCode: string;
83
+ discountCodeId: string | null;
84
84
  dob: string;
85
85
  emergencyContact: string;
86
86
  firstName: string;
@@ -134,7 +134,7 @@ export declare const ADMISSION_ACTION_TYPES: {
134
134
  errors: Record<string, string>;
135
135
  id: string;
136
136
  studentIdNumber: string;
137
- discountCode: string;
137
+ discountCodeId: string | null;
138
138
  dob: string;
139
139
  emergencyContact: string;
140
140
  firstName: string;
@@ -186,7 +186,7 @@ export declare const ADMISSION_ACTION_TYPES: {
186
186
  errors: Record<string, string>;
187
187
  id: string;
188
188
  studentIdNumber: string;
189
- discountCode: string;
189
+ discountCodeId: string | null;
190
190
  dob: string;
191
191
  emergencyContact: string;
192
192
  firstName: string;
@@ -238,7 +238,7 @@ export declare const ADMISSION_ACTION_TYPES: {
238
238
  errors: Record<string, string>;
239
239
  id: string;
240
240
  studentIdNumber: string;
241
- discountCode: string;
241
+ discountCodeId: string | null;
242
242
  dob: string;
243
243
  emergencyContact: string;
244
244
  firstName: string;
@@ -52,7 +52,7 @@ const admissionConfig = {
52
52
  // Form — student detail
53
53
  id: "",
54
54
  studentIdNumber: "",
55
- discountCode: "",
55
+ discountCodeId: null,
56
56
  dob: new Date().toISOString().slice(0, 10),
57
57
  emergencyContact: "Mother",
58
58
  firstName: "",
@@ -25,7 +25,7 @@ import { useTranslations } from "next-intl";
25
25
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
26
26
  export const AdmissionForm = () => {
27
27
  const { state, handleChange, dispatch } = useAdmissionModule();
28
- const { address, admissionNotes, studentIdNumber, city, classForAdmission, country, discountCode, dob, emergencyContact, errors, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, previousSchool, registrationCode, siblings, state: provinceState, } = state;
28
+ const { address, admissionNotes, studentIdNumber, city, classForAdmission, country, discountCodeId, dob, emergencyContact, errors, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, previousSchool, registrationCode, siblings, state: provinceState, } = state;
29
29
  const t = useTranslations("admission");
30
30
  const genderLabelMap = {
31
31
  MALE: t("formOptionMale"),
@@ -62,16 +62,16 @@ export const AdmissionForm = () => {
62
62
  });
63
63
  const { enhancedComboboxElement: discountCodeCombo } = useEnhancedCombobox({
64
64
  emptyText: t("formNoDiscountCodesEmpty"),
65
- id: "discountCode",
65
+ id: "discountCodeId",
66
66
  info: t("formDiscountCodeInfo"),
67
67
  label: t("formDiscountCodeLabel"),
68
- onValueChange: (value) => handleChange("discountCode", value),
68
+ onValueChange: (value) => handleChange("discountCodeId", value),
69
69
  options: ((discountCodes === null || discountCodes === void 0 ? void 0 : discountCodes.items) || [])
70
70
  .filter((code) => code.enabled)
71
71
  .map((code) => {
72
72
  var _a;
73
73
  return ({
74
- value: code.code,
74
+ value: code.id,
75
75
  label: `${code.code} - ${code.discountValue}${code.discountType === "PERCENTAGE" ? "%" : (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency}`,
76
76
  });
77
77
  }),
@@ -83,10 +83,10 @@ export const AdmissionForm = () => {
83
83
  const code = item;
84
84
  return {
85
85
  label: `${code.code} - ${code.discountValue}${code.discountType === "PERCENTAGE" ? "%" : (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency}`,
86
- value: code.code,
86
+ value: code.id,
87
87
  };
88
88
  },
89
- value: discountCode || "",
89
+ value: discountCodeId || "",
90
90
  });
91
91
  useEffect(() => {
92
92
  var _a, _b, _c, _d, _e, _f;
@@ -12,7 +12,7 @@ export declare const admissionFormValidation: z.ZodObject<{
12
12
  studentIdNumber: z.ZodPipe<z.ZodString, z.ZodTransform<string | null | undefined, string>>;
13
13
  dob: z.ZodString;
14
14
  gender: z.ZodEnum<typeof GENDER>;
15
- discountCode: z.ZodOptional<z.ZodString>;
15
+ discountCodeId: z.ZodOptional<z.ZodString>;
16
16
  hafiz: z.ZodOptional<z.ZodBoolean>;
17
17
  orphan: z.ZodOptional<z.ZodBoolean>;
18
18
  fatherFirstName: z.ZodString;
@@ -29,7 +29,7 @@ export const admissionFormValidation = z.object({
29
29
  return adjustedAge >= 2 && adjustedAge <= 25;
30
30
  }, "Student age must be between 2 and 25 years"),
31
31
  gender: z.nativeEnum(GENDER, { error: "Gender is required" }),
32
- discountCode: z.string().optional(),
32
+ discountCodeId: z.string().optional(),
33
33
  hafiz: z.boolean().optional(),
34
34
  orphan: z.boolean().optional(),
35
35
  // Father Information
@@ -9,6 +9,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  * Note: the `state` field in `moduleState` (province/state) is aliased
10
10
  * to `provinceState` to avoid a name collision with the hook's `state` object.
11
11
  */
12
+ import { useMemo } from "react";
13
+ import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
12
14
  import { useAdmissionModule } from "./context";
13
15
  import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@appcorp/shadcn/components/ui/card";
14
16
  import { Badge } from "@appcorp/shadcn/components/ui/badge";
@@ -22,12 +24,21 @@ import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
22
24
  import { getCachedWorkspaceSync } from "../workspace/cache";
23
25
  import { ADMISSION_STATUS } from "../../type";
24
26
  export const AdmissionView = () => {
25
- var _a, _b;
27
+ var _a, _b, _c;
26
28
  const { state, handleAnalyze } = useAdmissionModule();
27
- const { address, admissionNotes, aiAnalysis, analyzeLoading, analyzeError, studentIdNumber, city, classForAdmission, country, discountCode, dob, emergencyContact, enabled, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, hafiz, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, orphan, postalCode, previousSchool, registrationCode, siblings, state: provinceState, status, } = state;
29
+ const { address, admissionNotes, aiAnalysis, analyzeLoading, analyzeError, studentIdNumber, city, classForAdmission, country, discountCodeId, dob, emergencyContact, enabled, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, hafiz, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, orphan, postalCode, previousSchool, registrationCode, siblings, state: provinceState, status, } = state;
28
30
  const workspace = getCachedWorkspaceSync();
29
31
  const hasGeminiSecrets = Boolean(((_a = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _a === void 0 ? void 0 : _a.GEMINI_API_KEY) && ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _b === void 0 ? void 0 : _b.GEMINI_MODEL));
30
32
  const t = useTranslations("admission");
33
+ const { data: discountCodesData } = useFetch("/api/v1/discount-code", {
34
+ params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
35
+ method: "GET",
36
+ });
37
+ const discountCode = useMemo(() => {
38
+ var _a;
39
+ const data = discountCodesData === null || discountCodesData === void 0 ? void 0 : discountCodesData.data;
40
+ return (_a = data === null || data === void 0 ? void 0 : data.items.find((dc) => dc.id === discountCodeId)) !== null && _a !== void 0 ? _a : null;
41
+ }, [discountCodesData, discountCodeId]);
31
42
  const decisionColor = (decision) => {
32
43
  if (decision === "APPROVED")
33
44
  return "bg-green-100 text-green-800 border-green-200";
@@ -44,5 +55,7 @@ export const AdmissionView = () => {
44
55
  };
45
56
  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
57
  ? 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("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")] })] }) })] })] }));
58
+ : t("viewButtonAnalyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("viewFieldGeminiPoweredAdmissionScoring") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [analyzeLoading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: t("viewTextRunningAiAnalysis") })] })), analyzeError && !analyzeLoading && (_jsxs("div", { className: "text-destructive flex items-center gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "h-4 w-4" }), _jsx("span", { children: analyzeError })] })), !analyzeLoading && aiAnalysis && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsxs("div", { className: "bg-muted flex flex-col items-center rounded-lg px-6 py-3", children: [_jsx("span", { className: "text-primary text-3xl font-bold", children: aiAnalysis.score }), _jsx("span", { className: "text-muted-foreground text-xs tracking-wide uppercase", children: "/ 100" })] }), _jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium ${decisionColor(aiAnalysis.decision)}`, children: [decisionIcon(aiAnalysis.decision), aiAnalysis.decision.replace("_", " ")] }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [_jsxs("span", { className: "font-medium", children: [t("viewFieldConfidence"), ":", " "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("viewFieldAiReasoningAndRiskFlags") }), _jsx("ul", { className: "space-y-1.5", children: aiAnalysis.reasons.map((reason, i) => (_jsxs("li", { className: "flex items-start gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-yellow-500" }), _jsx("span", { children: reason })] }, i))) })] })), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t("viewFieldLastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("viewTextNoAiAnalysisYet") }))] })] })), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdmissionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionRegistrationAndAdmissionInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRegistrationCode") }), _jsx("p", { className: "font-mono text-base", children: formatValue(registrationCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassForAdmission") }), _jsx("p", { className: "text-base", children: formatValue(classForAdmission) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx("p", { className: "text-base", children: formatValue(status) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPreviousSchool") }), _jsx("p", { className: "text-base", children: formatValue(previousSchool) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSiblings") }), _jsx("p", { className: "text-base", children: formatValue(siblings) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionStudentInformation") })] }), _jsx(CardDescription, { children: t("viewSectionPersonalDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(firstName), " ", formatValue(lastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDateOfBirth") }), _jsx("p", { className: "text-base", children: formatDate(String(dob), DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), _jsx("p", { className: "text-base", children: formatValue(gender) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudentIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(studentIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDiscountCode") }), _jsx("p", { className: "text-base", children: discountCodeId
59
+ ? ((_c = discountCode === null || discountCode === void 0 ? void 0 : discountCode.code) !== null && _c !== void 0 ? _c : discountCodeId)
60
+ : "N/A" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmergencyContact") }), _jsx("p", { className: "text-base", children: formatValue(emergencyContact) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldHafizEQuran") }), _jsx("p", { className: "text-base", children: hafiz ? t("badgeYes") : t("badgeNo") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrphan") }), _jsx("p", { className: "text-base", children: orphan ? t("badgeYes") : t("badgeNo") })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionFatherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionFatherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(fatherFirstName), " ", formatValue(fatherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(fatherIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(fatherMobile) || formatValue(fatherMobile) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOccupation") }), _jsx("p", { className: "text-base", children: formatValue(fatherOccupation) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrganization") }), _jsx("p", { className: "text-base", children: formatValue(fatherOrganization) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionMotherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionMotherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(motherFirstName), " ", formatValue(motherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(motherIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(motherMobile) || formatValue(motherMobile) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Home, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionHomeDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAddressInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCity") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldState") }), _jsx("p", { className: "text-base", children: formatValue(provinceState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCountry") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPostalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionOfficeUse") })] }), _jsx(CardDescription, { children: t("viewSectionInternalNotesAndProcessingInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldNotes") }), _jsx("p", { className: "text-base", children: formatValue(notes) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAdmissionNotes") }), _jsx("p", { className: "text-base", children: formatValue(admissionNotes) })] })] }) })] }), _jsxs(Card, { children: [_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
61
  };
@@ -65,10 +65,10 @@ export const AttendanceForm = () => {
65
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
- var _a, _b;
68
+ var _a, _b, _c;
69
69
  return ({
70
70
  value: opt.id,
71
- label: `${(_a = opt.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = opt.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${opt.computerNumber}`,
71
+ label: `${(_a = opt.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = opt.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = opt.computerNumber) !== null && _c !== void 0 ? _c : '').split(':')[1] || opt.computerNumber || ''}`,
72
72
  });
73
73
  }),
74
74
  placeholder: t("formStudentProfilePlaceholder"),
@@ -77,9 +77,9 @@ export const AttendanceForm = () => {
77
77
  searchPlaceholder: t("formSearchStatusPlaceholder"),
78
78
  emptyText: t("formNoStatusEmpty"),
79
79
  formatSearchResult: (item) => {
80
- var _a, _b;
80
+ var _a, _b, _c;
81
81
  return ({
82
- label: `${((_a = item.familyMember) === null || _a === void 0 ? void 0 : _a.firstName) || ""} ${((_b = item.familyMember) === null || _b === void 0 ? void 0 : _b.lastName) || ""} - ${item.computerNumber || ""}`,
82
+ label: `${((_a = item.familyMember) === null || _a === void 0 ? void 0 : _a.firstName) || ""} ${((_b = item.familyMember) === null || _b === void 0 ? void 0 : _b.lastName) || ""} - ${((_c = item.computerNumber) !== null && _c !== void 0 ? _c : '').split(':')[1] || item.computerNumber || ""}`,
83
83
  value: item.id,
84
84
  });
85
85
  },
@@ -55,10 +55,10 @@ export const EnrollmentForm = () => {
55
55
  label: t("formStudentLabel"),
56
56
  onValueChange: (value) => handleChange("studentProfileId", value),
57
57
  options: ((studentProfileData === null || studentProfileData === void 0 ? void 0 : studentProfileData.items) || []).map((s) => {
58
- var _a, _b;
58
+ var _a, _b, _c;
59
59
  return ({
60
60
  value: s.id,
61
- label: `${(_a = s.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = s.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${s.computerNumber}`,
61
+ label: `${(_a = s.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = s.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = s.computerNumber) !== null && _c !== void 0 ? _c : '').split(':')[1] || s.computerNumber || ''}`,
62
62
  });
63
63
  }),
64
64
  placeholder: t("formStudentPlaceholder"),
@@ -66,10 +66,10 @@ export const EnrollmentForm = () => {
66
66
  searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
67
67
  searchPlaceholder: t("formSearchStudentsPlaceholder"),
68
68
  formatSearchResult: (item) => {
69
- var _a, _b;
69
+ var _a, _b, _c;
70
70
  const studentProfile = Object.assign({}, item);
71
71
  return {
72
- label: `${(_a = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = studentProfile.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${studentProfile.computerNumber}`,
72
+ label: `${(_a = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.familyMember) === null || _a === void 0 ? void 0 : _a.firstName} ${(_b = studentProfile.familyMember) === null || _b === void 0 ? void 0 : _b.lastName} - ${((_c = studentProfile.computerNumber) !== null && _c !== void 0 ? _c : '').split(':')[1] || studentProfile.computerNumber || ''}`,
73
73
  value: studentProfile.id,
74
74
  };
75
75
  },
@@ -16,7 +16,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { useMemo } from "react";
17
17
  import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
18
18
  import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
19
- import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
19
+ import { DATE_FORMATS, formatDate, VALUE_DELIMITER, } from "@react-pakistan/util-functions";
20
20
  import { useEnrollmentModule, EnrollmentProvider, ENROLLMENT_ACTION_TYPES, } from "./context";
21
21
  import { EnrollmentFilter } from "./filter";
22
22
  import { EnrollmentForm } from "./form";
@@ -33,9 +33,9 @@ const tableBodyCols = [
33
33
  componentType: COMPONENT_TYPE.TEXT,
34
34
  key: "studentProfile",
35
35
  textFormatter: (_, row) => {
36
- var _a, _b, _c, _d, _e;
37
- return `${(_b = (_a = row.studentProfile) === null || _a === void 0 ? void 0 : _a.familyMember) === null || _b === void 0 ? void 0 : _b.firstName} ${(_d = (_c = row.studentProfile) === null || _c === void 0 ? void 0 : _c.familyMember) === null || _d === void 0 ? void 0 : _d.lastName} - ${(_e = row.studentProfile) === null || _e === void 0 ? void 0 : _e.computerNumber}` ||
38
- "N/A";
36
+ var _a, _b, _c, _d, _e, _f;
37
+ const cn = (_b = (_a = row.studentProfile) === null || _a === void 0 ? void 0 : _a.computerNumber) !== null && _b !== void 0 ? _b : "";
38
+ return `${(_d = (_c = row.studentProfile) === null || _c === void 0 ? void 0 : _c.familyMember) === null || _d === void 0 ? void 0 : _d.firstName} ${(_f = (_e = row.studentProfile) === null || _e === void 0 ? void 0 : _e.familyMember) === null || _f === void 0 ? void 0 : _f.lastName} - ${cn.split(VALUE_DELIMITER.COLON)[1] || cn}`;
39
39
  },
40
40
  },
41
41
  {
@@ -2,7 +2,7 @@ import { FC } from "react";
2
2
  import { DISCOUNT_TYPE, PAYMENT_STATUS } from "../../type";
3
3
  interface StudentProfileSummary {
4
4
  id: string;
5
- computerNumber: number;
5
+ computerNumber: string;
6
6
  firstName: string;
7
7
  lastName: string;
8
8
  status: string;
@@ -10,7 +10,7 @@ import { formatDate, DATE_FORMATS, API_METHODS, } from "@react-pakistan/util-fun
10
10
  import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
11
11
  import { useTranslations } from "next-intl";
12
12
  export const StudentFeeView = () => {
13
- var _a, _b;
13
+ var _a, _b, _c;
14
14
  const { state } = useStudentFeeModule();
15
15
  const { amount, amountDue, amountPaid, dueDate, enabled, feeStructureId, remarks, status, studentProfileId, } = state;
16
16
  const workspace = getCachedWorkspaceSync();
@@ -26,7 +26,9 @@ export const StudentFeeView = () => {
26
26
  });
27
27
  return (_jsx("div", { className: "space-y-4", children: _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("viewSectionStudentFeeDetails") })] }), _jsx(CardDescription, { children: t("viewSectionReadOnlyStudentFeeInformation") })] }), _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("formStudentLabel") }), _jsx("p", { className: "text-base", children: studentProfile
28
28
  ? `${studentProfile.firstName} ${studentProfile.lastName}`
29
- : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldComputerNumber") }), _jsx("p", { className: "text-base", children: (studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _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("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled
29
+ : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldComputerNumber") }), _jsx("p", { className: "text-base", children: ((_c = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] ||
30
+ (studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) ||
31
+ "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _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("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled
30
32
  ? t("badgeActive")
31
33
  : t("badgeInactive")] })] })] }) })] }) }));
32
34
  };
@@ -43,11 +43,13 @@ export const tableBodyCols = [
43
43
  {
44
44
  componentType: COMPONENT_TYPE.TEXT,
45
45
  key: "computerNumber",
46
- },
47
- {
48
- componentType: COMPONENT_TYPE.TEXT,
49
- key: "discountCode",
50
- textFormatter: (value) => value || "N/A",
46
+ textFormatter: (value) => {
47
+ const raw = value;
48
+ if (!raw)
49
+ return "N/A";
50
+ const parts = raw.split(":");
51
+ return parts[1] || raw;
52
+ },
51
53
  },
52
54
  {
53
55
  componentType: COMPONENT_TYPE.TEXT,
@@ -27,6 +27,7 @@ import { StudentProfileMoreActions } from "./more-actions";
27
27
  import { StudentProfileView } from "./view";
28
28
  import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
29
29
  import { RbacNoAccess } from "../../components/rbac-no-access";
30
+ import { VALUE_DELIMITER } from "@react-pakistan/util-functions";
30
31
  // ============================================================================
31
32
  // TABLE COLUMN CONFIGURATION (static — no runtime deps)
32
33
  // ============================================================================
@@ -44,8 +45,12 @@ const tableBodyCols = [
44
45
  {
45
46
  componentType: COMPONENT_TYPE.TEXT,
46
47
  key: "computerNumber",
48
+ textFormatter: (val) => String(val).split(VALUE_DELIMITER.COLON)[1],
49
+ },
50
+ {
51
+ componentType: COMPONENT_TYPE.TEXT,
52
+ key: "studentCode",
47
53
  },
48
- { componentType: COMPONENT_TYPE.TEXT, key: "studentCode" },
49
54
  {
50
55
  componentType: COMPONENT_TYPE.TEXT,
51
56
  key: "enrollments",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",