@appcorp/fusion-storybook 0.1.75 → 0.1.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A component library built with a modern tech stack for maximum reusability across multiple projects.
4
4
 
5
+ Phone fields are treated as canonical digits-only values in data state and are formatted only for presentation in read-only views and inputs.
6
+
5
7
  ## Tech Stack
6
8
 
7
9
  - **[Next.js 16](https://nextjs.org/)** - React framework with App Router
@@ -23,7 +23,6 @@ import { useTheme } from "next-themes";
23
23
  import { useTranslations } from "next-intl";
24
24
  import { validateForm, isCreatedOrUpdated, API_METHODS, fetchData, } from "@react-pakistan/util-functions";
25
25
  import { formatCnic } from "@react-pakistan/util-functions/general/cnic-formatter";
26
- import { formatPhone } from "@react-pakistan/util-functions/general/format-phone";
27
26
  import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
28
27
  import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
29
28
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
@@ -35,6 +34,7 @@ import { admissionFormValidation } from "./validate";
35
34
  import { getCachedAdmissions, invalidateAdmissionsCache } from "./cache";
36
35
  import { getCachedWorkspaceSync } from "../workspace/cache";
37
36
  import { generateAdmissionReceiptPDF, } from "../../utils/admission-pdf";
37
+ import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
38
38
  import { invalidateFamiliesCache } from "../family/cache";
39
39
  import { invalidateFamilyMembersCache } from "../family-member/cache";
40
40
  import { invalidateStudentProfilesCache } from "../student-profile/cache";
@@ -180,7 +180,7 @@ export const useAdmissionModule = () => {
180
180
  fatherCnic: state.fatherCnic || "",
181
181
  fatherFirstName: state.fatherFirstName || "",
182
182
  fatherLastName: state.fatherLastName || "",
183
- fatherMobile: state.fatherMobile || "",
183
+ fatherMobile: normalizePhone(state.fatherMobile),
184
184
  fatherOccupation: state.fatherOccupation || "",
185
185
  fatherOrganization: state.fatherOrganization || "",
186
186
  firstName: state.firstName || "",
@@ -191,7 +191,7 @@ export const useAdmissionModule = () => {
191
191
  motherCnic: state.motherCnic || "",
192
192
  motherFirstName: state.motherFirstName || "",
193
193
  motherLastName: state.motherLastName || "",
194
- motherMobile: state.motherMobile || "",
194
+ motherMobile: normalizePhone(state.motherMobile),
195
195
  notes: state.notes || "",
196
196
  orphan: (_c = state.orphan) !== null && _c !== void 0 ? _c : false,
197
197
  postalCode: state.postalCode || "",
@@ -250,7 +250,7 @@ export const useAdmissionModule = () => {
250
250
  });
251
251
  }, [theme]);
252
252
  const setField = useCallback((key, value) => {
253
- var _a, _b, _c;
253
+ var _a, _b;
254
254
  let formatted = value === null
255
255
  ? undefined
256
256
  : value;
@@ -260,9 +260,8 @@ export const useAdmissionModule = () => {
260
260
  formatted = (_a = formatCnic(value)) !== null && _a !== void 0 ? _a : value;
261
261
  }
262
262
  if ((key === "fatherMobile" || key === "motherMobile") &&
263
- typeof value === "string" &&
264
- value.length >= 13) {
265
- formatted = (_c = (_b = formatPhone(value, "PK")) === null || _b === void 0 ? void 0 : _b.international) !== null && _c !== void 0 ? _c : value;
263
+ typeof value === "string") {
264
+ formatted = (_b = formatPhoneDisplay(value)) !== null && _b !== void 0 ? _b : value;
266
265
  }
267
266
  dispatch({
268
267
  type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
@@ -313,7 +312,7 @@ export const useAdmissionModule = () => {
313
312
  }
314
313
  }, [resetFormAndCloseDrawer, showToast, t]);
315
314
  const byIdCallback = useCallback(({ data, error }) => {
316
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
315
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
317
316
  if (error) {
318
317
  showToast(t("messagesDetailsFetchFailed"), TOAST_VARIANT.ERROR);
319
318
  return;
@@ -348,28 +347,28 @@ export const useAdmissionModule = () => {
348
347
  setField("fatherFirstName", (_m = admission.fatherDetails) === null || _m === void 0 ? void 0 : _m.fatherFirstName);
349
348
  setField("fatherLastName", (_o = admission.fatherDetails) === null || _o === void 0 ? void 0 : _o.fatherLastName);
350
349
  setField("fatherCnic", (_p = admission.fatherDetails) === null || _p === void 0 ? void 0 : _p.fatherCnic);
351
- setField("fatherMobile", (_q = admission.fatherDetails) === null || _q === void 0 ? void 0 : _q.fatherMobile);
352
- setField("fatherOccupation", (_r = admission.fatherDetails) === null || _r === void 0 ? void 0 : _r.fatherOccupation);
353
- setField("fatherOrganization", (_s = admission.fatherDetails) === null || _s === void 0 ? void 0 : _s.fatherOrganization);
354
- setField("motherFirstName", (_t = admission.motherDetails) === null || _t === void 0 ? void 0 : _t.motherFirstName);
355
- setField("motherLastName", (_u = admission.motherDetails) === null || _u === void 0 ? void 0 : _u.motherLastName);
356
- setField("motherCnic", (_v = admission.motherDetails) === null || _v === void 0 ? void 0 : _v.motherCnic);
357
- setField("motherMobile", (_w = admission.motherDetails) === null || _w === void 0 ? void 0 : _w.motherMobile);
358
- setField("address", (_x = admission.homeDetails) === null || _x === void 0 ? void 0 : _x.address);
359
- setField("city", (_y = admission.homeDetails) === null || _y === void 0 ? void 0 : _y.city);
360
- setField("country", (_z = admission.homeDetails) === null || _z === void 0 ? void 0 : _z.country);
361
- setField("postalCode", (_0 = admission.homeDetails) === null || _0 === void 0 ? void 0 : _0.postalCode);
362
- setField("state", (_1 = admission.homeDetails) === null || _1 === void 0 ? void 0 : _1.state);
363
- setField("notes", (_2 = admission.officeUse) === null || _2 === void 0 ? void 0 : _2.notes);
364
- setField("admissionNotes", (_3 = admission.officeUse) === null || _3 === void 0 ? void 0 : _3.admissionNotes);
365
- setField("previousSchool", (_4 = admission.admissionDetails) === null || _4 === void 0 ? void 0 : _4.previousSchool);
366
- setField("siblings", (_5 = admission.admissionDetails) === null || _5 === void 0 ? void 0 : _5.siblings);
367
- setField("classForAdmission", (_6 = admission.admissionDetails) === null || _6 === void 0 ? void 0 : _6.classForAdmission);
350
+ setField("fatherMobile", (_r = formatPhoneDisplay((_q = admission.fatherDetails) === null || _q === void 0 ? void 0 : _q.fatherMobile)) !== null && _r !== void 0 ? _r : (_s = admission.fatherDetails) === null || _s === void 0 ? void 0 : _s.fatherMobile);
351
+ setField("fatherOccupation", (_t = admission.fatherDetails) === null || _t === void 0 ? void 0 : _t.fatherOccupation);
352
+ setField("fatherOrganization", (_u = admission.fatherDetails) === null || _u === void 0 ? void 0 : _u.fatherOrganization);
353
+ setField("motherFirstName", (_v = admission.motherDetails) === null || _v === void 0 ? void 0 : _v.motherFirstName);
354
+ setField("motherLastName", (_w = admission.motherDetails) === null || _w === void 0 ? void 0 : _w.motherLastName);
355
+ setField("motherCnic", (_x = admission.motherDetails) === null || _x === void 0 ? void 0 : _x.motherCnic);
356
+ setField("motherMobile", (_z = formatPhoneDisplay((_y = admission.motherDetails) === null || _y === void 0 ? void 0 : _y.motherMobile)) !== null && _z !== void 0 ? _z : (_0 = admission.motherDetails) === null || _0 === void 0 ? void 0 : _0.motherMobile);
357
+ setField("address", (_1 = admission.homeDetails) === null || _1 === void 0 ? void 0 : _1.address);
358
+ setField("city", (_2 = admission.homeDetails) === null || _2 === void 0 ? void 0 : _2.city);
359
+ setField("country", (_3 = admission.homeDetails) === null || _3 === void 0 ? void 0 : _3.country);
360
+ setField("postalCode", (_4 = admission.homeDetails) === null || _4 === void 0 ? void 0 : _4.postalCode);
361
+ setField("state", (_5 = admission.homeDetails) === null || _5 === void 0 ? void 0 : _5.state);
362
+ setField("notes", (_6 = admission.officeUse) === null || _6 === void 0 ? void 0 : _6.notes);
363
+ setField("admissionNotes", (_7 = admission.officeUse) === null || _7 === void 0 ? void 0 : _7.admissionNotes);
364
+ setField("previousSchool", (_8 = admission.admissionDetails) === null || _8 === void 0 ? void 0 : _8.previousSchool);
365
+ setField("siblings", (_9 = admission.admissionDetails) === null || _9 === void 0 ? void 0 : _9.siblings);
366
+ setField("classForAdmission", (_10 = admission.admissionDetails) === null || _10 === void 0 ? void 0 : _10.classForAdmission);
368
367
  setField("status", admission.status || ADMISSION_STATUS.PENDING);
369
- setField("enabled", (_7 = admission.enabled) !== null && _7 !== void 0 ? _7 : true);
368
+ setField("enabled", (_11 = admission.enabled) !== null && _11 !== void 0 ? _11 : true);
370
369
  // Populate AI analysis if present
371
- const aiAnalysis = (_8 = admission
372
- .aiAnalysis) !== null && _8 !== void 0 ? _8 : null;
370
+ const aiAnalysis = (_12 = admission
371
+ .aiAnalysis) !== null && _12 !== void 0 ? _12 : null;
373
372
  dispatch({
374
373
  type: ADMISSION_ACTION_TYPES.SET_FORM_DATA,
375
374
  payload: { form: { aiAnalysis } },
@@ -17,6 +17,7 @@ import { AlertTriangle, BookOpen, Brain, Calendar, CheckCircle2, FileText, Home,
17
17
  import { Button } from "@appcorp/shadcn/components/ui/button";
18
18
  import { useTranslations } from "next-intl";
19
19
  import { formatValue } from "../../utils/format-value";
20
+ import { formatPhoneDisplay } from "../../utils/phone-helpers";
20
21
  import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
21
22
  import { getCachedWorkspaceSync } from "../workspace/cache";
22
23
  import { ADMISSION_STATUS } from "../../type";
@@ -41,5 +42,5 @@ export const AdmissionView = () => {
41
42
  return _jsx(ShieldX, { className: "h-4 w-4" });
42
43
  return _jsx(AlertTriangle, { className: "h-4 w-4" });
43
44
  };
44
- 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("aiAnalysis") })] }), 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 ? t("reRunAnalysis") : t("analyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("geminiPoweredAdmissionScoring") })] }), _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("runningAiAnalysis") })] })), 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("confidence"), ": "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("aiReasoningAndRiskFlags") }), _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("lastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("noAiAnalysisYet") }))] })] })), _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("admissionDetails") })] }), _jsx(CardDescription, { children: t("registrationAndAdmissionInformation") })] }), _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("registrationCode") }), _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("classForAdmission") }), _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("status") }), _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("previousSchool") }), _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("siblings") }), _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("studentInformation") })] }), _jsx(CardDescription, { children: t("personalDetails") })] }), _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("fullName") }), _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("dob") }), _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("gender") }), _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("bForm") }), _jsx("p", { className: "text-base", children: formatValue(bForm) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("discountCode") }), _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("emergencyContact") }), _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("hafizEQuran") }), _jsx("p", { className: "text-base", children: hafiz ? t("yes") : t("no") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("orphan") }), _jsx("p", { className: "text-base", children: orphan ? t("yes") : t("no") })] })] }) })] }), _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("fatherInformation") })] }), _jsx(CardDescription, { children: t("fatherDetails") })] }), _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("fullName") }), _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("cnic") }), _jsx("p", { className: "text-base", children: formatValue(fatherCnic) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("mobile") }), _jsx("p", { className: "text-base", children: formatValue(fatherMobile) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("occupation") }), _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("organization") }), _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("motherInformation") })] }), _jsx(CardDescription, { children: t("motherDetails") })] }), _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("fullName") }), _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("cnic") }), _jsx("p", { className: "text-base", children: formatValue(motherCnic) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("mobile") }), _jsx("p", { className: "text-base", children: 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("homeDetails") })] }), _jsx(CardDescription, { children: t("addressInformation") })] }), _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("address") }), _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("city") }), _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("state") }), _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("country") }), _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("postalCode") }), _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("officeUse") })] }), _jsx(CardDescription, { children: t("internalNotesAndProcessingInformation") })] }), _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("notes") }), _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("admissionNotes") }), _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("recordStatus") })] }), _jsx(CardDescription, { children: t("recordStateAndMetadata") })] }), _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("enabled") }), _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("active") : t("inactive")] })] }) })] })] }));
45
+ return (_jsxs("div", { className: "space-y-6", children: [hasGeminiSecrets && (_jsxs(Card, { className: "border-primary/20 border-2", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Brain, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("aiAnalysis") })] }), 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 ? t("reRunAnalysis") : t("analyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("geminiPoweredAdmissionScoring") })] }), _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("runningAiAnalysis") })] })), 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("confidence"), ": "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("aiReasoningAndRiskFlags") }), _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("lastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("noAiAnalysisYet") }))] })] })), _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("admissionDetails") })] }), _jsx(CardDescription, { children: t("registrationAndAdmissionInformation") })] }), _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("registrationCode") }), _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("classForAdmission") }), _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("status") }), _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("previousSchool") }), _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("siblings") }), _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("studentInformation") })] }), _jsx(CardDescription, { children: t("personalDetails") })] }), _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("fullName") }), _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("dob") }), _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("gender") }), _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("bForm") }), _jsx("p", { className: "text-base", children: formatValue(bForm) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("discountCode") }), _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("emergencyContact") }), _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("hafizEQuran") }), _jsx("p", { className: "text-base", children: hafiz ? t("yes") : t("no") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("orphan") }), _jsx("p", { className: "text-base", children: orphan ? t("yes") : t("no") })] })] }) })] }), _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("fatherInformation") })] }), _jsx(CardDescription, { children: t("fatherDetails") })] }), _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("fullName") }), _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("cnic") }), _jsx("p", { className: "text-base", children: formatValue(fatherCnic) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("mobile") }), _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("occupation") }), _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("organization") }), _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("motherInformation") })] }), _jsx(CardDescription, { children: t("motherDetails") })] }), _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("fullName") }), _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("cnic") }), _jsx("p", { className: "text-base", children: formatValue(motherCnic) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("mobile") }), _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("homeDetails") })] }), _jsx(CardDescription, { children: t("addressInformation") })] }), _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("address") }), _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("city") }), _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("state") }), _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("country") }), _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("postalCode") }), _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("officeUse") })] }), _jsx(CardDescription, { children: t("internalNotesAndProcessingInformation") })] }), _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("notes") }), _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("admissionNotes") }), _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("recordStatus") })] }), _jsx(CardDescription, { children: t("recordStateAndMetadata") })] }), _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("enabled") }), _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("active") : t("inactive")] })] }) })] })] }));
45
46
  };
@@ -21,6 +21,7 @@ import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
21
21
  import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
22
22
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
23
23
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
24
+ import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
24
25
  import { CAMPUS_API_ROUTES, pageLimit } from "./constants";
25
26
  import { campusFormValidation } from "./validate";
26
27
  import { getCachedCampuses, invalidateCampusesCache } from "./cache";
@@ -106,7 +107,7 @@ export const useCampusModule = () => {
106
107
  enabled: state.enabled,
107
108
  id: state.id,
108
109
  name: state.name,
109
- phone: state.phone,
110
+ phone: normalizePhone(state.phone),
110
111
  schoolId: state.schoolId || schoolId,
111
112
  state: state.state,
112
113
  }), [state, schoolId]);
@@ -173,9 +174,12 @@ export const useCampusModule = () => {
173
174
  return;
174
175
  }
175
176
  if (data) {
177
+ const campus = data;
176
178
  dispatch({
177
179
  type: CAMPUS_ACTION_TYPES.SET_FORM_DATA,
178
- payload: { form: Object.assign(Object.assign({}, data), { filterEnabled: undefined }) },
180
+ payload: {
181
+ form: Object.assign(Object.assign({}, campus), { phone: formatPhoneDisplay(campus.phone) || "", filterEnabled: undefined }),
182
+ },
179
183
  });
180
184
  }
181
185
  }, [dispatch, showToast, t]);
@@ -12,9 +12,10 @@ import { Building2, CheckCircle2, XCircle } from "lucide-react";
12
12
  import { useCampusModule } from "./context";
13
13
  import { useTranslations } from "next-intl";
14
14
  import { formatValue } from "../../utils/format-value";
15
+ import { formatPhoneDisplay } from "../../utils/phone-helpers";
15
16
  export const CampusView = () => {
16
17
  const { state } = useCampusModule();
17
18
  const { address, city, code, country, enabled, name, phone, state: campusState, } = state;
18
19
  const t = useTranslations("campus");
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(Building2, { 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" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("code"), ": ", code] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building2, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("campusDetails") })] }), _jsx(CardDescription, { children: t("completeCampusInformation") })] }), _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("campusName") }), _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("campusCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("address") }), _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("city") }), _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("state") }), _jsx("p", { className: "text-base", children: formatValue(campusState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("country") }), _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("phone") }), _jsx("p", { className: "text-base", children: formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("status") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("statusActive") : t("statusInactive") })] })] }) })] })] }));
20
+ 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(Building2, { 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" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("code"), ": ", code] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building2, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("campusDetails") })] }), _jsx(CardDescription, { children: t("completeCampusInformation") })] }), _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("campusName") }), _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("campusCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("address") }), _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("city") }), _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("state") }), _jsx("p", { className: "text-base", children: formatValue(campusState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("country") }), _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("phone") }), _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("status") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("statusActive") : t("statusInactive") })] })] }) })] })] }));
20
21
  };
@@ -417,23 +417,37 @@ export const useClassModule = () => {
417
417
  // ============================================================================
418
418
  // 1.4.9 EFFECTS
419
419
  // ============================================================================
420
- // Initial load + re-fetch on page/search/filter change via cache
420
+ // Initial load via cache; re-fetch directly from API on page/pageLimit/filter/search changes
421
421
  useEffect(() => {
422
422
  if (!schoolId)
423
423
  return;
424
- (async () => {
425
- try {
426
- const { count, items } = await getCachedClasses({ params: listParams });
427
- dispatch({
428
- type: CLASS_ACTION_TYPES.SET_ITEMS,
429
- payload: { items: items || [], count: count || 0 },
430
- });
431
- }
432
- catch (_a) {
433
- showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
434
- }
435
- })();
436
- }, [dispatch, listParams, schoolId, showToast, t]);
424
+ const currentPage = Number(listParams.currentPage) || 1;
425
+ const currentPageLimit = Number(listParams.pageLimit) || pageLimit;
426
+ const isDefaultLoad = currentPage === 1 &&
427
+ currentPageLimit === pageLimit &&
428
+ !listParams.searchQuery &&
429
+ listParams.filterEnabled === undefined;
430
+ if (isDefaultLoad) {
431
+ (async () => {
432
+ try {
433
+ const { count, items } = await getCachedClasses({
434
+ params: listParams,
435
+ });
436
+ dispatch({
437
+ type: CLASS_ACTION_TYPES.SET_ITEMS,
438
+ payload: { items: items || [], count: count || 0 },
439
+ });
440
+ }
441
+ catch (_a) {
442
+ showToast(t("messagesFetchFailed"), TOAST_VARIANT.ERROR);
443
+ }
444
+ })();
445
+ }
446
+ else {
447
+ // Bypass cache for pagination, pageLimit, filter and search changes
448
+ listFetchNow();
449
+ }
450
+ }, [dispatch, listFetchNow, listParams, schoolId, showToast, t]);
437
451
  // Sync ref to always point at latest listFetchNow (avoids stale closure in callbacks)
438
452
  useEffect(() => {
439
453
  listFetchNowRef.current = listFetchNow;
@@ -29,6 +29,7 @@ import { FAMILY_MEMBER_API_ROUTES, pageLimit } from "./constants";
29
29
  import { getCachedFamilyMembers, invalidateFamilyMembersCache } from "./cache";
30
30
  import { familyMemberFormValidation } from "./validate";
31
31
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
32
+ import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
32
33
  import { useTranslations } from "next-intl";
33
34
  import { getCachedWorkspaceSync } from "../workspace/cache";
34
35
  import { Eye, Filter, MoreHorizontal, Pencil, Plus } from "lucide-react";
@@ -112,8 +113,8 @@ export const useFamilyMemberModule = () => {
112
113
  : {})), (state.familyId ? { familyId: state.familyId } : {})));
113
114
  }, [
114
115
  state.currentPage,
115
- state.familyId,
116
116
  state.filterEnabled,
117
+ state.familyId,
117
118
  state.pageLimit,
118
119
  debouncedQuery,
119
120
  (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
@@ -127,11 +128,11 @@ export const useFamilyMemberModule = () => {
127
128
  dateOfBirth: state.dateOfBirth,
128
129
  gender: state.gender,
129
130
  bloodGroup: state.bloodGroup,
130
- phone: state.phone,
131
+ phone: normalizePhone(state.phone),
131
132
  email: state.email,
132
133
  relationship: state.relationship,
133
134
  occupation: state.occupation,
134
- emergencyPhone: state.emergencyPhone,
135
+ emergencyPhone: normalizePhone(state.emergencyPhone),
135
136
  idNumber: state.idNumber,
136
137
  avatar: state.avatar,
137
138
  isPrimary: state.isPrimary,
@@ -246,7 +247,7 @@ export const useFamilyMemberModule = () => {
246
247
  email: familyMember.email,
247
248
  relationship: familyMember.relationship,
248
249
  occupation: familyMember.occupation,
249
- emergencyPhone: familyMember.emergencyPhone,
250
+ emergencyPhone: formatPhoneDisplay(familyMember.emergencyPhone) || "",
250
251
  idNumber: familyMember.idNumber,
251
252
  avatar: familyMember.avatar,
252
253
  isPrimary: familyMember.isPrimary,
@@ -14,6 +14,7 @@ import { Briefcase, Calendar, CheckCircle2, Heart, Mail, Phone, ShieldCheck, Use
14
14
  import { useFamilyMemberModule } from "./context";
15
15
  import { useTranslations } from "next-intl";
16
16
  import { formatValue } from "../../utils/format-value";
17
+ import { formatPhoneDisplay } from "../../utils/phone-helpers";
17
18
  export const FamilyMemberView = () => {
18
19
  const { state } = useFamilyMemberModule();
19
20
  const { avatar, bloodGroup, dateOfBirth, email, emergencyPhone, enabled, firstName, gender, idNumber, isPrimary, lastName, occupation, phone, relationship, role, } = state;
@@ -32,7 +33,8 @@ export const FamilyMemberView = () => {
32
33
  return "—";
33
34
  return formatDate(new Date(value).toISOString(), DATE_FORMATS.LOCALE_DATE);
34
35
  };
35
- 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 || "FM" })] }), _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 ? (_jsxs(Badge, { variant: "default", className: "gap-1", children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), t("active")] })) : (_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(XCircle, { className: "h-3 w-3" }), t("inactive")] })), isPrimary && (_jsxs(Badge, { variant: "outline", className: "gap-1", children: [_jsx(ShieldCheck, { className: "h-3 w-3" }), t("primaryContact")] }))] }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: t("familyMemberProfile") }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [role ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(role) })) : null, relationship ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(relationship) })) : null, gender ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(gender) })) : null] })] })] }) }) }), _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("personalInformation") })] }), _jsx(CardDescription, { children: t("basicIdentityAndProfileDetails") })] }), _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("firstName") }), _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("lastName") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("role") }), role ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(role) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _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("dateOfBirth") })] }), _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("gender") }), gender ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(gender) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Heart, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("bloodGroup") })] }), _jsx("p", { className: "text-base", children: formatValue(bloodGroup) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("idNumber") }), _jsx("p", { className: "text-base", children: formatValue(idNumber) })] })] }) })] }), _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("contactInformation") })] }), _jsx(CardDescription, { children: t("reachabilityAndEmergencyContactDetails") })] }), _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: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("phone") })] }), _jsx("p", { className: "text-base", children: formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("email") })] }), _jsx("p", { className: "text-base", children: formatValue(email) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("emergencyPhone") })] }), _jsx("p", { className: "text-base", children: formatValue(emergencyPhone) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("familyRole") })] }), _jsx(CardDescription, { children: t("relationshipAndHouseholdResponsibilities") })] }), _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("relationship") }), relationship ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(relationship) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Briefcase, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("occupation") })] }), _jsx("p", { className: "text-base", children: formatValue(occupation) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShieldCheck, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("status") })] }), _jsx(CardDescription, { children: t("primaryContactAndAccountActivity") })] }), _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: "flex items-start gap-3", children: [_jsx(ShieldCheck, { className: "text-primary mt-0.5 h-5 w-5" }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: isPrimary ? t("primaryContact") : t("secondaryContact") }), _jsx("p", { className: "text-muted-foreground text-sm", children: isPrimary
36
+ 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 || "FM" })] }), _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 ? (_jsxs(Badge, { variant: "default", className: "gap-1", children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), t("active")] })) : (_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(XCircle, { className: "h-3 w-3" }), t("inactive")] })), isPrimary && (_jsxs(Badge, { variant: "outline", className: "gap-1", children: [_jsx(ShieldCheck, { className: "h-3 w-3" }), t("primaryContact")] }))] }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: t("familyMemberProfile") }), _jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [role ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(role) })) : null, relationship ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(relationship) })) : null, gender ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(gender) })) : null] })] })] }) }) }), _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("personalInformation") })] }), _jsx(CardDescription, { children: t("basicIdentityAndProfileDetails") })] }), _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("firstName") }), _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("lastName") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("role") }), role ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(role) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _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("dateOfBirth") })] }), _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("gender") }), gender ? (_jsx(Badge, { variant: "outline", className: "capitalize", children: formatEnumValue(gender) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Heart, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("bloodGroup") })] }), _jsx("p", { className: "text-base", children: formatValue(bloodGroup) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("idNumber") }), _jsx("p", { className: "text-base", children: formatValue(idNumber) })] })] }) })] }), _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("contactInformation") })] }), _jsx(CardDescription, { children: t("reachabilityAndEmergencyContactDetails") })] }), _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: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("phone") })] }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(phone) || formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("email") })] }), _jsx("p", { className: "text-base", children: formatValue(email) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("emergencyPhone") })] }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(emergencyPhone) ||
37
+ formatValue(emergencyPhone) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Users, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("familyRole") })] }), _jsx(CardDescription, { children: t("relationshipAndHouseholdResponsibilities") })] }), _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("relationship") }), relationship ? (_jsx(Badge, { variant: "secondary", className: "capitalize", children: formatEnumValue(relationship) })) : (_jsx("p", { className: "text-base", children: "\u2014" }))] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Briefcase, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("occupation") })] }), _jsx("p", { className: "text-base", children: formatValue(occupation) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(ShieldCheck, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("status") })] }), _jsx(CardDescription, { children: t("primaryContactAndAccountActivity") })] }), _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: "flex items-start gap-3", children: [_jsx(ShieldCheck, { className: "text-primary mt-0.5 h-5 w-5" }), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: isPrimary ? t("primaryContact") : t("secondaryContact") }), _jsx("p", { className: "text-muted-foreground text-sm", children: isPrimary
36
38
  ? t("thisIsPrimaryFamilyContact")
37
39
  : t("thisIsAdditionalFamilyContact") })] })] }), _jsxs("div", { className: "flex items-start gap-3", children: [enabled ? (_jsx(CheckCircle2, { className: "mt-0.5 h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "mt-0.5 h-5 w-5 text-red-500" })), _jsxs("div", { children: [_jsx("p", { className: "font-medium", children: enabled ? t("active") : t("inactive") }), _jsx("p", { className: "text-muted-foreground text-sm", children: enabled
38
40
  ? t("thisAccountIsCurrentlyActive")
@@ -29,6 +29,7 @@ import { SCHOOL_API_ROUTES } from "./constants";
29
29
  import { invalidateSchoolCache } from "./cache";
30
30
  import { schoolFormValidation } from "./validate";
31
31
  import { getCachedWorkspaceSync } from "../workspace/cache";
32
+ import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
32
33
  // ============================================================================
33
34
  // 1.1 DRAWER TYPES
34
35
  // ============================================================================
@@ -100,7 +101,7 @@ export const useSchoolModule = () => {
100
101
  id: state.id,
101
102
  logo: state.logo,
102
103
  name: state.name,
103
- phone: state.phone,
104
+ phone: normalizePhone(state.phone),
104
105
  postalCode: state.postalCode,
105
106
  principalId: state.principalId,
106
107
  state: state.state,
@@ -265,10 +266,12 @@ export const useSchoolModule = () => {
265
266
  // ============================================================================
266
267
  // Load school data from workspace cache on mount
267
268
  useEffect(() => {
268
- if (workspace) {
269
+ if (workspace === null || workspace === void 0 ? void 0 : workspace.school) {
269
270
  dispatch({
270
271
  type: SCHOOL_ACTION_TYPES.SET_FORM_DATA,
271
- payload: { form: workspace.school },
272
+ payload: {
273
+ form: Object.assign(Object.assign({}, workspace.school), { phone: formatPhoneDisplay(workspace.school.phone) || "" }),
274
+ },
272
275
  });
273
276
  }
274
277
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
@@ -12,13 +12,14 @@ import { Badge } from "@appcorp/shadcn/components/ui/badge";
12
12
  import { Separator } from "@appcorp/shadcn/components/ui/separator";
13
13
  import { Building2, MapPin, Phone, Mail, Globe, Image, CheckCircle2, XCircle, User, DollarSign, } from "lucide-react";
14
14
  import { formatValue } from "../../utils/format-value";
15
+ import { formatPhoneDisplay } from "../../utils/phone-helpers";
15
16
  export const SchoolView = () => {
16
17
  const { state } = useSchoolModule();
17
18
  const { name, code, currency, address, city, state: _state, country, postalCode, enabled, phone, email, website, logo, principalId, } = state;
18
19
  const t = useTranslations("school");
19
20
  return (_jsxs("div", { className: "space-y-6", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building2, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("basicInfoTitle") })] }), _jsx(CardDescription, { children: t("basicInfoDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-2 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building2, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsName") })] }), _jsx("p", { className: "text-base", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building2, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsCode") })] }), _jsx("p", { className: "font-mono text-sm", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsCurrency") })] }), _jsx("p", { className: "text-base", children: formatValue(currency) })] }), _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("viewLabelsAddress") })] }), _jsx("p", { className: "text-base", children: formatValue(address) === "—"
20
21
  ? t("noAddressProvided")
21
- : address })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsCity") }), _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("viewLabelsState") }), _jsx("p", { className: "text-base", children: formatValue(_state) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsCountry") }), _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("viewLabelsPostalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsStatus") }), _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("viewStatusEnabled") : t("viewStatusDisabled")] })] })] }) })] }), _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("contactInfoTitle") })] }), _jsx(CardDescription, { children: t("contactInfoDescription") })] }), _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: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsPhone") })] }), _jsx("p", { className: "text-base", children: formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsEmail") })] }), _jsx("p", { className: "text-base", children: formatValue(email) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Globe, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsWebsite") })] }), _jsx("p", { className: "text-base", children: formatValue(website) === "—" ? (t("noWebsiteProvided")) : (_jsx("a", { href: website, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline", children: website })) })] }), logo && (_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Image, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsLogo") })] }), _jsx("div", { className: "mt-2", children: _jsx("img", { src: logo, alt: t("viewLabelsLogoAlt"), className: "h-16 w-16 rounded border object-contain", onError: (e) => {
22
+ : address })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsCity") }), _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("viewLabelsState") }), _jsx("p", { className: "text-base", children: formatValue(_state) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsCountry") }), _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("viewLabelsPostalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsStatus") }), _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("viewStatusEnabled") : t("viewStatusDisabled")] })] })] }) })] }), _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("contactInfoTitle") })] }), _jsx(CardDescription, { children: t("contactInfoDescription") })] }), _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: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Phone, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsPhone") })] }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(phone) || formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsEmail") })] }), _jsx("p", { className: "text-base", children: formatValue(email) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Globe, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsWebsite") })] }), _jsx("p", { className: "text-base", children: formatValue(website) === "—" ? (t("noWebsiteProvided")) : (_jsx("a", { href: website, target: "_blank", rel: "noopener noreferrer", className: "text-primary hover:underline", children: website })) })] }), logo && (_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Image, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsLogo") })] }), _jsx("div", { className: "mt-2", children: _jsx("img", { src: logo, alt: t("viewLabelsLogoAlt"), className: "h-16 w-16 rounded border object-contain", onError: (e) => {
22
23
  e.currentTarget.style.display = "none";
23
24
  } }) })] }))] }) })] }), _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("administrationTitle") })] }), _jsx(CardDescription, { children: t("administrationDescription") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewLabelsPrincipalId") })] }), _jsx("p", { className: "font-mono text-sm", children: formatValue(principalId) })] }) }) })] })] }));
24
25
  };
@@ -27,6 +27,7 @@ import { createGenericModule } from "@react-pakistan/util-functions/factory/gene
27
27
  import { DRAWER_TYPES } from "@react-pakistan/util-functions/factory/generic-component-factory";
28
28
  import { generateThemeToast, TOAST_VARIANT, } from "@appcorp/shadcn/lib/toast-utils";
29
29
  import { STUDENT_STATUS } from "../../type";
30
+ import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
30
31
  import { STUDENT_PROFILE_API_ROUTES, pageLimit } from "./constants";
31
32
  import { studentProfileFormValidation } from "./validate";
32
33
  import { getCachedStudentProfiles, invalidateStudentProfilesCache, } from "./cache";
@@ -129,14 +130,14 @@ export const useStudentProfileModule = () => {
129
130
  bloodGroup: state.bloodGroup,
130
131
  dateOfBirth: state.dateOfBirth,
131
132
  email: state.email,
132
- emergencyPhone: state.emergencyPhone,
133
+ emergencyPhone: normalizePhone(state.emergencyPhone),
133
134
  enabled: state.enabled,
134
135
  familyMemberId: state.familyMemberId,
135
136
  firstName: state.firstName,
136
137
  gender: state.gender,
137
138
  id: state.id,
138
139
  lastName: state.lastName,
139
- phone: state.phone,
140
+ phone: normalizePhone(state.phone),
140
141
  status: state.status,
141
142
  studentCode: state.studentCode,
142
143
  }), [
@@ -239,9 +240,9 @@ export const useStudentProfileModule = () => {
239
240
  dateOfBirth: (_d = fm === null || fm === void 0 ? void 0 : fm.dateOfBirth) !== null && _d !== void 0 ? _d : null,
240
241
  gender: (_e = fm === null || fm === void 0 ? void 0 : fm.gender) !== null && _e !== void 0 ? _e : null,
241
242
  bloodGroup: (_f = fm === null || fm === void 0 ? void 0 : fm.bloodGroup) !== null && _f !== void 0 ? _f : null,
242
- phone: (_g = fm === null || fm === void 0 ? void 0 : fm.phone) !== null && _g !== void 0 ? _g : null,
243
+ phone: (_g = formatPhoneDisplay(fm === null || fm === void 0 ? void 0 : fm.phone)) !== null && _g !== void 0 ? _g : null,
243
244
  email: (_h = fm === null || fm === void 0 ? void 0 : fm.email) !== null && _h !== void 0 ? _h : null,
244
- emergencyPhone: (_j = fm === null || fm === void 0 ? void 0 : fm.emergencyPhone) !== null && _j !== void 0 ? _j : null,
245
+ emergencyPhone: (_j = formatPhoneDisplay(fm === null || fm === void 0 ? void 0 : fm.emergencyPhone)) !== null && _j !== void 0 ? _j : null,
245
246
  avatar: (_k = fm === null || fm === void 0 ? void 0 : fm.avatar) !== null && _k !== void 0 ? _k : null,
246
247
  familyId: (_l = fm === null || fm === void 0 ? void 0 : fm.familyId) !== null && _l !== void 0 ? _l : "",
247
248
  address: (_m = family === null || family === void 0 ? void 0 : family.address) !== null && _m !== void 0 ? _m : null,
@@ -9,6 +9,7 @@ import { User, Phone, MapPin, Calendar, GraduationCap, CheckCircle2, XCircle, }
9
9
  import { useTranslations } from "next-intl";
10
10
  import { useStudentProfileModule } from "./context";
11
11
  import { formatValue } from "../../utils/format-value";
12
+ import { formatPhoneDisplay } from "../../utils/phone-helpers";
12
13
  export const StudentProfileView = () => {
13
14
  const t = useTranslations("studentProfile");
14
15
  const context = useStudentProfileModule();
@@ -21,7 +22,8 @@ export const StudentProfileView = () => {
21
22
  return "\u2014";
22
23
  return formatDate(new Date(date).toISOString(), DATE_FORMATS.LOCALE_DATE);
23
24
  };
24
- 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("studentCode"), ": ", 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("personalInformation") })] }), _jsx(CardDescription, { children: t("basicPersonalDetails") })] }), _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("firstName") }), _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("lastName") }), _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("dateOfBirth") })] }), _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("gender") }), _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("contactInformation") })] }), _jsx(CardDescription, { children: t("contactDetailsAndLocation") })] }), _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("email") }), _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("phone") }), _jsx("p", { className: "text-base", children: formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("emergencyPhone") }), _jsx("p", { className: "text-base", children: 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("address") })] }), _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("city") }), _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("stateProvince") }), _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("country") }), _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("postalCode") }), _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("academicInformation") })] }), _jsx(CardDescription, { children: t("enrollmentAndAcademicStatus") })] }), _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("status") }), _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("studentCode"), ": ", 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("personalInformation") })] }), _jsx(CardDescription, { children: t("basicPersonalDetails") })] }), _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("firstName") }), _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("lastName") }), _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("dateOfBirth") })] }), _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("gender") }), _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("contactInformation") })] }), _jsx(CardDescription, { children: t("contactDetailsAndLocation") })] }), _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("email") }), _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("phone") }), _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("emergencyPhone") }), _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("address") })] }), _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("city") }), _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("stateProvince") }), _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("country") }), _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("postalCode") }), _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("academicInformation") })] }), _jsx(CardDescription, { children: t("enrollmentAndAcademicStatus") })] }), _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("status") }), _jsx(Badge, { variant: status === "ACTIVE"
25
27
  ? "default"
26
28
  : status === "GRADUATED"
27
29
  ? "secondary"