@appcorp/fusion-storybook 0.1.100 → 0.2.0

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.
@@ -33,7 +33,8 @@ import { admissionFormValidation } from "./validate";
33
33
  import { getCachedAdmissions, invalidateAdmissionsCache } from "./cache";
34
34
  import { getCachedWorkspaceSync } from "../workspace/cache";
35
35
  import { generateAdmissionReceiptPDF, } from "../../utils/admission-pdf";
36
- import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
36
+ import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
37
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
37
38
  import { invalidateFamiliesCache } from "../family/cache";
38
39
  import { invalidateFamilyMembersCache } from "../family-member/cache";
39
40
  import { invalidateStudentProfilesCache } from "../student-profile/cache";
@@ -179,7 +180,7 @@ export const useAdmissionModule = () => {
179
180
  fatherIdNumber: state.fatherIdNumber || "",
180
181
  fatherFirstName: state.fatherFirstName || "",
181
182
  fatherLastName: state.fatherLastName || "",
182
- fatherMobile: normalizePhone(state.fatherMobile),
183
+ fatherMobile: formatNumber(state.fatherMobile),
183
184
  fatherOccupation: state.fatherOccupation || "",
184
185
  fatherOrganization: state.fatherOrganization || "",
185
186
  firstName: state.firstName || "",
@@ -190,7 +191,7 @@ export const useAdmissionModule = () => {
190
191
  motherIdNumber: state.motherIdNumber || "",
191
192
  motherFirstName: state.motherFirstName || "",
192
193
  motherLastName: state.motherLastName || "",
193
- motherMobile: normalizePhone(state.motherMobile),
194
+ motherMobile: formatNumber(state.motherMobile),
194
195
  notes: state.notes || "",
195
196
  orphan: (_c = state.orphan) !== null && _c !== void 0 ? _c : false,
196
197
  postalCode: state.postalCode || "",
@@ -52,7 +52,7 @@ const createComponentInstances = () => ({
52
52
  moreActions: _jsx(AdmissionMoreActions, {}),
53
53
  view: _jsx(AdmissionView, {}),
54
54
  });
55
- const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
55
+ const createAdmissionConfig = ({ cancelLabel, dispatch, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
56
56
  const components = createComponentInstances();
57
57
  return {
58
58
  moduleName: "admission",
@@ -76,7 +76,7 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, lab
76
76
  tableDescription,
77
77
  tableTitle,
78
78
  viewContent: components.view,
79
- size: drawer === ADMISSION_DRAWER.FORM_DRAWER ? "full" : "small",
79
+ size: "small",
80
80
  onClearFilters: () => {
81
81
  dispatch({ type: ADMISSION_ACTION_TYPES.RESET_FORM });
82
82
  },
@@ -88,10 +88,12 @@ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, lab
88
88
  const GenericAdmissionPage = createGenericModulePage();
89
89
  const AdmissionPageInner = (props) => {
90
90
  const context = useAdmissionModule();
91
- // Memoize config creation - destructure props to avoid object reference changes
91
+ // Memoize config creation - INTENTIONALLY EXCLUDE drawer state to prevent infinite loops
92
+ // The drawer state changing (from clicking buttons) would recreate this config,
93
+ // causing unnecessary re-renders and state updates. Since config should be stable
94
+ // across drawer state changes, we exclude it from dependencies.
92
95
  const admissionConfig = useMemo(() => createAdmissionConfig({
93
96
  dispatch: context.dispatch,
94
- drawer: context.state.drawer,
95
97
  cancelLabel: props.cancelLabel,
96
98
  drawerTitle: props.drawerTitle,
97
99
  labelActions: props.labelActions,
@@ -108,7 +110,6 @@ const AdmissionPageInner = (props) => {
108
110
  tableTitle: props.tableTitle,
109
111
  }), [
110
112
  context.dispatch,
111
- context.state.drawer,
112
113
  props.cancelLabel,
113
114
  props.drawerTitle,
114
115
  props.labelActions,
@@ -124,6 +125,11 @@ const AdmissionPageInner = (props) => {
124
125
  props.tableDescription,
125
126
  props.tableTitle,
126
127
  ]);
128
+ // Dynamically apply drawer size to config for proper drawer sizing
129
+ // This allows size to change without recreating the entire config
130
+ const admissionConfigWithSize = useMemo(() => (Object.assign(Object.assign({}, admissionConfig), { size: context.state.drawer === ADMISSION_DRAWER.FORM_DRAWER
131
+ ? "full"
132
+ : "small" })), [admissionConfig, context.state.drawer]);
127
133
  const hasPermission = resolveRbacPermissions({
128
134
  userRole: props.userRole,
129
135
  moduleName: "Admission",
@@ -131,7 +137,7 @@ const AdmissionPageInner = (props) => {
131
137
  if (!hasPermission) {
132
138
  return _jsx(RbacNoAccess, { moduleName: "Admission" });
133
139
  }
134
- return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfig, context: context, tableBodyCols: tableBodyCols }) }));
140
+ return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfigWithSize, context: context, tableBodyCols: tableBodyCols }) }));
135
141
  };
136
142
  // ============================================================================
137
143
  // PAGE EXPORTS
@@ -16,8 +16,8 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
16
16
  import { AlertTriangle, BookOpen, Brain, Calendar, CheckCircle2, FileText, Home, Loader2, RefreshCw, ShieldCheck, ShieldX, User, XCircle, } from "lucide-react";
17
17
  import { Button } from "@appcorp/shadcn/components/ui/button";
18
18
  import { useTranslations } from "next-intl";
19
- import { formatValue } from "../../utils/format-value";
20
- import { formatPhoneDisplay } from "../../utils/phone-helpers";
19
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
20
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
21
21
  import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
22
22
  import { getCachedWorkspaceSync } from "../workspace/cache";
23
23
  import { ADMISSION_STATUS } from "../../type";
@@ -21,7 +21,8 @@ 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
+ import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
25
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
25
26
  import { CAMPUS_API_ROUTES, pageLimit } from "./constants";
26
27
  import { campusFormValidation } from "./validate";
27
28
  import { getCachedCampuses, invalidateCampusesCache } from "./cache";
@@ -107,7 +108,7 @@ export const useCampusModule = () => {
107
108
  enabled: state.enabled,
108
109
  id: state.id,
109
110
  name: state.name,
110
- phone: normalizePhone(state.phone),
111
+ phone: formatNumber(state.phone),
111
112
  schoolId: state.schoolId || schoolId,
112
113
  state: state.state,
113
114
  }), [state, schoolId]);
@@ -11,11 +11,13 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
11
11
  import { Building2, CheckCircle2, XCircle } from "lucide-react";
12
12
  import { useCampusModule } from "./context";
13
13
  import { useTranslations } from "next-intl";
14
- import { formatValue } from "../../utils/format-value";
15
- import { formatPhoneDisplay } from "../../utils/phone-helpers";
14
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
15
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
16
16
  export const CampusView = () => {
17
17
  const { state } = useCampusModule();
18
18
  const { address, city, code, country, enabled, name, phone, state: campusState, } = state;
19
19
  const t = useTranslations("campus");
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("viewFieldCode"), ": ", 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("viewSectionCampusDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCampusInformation") })] }), _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("viewFieldCampusName") }), _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("viewFieldCampusCode") }), _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("viewFieldAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCity") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldState") }), _jsx("p", { className: "text-base", children: formatValue(campusState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCountry") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPhone") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(phone) || formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive") })] })] }) })] })] }));
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("viewFieldCode"), ": ", 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("viewSectionCampusDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCampusInformation") })] }), _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("viewFieldCampusName") }), _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("viewFieldCampusCode") }), _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("viewFieldAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCity") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldState") }), _jsx("p", { className: "text-base", children: formatValue(campusState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCountry") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPhone") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(phone) || formatValue(phone) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
21
+ ? t("viewFieldStatusActive")
22
+ : t("viewFieldStatusInactive") })] })] }) })] })] }));
21
23
  };
@@ -11,10 +11,12 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
11
11
  import { GraduationCap, CheckCircle2, XCircle } from "lucide-react";
12
12
  import { useClassModule } from "./context";
13
13
  import { useTranslations } from "next-intl";
14
- import { formatValue } from "../../utils/format-value";
14
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
15
15
  export const ClassView = () => {
16
16
  const { state } = useClassModule();
17
17
  const { code, description, enabled, name } = state;
18
18
  const t = useTranslations("class");
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(GraduationCap, { 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("viewFieldCode"), ": ", code] })] })] }) }) }), _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("viewSectionClassDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteClassInformation") })] }), _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("viewFieldClassName") }), _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("viewFieldClassCode") }), _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("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive") })] })] }) })] })] }));
19
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(GraduationCap, { 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("viewFieldCode"), ": ", code] })] })] }) }) }), _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("viewSectionClassDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteClassInformation") })] }), _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("viewFieldClassName") }), _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("viewFieldClassCode") }), _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("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
20
+ ? t("viewFieldStatusActive")
21
+ : t("viewFieldStatusInactive") })] })] }) })] })] }));
20
22
  };
@@ -14,7 +14,7 @@ import { getCachedSectionsSync } from "../section/cache";
14
14
  import { getCachedSubjectsSync } from "../subject/cache";
15
15
  import { getCachedTeachersSync } from "../teacher/cache";
16
16
  import { useTranslations } from "next-intl";
17
- import { formatValue } from "../../utils/format-value";
17
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
18
18
  export const CourseView = () => {
19
19
  var _a, _b, _c, _d, _e;
20
20
  const t = useTranslations("course");
@@ -36,5 +36,7 @@ export const CourseView = () => {
36
36
  teacher.teacherCode ||
37
37
  "—"
38
38
  : "—";
39
- 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(BookMarked, { 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: formatValue(code) }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsx("p", { className: "text-muted-foreground mt-1", children: sectionName })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookMarked, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionCourseDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCourseInformation") })] }), _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("viewFieldCourseCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("section") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubject") }), _jsx("p", { className: "text-base", children: subjectName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeacher") }), _jsx("p", { className: "text-base", children: teacherName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive") })] })] }) })] })] }));
39
+ 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(BookMarked, { 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: formatValue(code) }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsx("p", { className: "text-muted-foreground mt-1", children: sectionName })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookMarked, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionCourseDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCourseInformation") })] }), _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("viewFieldCourseCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("section") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubject") }), _jsx("p", { className: "text-base", children: subjectName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeacher") }), _jsx("p", { className: "text-base", children: teacherName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
40
+ ? t("viewFieldStatusActive")
41
+ : t("viewFieldStatusInactive") })] })] }) })] })] }));
40
42
  };
@@ -15,7 +15,7 @@ import { Badge } from "@appcorp/shadcn/components/ui/badge";
15
15
  import { Separator } from "@appcorp/shadcn/components/ui/separator";
16
16
  import { CheckCircle2, XCircle } from "lucide-react";
17
17
  import { DISCOUNT_TYPE } from "../../type";
18
- import { formatValue } from "../../utils/format-value";
18
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
19
19
  export const DiscountCodeView = () => {
20
20
  const { state } = useDiscountCodeModule();
21
21
  const t = useTranslations("discountCode");
@@ -13,7 +13,7 @@ import { useExpenseModule } from "./context";
13
13
  import { getCachedWorkspaceSync } from "../workspace/cache";
14
14
  import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
15
15
  import { useTranslations } from "next-intl";
16
- import { formatValue } from "../../utils/format-value";
16
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
17
17
  export const ExpenseView = () => {
18
18
  var _a, _b;
19
19
  const { state } = useExpenseModule();
@@ -44,9 +44,11 @@ export const ExpenseView = () => {
44
44
  return "secondary";
45
45
  }
46
46
  };
47
- return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionExpenseInformation") })] }), _jsx(CardDescription, { children: t("viewSectionReadOnlyExpenseInformation") })] }), _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-sm font-medium text-muted-foreground", children: t("viewFieldTitle") }), _jsx("p", { className: "text-base font-semibold", children: formatValue(title) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldAmount") })] }), _jsxs("p", { className: "text-base font-bold", children: [currency, " ", Number(amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldCategory") }), _jsx(Badge, { variant: "outline", children: formatValue(category) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStatus") }), _jsxs(Badge, { className: "gap-1", variant: getStatusVariant(), children: [getStatusIcon(), formatValue(status)] })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldRemarks") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive")] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionPaymentDetails") })] }), _jsx(CardDescription, { children: t("viewPaymentDetailsDescription") })] }), _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: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldExpenseDate") })] }), _jsx("p", { className: "text-base", children: expenseDate
47
+ return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionExpenseInformation") })] }), _jsx(CardDescription, { children: t("viewSectionReadOnlyExpenseInformation") })] }), _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("viewFieldTitle") }), _jsx("p", { className: "text-base font-semibold", children: formatValue(title) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _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("viewFieldAmount") })] }), _jsxs("p", { className: "text-base font-bold", children: [currency, " ", Number(amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCategory") }), _jsx(Badge, { variant: "outline", children: formatValue(category) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsxs(Badge, { className: "gap-1", variant: getStatusVariant(), children: [getStatusIcon(), formatValue(status)] })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRemarks") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled
48
+ ? t("viewFieldStatusActive")
49
+ : t("viewFieldStatusInactive")] })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionPaymentDetails") })] }), _jsx(CardDescription, { children: t("viewPaymentDetailsDescription") })] }), _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: [_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("viewFieldExpenseDate") })] }), _jsx("p", { className: "text-base", children: expenseDate
48
50
  ? formatDate(expenseDate, DATE_FORMATS.LOCALE_DATE)
49
- : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "h-4 w-4 text-muted-foreground" }), _jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldPaymentDate") })] }), _jsx("p", { className: "text-base", children: paymentDate
51
+ : "—" })] }), _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("viewFieldPaymentDate") })] }), _jsx("p", { className: "text-base", children: paymentDate
50
52
  ? formatDate(paymentDate, DATE_FORMATS.LOCALE_DATE)
51
- : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldPaymentMethod") }), _jsx("p", { className: "text-base", children: formatValue(paymentMethod) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldInvoiceNumber") }), _jsx("p", { className: "font-mono text-base", children: formatValue(invoiceNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldReceiptNumber") }), _jsx("p", { className: "font-mono text-base", children: formatValue(receiptNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldTransactionId") }), _jsx("p", { className: "font-mono text-base", children: formatValue(transactionId) })] })] }) })] }), (vendorName || vendorContact) && (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionVendorInformation") })] }), _jsx(CardDescription, { children: t("viewSectionVendorDetails") })] }), _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-sm font-medium text-muted-foreground", children: t("viewFieldVendorName") }), _jsx("p", { className: "text-base", children: formatValue(vendorName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldVendorContact") }), _jsx("p", { className: "text-base", children: formatValue(vendorContact) })] })] }) })] }))] }));
53
+ : "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPaymentMethod") }), _jsx("p", { className: "text-base", children: formatValue(paymentMethod) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldInvoiceNumber") }), _jsx("p", { className: "font-mono text-base", children: formatValue(invoiceNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldReceiptNumber") }), _jsx("p", { className: "font-mono text-base", children: formatValue(receiptNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTransactionId") }), _jsx("p", { className: "font-mono text-base", children: formatValue(transactionId) })] })] }) })] }), (vendorName || vendorContact) && (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Building, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionVendorInformation") })] }), _jsx(CardDescription, { children: t("viewSectionVendorDetails") })] }), _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("viewFieldVendorName") }), _jsx("p", { className: "text-base", children: formatValue(vendorName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldVendorContact") }), _jsx("p", { className: "text-base", children: formatValue(vendorContact) })] })] }) })] }))] }));
52
54
  };
@@ -6,7 +6,7 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
6
6
  import { CheckCircle2, Home, MapPin, Users, XCircle } from "lucide-react";
7
7
  import { useFamilyModule } from "./context";
8
8
  import { useTranslations } from "next-intl";
9
- import { formatValue } from "../../utils/format-value";
9
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
10
10
  export const FamilyView = () => {
11
11
  const { state } = useFamilyModule();
12
12
  const { address, city, country, enabled, familyCode, postalCode, stateProvince, } = state;
@@ -29,7 +29,8 @@ 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
+ import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
33
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
33
34
  import { useTranslations } from "next-intl";
34
35
  import { getCachedWorkspaceSync } from "../workspace/cache";
35
36
  import { Eye, Filter, MoreHorizontal, Pencil, Plus } from "lucide-react";
@@ -128,11 +129,11 @@ export const useFamilyMemberModule = () => {
128
129
  dateOfBirth: state.dateOfBirth,
129
130
  gender: state.gender,
130
131
  bloodGroup: state.bloodGroup,
131
- phone: normalizePhone(state.phone),
132
+ phone: formatNumber(state.phone),
132
133
  email: state.email,
133
134
  relationship: state.relationship,
134
135
  occupation: state.occupation,
135
- emergencyPhone: normalizePhone(state.emergencyPhone),
136
+ emergencyPhone: formatNumber(state.emergencyPhone),
136
137
  idNumber: state.idNumber,
137
138
  avatar: state.avatar,
138
139
  isPrimary: state.isPrimary,
@@ -13,13 +13,14 @@ import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
13
13
  import { Briefcase, Calendar, CheckCircle2, Heart, Mail, Phone, ShieldCheck, User, Users, XCircle, } from "lucide-react";
14
14
  import { useFamilyMemberModule } from "./context";
15
15
  import { useTranslations } from "next-intl";
16
- import { formatValue } from "../../utils/format-value";
17
- import { formatPhoneDisplay } from "../../utils/phone-helpers";
16
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
17
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
18
18
  export const FamilyMemberView = () => {
19
19
  const { state } = useFamilyMemberModule();
20
20
  const { avatar, bloodGroup, dateOfBirth, email, emergencyPhone, enabled, firstName, gender, idNumber, isPrimary, lastName, occupation, phone, relationship, role, } = state;
21
21
  const t = useTranslations("familyMember");
22
- const fullName = [firstName, lastName].filter(Boolean).join(" ") || t("viewFieldFamilyMember");
22
+ const fullName = [firstName, lastName].filter(Boolean).join(" ") ||
23
+ t("viewFieldFamilyMember");
23
24
  const initials = `${(firstName === null || firstName === void 0 ? void 0 : firstName[0]) || ""}${(lastName === null || lastName === void 0 ? void 0 : lastName[0]) || ""}`
24
25
  .toUpperCase()
25
26
  .slice(0, 2);
@@ -34,7 +35,9 @@ export const FamilyMemberView = () => {
34
35
  return formatDate(new Date(value).toISOString(), DATE_FORMATS.LOCALE_DATE);
35
36
  };
36
37
  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("badgeActive")] })) : (_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(XCircle, { className: "h-3 w-3" }), t("badgeInactive")] })), isPrimary && (_jsxs(Badge, { variant: "outline", className: "gap-1", children: [_jsx(ShieldCheck, { className: "h-3 w-3" }), t("viewFieldPrimaryContact")] }))] }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: t("viewFieldFamilyMemberProfile") }), _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("viewSectionPersonalInformation") })] }), _jsx(CardDescription, { children: t("viewSectionBasicIdentityAndProfileDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFirstName") }), _jsx("p", { className: "text-base", children: formatValue(firstName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldLastName") }), _jsx("p", { className: "text-base", children: formatValue(lastName) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRole") }), 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("viewFieldDateOfBirth") })] }), _jsx("p", { className: "text-base", children: formatDateValue(dateOfBirth) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), 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("viewFieldBloodGroup") })] }), _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("viewFieldIdNumber") }), _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("viewSectionContactInformation") })] }), _jsx(CardDescription, { children: t("viewSectionReachabilityAndEmergencyContactDetails") })] }), _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("viewFieldPhone") })] }), _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("viewFieldEmail") })] }), _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("viewFieldEmergencyPhone") })] }), _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("viewFieldFamilyRole") })] }), _jsx(CardDescription, { children: t("viewFieldRelationshipAndHouseholdResponsibilities") })] }), _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("viewFieldRelationship") }), 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("viewFieldOccupation") })] }), _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("viewFieldStatus") })] }), _jsx(CardDescription, { children: t("viewFieldPrimaryContactAndAccountActivity") })] }), _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("viewFieldPrimaryContact") : t("viewFieldSecondaryContact") }), _jsx("p", { className: "text-muted-foreground text-sm", children: isPrimary
38
+ 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("viewFieldFamilyRole") })] }), _jsx(CardDescription, { children: t("viewFieldRelationshipAndHouseholdResponsibilities") })] }), _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("viewFieldRelationship") }), 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("viewFieldOccupation") })] }), _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("viewFieldStatus") })] }), _jsx(CardDescription, { children: t("viewFieldPrimaryContactAndAccountActivity") })] }), _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
39
+ ? t("viewFieldPrimaryContact")
40
+ : t("viewFieldSecondaryContact") }), _jsx("p", { className: "text-muted-foreground text-sm", children: isPrimary
38
41
  ? t("viewFieldThisIsPrimaryFamilyContact")
39
42
  : t("viewFieldThisIsAdditionalFamilyContact") })] })] }), _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("badgeActive") : t("badgeInactive") }), _jsx("p", { className: "text-muted-foreground text-sm", children: enabled
40
43
  ? t("viewFieldThisAccountIsCurrentlyActive")
@@ -12,13 +12,15 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
12
12
  import { CheckCircle2, DollarSign, FileText, XCircle } from "lucide-react";
13
13
  import { getCachedWorkspaceSync } from "../workspace/cache";
14
14
  import { useTranslations } from "next-intl";
15
- import { formatValue } from "../../utils/format-value";
15
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
16
16
  export const FeeStructureView = () => {
17
17
  var _a;
18
18
  const { state } = useFeeStructureModule();
19
19
  const { amount, description, enabled, feeType, frequency, name } = state;
20
20
  const t = useTranslations("feeStructure");
21
21
  const workspace = getCachedWorkspaceSync();
22
- return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionFeeStructureDetails") })] }), _jsx(CardDescription, { children: t("viewSectionFeeStructureRecordDetails") })] }), _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-sm font-medium text-muted-foreground", children: t("viewFieldName") }), _jsx("p", { className: "text-base font-semibold", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldFeeType") }), _jsx(Badge, { variant: "secondary", children: formatValue(feeType) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldAmount") }), _jsxs("p", { className: "text-base", children: [(_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency, " ", Number(amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldFrequency") }), _jsx("p", { className: "text-base", children: formatValue(frequency) })] })] }) })] }), description ? (_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdditionalDetails") })] }), _jsx(CardDescription, { children: t("viewFieldOptionalNotes") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("p", { className: "text-base", children: description }) })] })) : null, _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatus") })] }), _jsx(CardDescription, { children: t("viewFieldRecordState") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _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("viewFieldStatusActive") : t("viewFieldStatusInactive")] }) })] })] }));
22
+ return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(DollarSign, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionFeeStructureDetails") })] }), _jsx(CardDescription, { children: t("viewSectionFeeStructureRecordDetails") })] }), _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("viewFieldName") }), _jsx("p", { className: "text-base font-semibold", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFeeType") }), _jsx(Badge, { variant: "secondary", children: formatValue(feeType) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAmount") }), _jsxs("p", { className: "text-base", children: [(_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency, " ", Number(amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFrequency") }), _jsx("p", { className: "text-base", children: formatValue(frequency) })] })] }) })] }), description ? (_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("viewSectionAdditionalDetails") })] }), _jsx(CardDescription, { children: t("viewFieldOptionalNotes") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("p", { className: "text-base", children: description }) })] })) : null, _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(CheckCircle2, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatus") })] }), _jsx(CardDescription, { children: t("viewFieldRecordState") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _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
23
+ ? t("viewFieldStatusActive")
24
+ : t("viewFieldStatusInactive")] }) })] })] }));
23
25
  };
24
26
  FeeStructureView.displayName = "FeeStructureView";
@@ -29,7 +29,8 @@ 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
+ import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
33
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
33
34
  // ============================================================================
34
35
  // 1.1 DRAWER TYPES
35
36
  // ============================================================================
@@ -101,7 +102,7 @@ export const useSchoolModule = () => {
101
102
  id: state.id,
102
103
  logo: state.logo,
103
104
  name: state.name,
104
- phone: normalizePhone(state.phone),
105
+ phone: formatNumber(state.phone),
105
106
  postalCode: state.postalCode,
106
107
  principalId: state.principalId,
107
108
  state: state.state,
@@ -11,8 +11,8 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@app
11
11
  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
- import { formatValue } from "../../utils/format-value";
15
- import { formatPhoneDisplay } from "../../utils/phone-helpers";
14
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
15
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
16
16
  export const SchoolView = () => {
17
17
  const { state } = useSchoolModule();
18
18
  const { name, code, currency, address, city, state: _state, country, postalCode, enabled, phone, email, website, logo, principalId, } = state;
@@ -11,7 +11,7 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
11
11
  import { GraduationCap, CheckCircle2, XCircle, Users } from "lucide-react";
12
12
  import { useSectionModule } from "./context";
13
13
  import { useTranslations } from "next-intl";
14
- import { formatValue } from "../../utils/format-value";
14
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
15
15
  import { getCachedClassesSync } from "../class/cache";
16
16
  export const SectionView = () => {
17
17
  const { state } = useSectionModule();
@@ -22,5 +22,7 @@ export const SectionView = () => {
22
22
  const className = selectedClass
23
23
  ? `${selectedClass.name} (${selectedClass.code})`
24
24
  : "—";
25
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(Users, { 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("viewFieldClass"), ": ", className] })] })] }) }) }), _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("sectionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteSectionInformation") })] }), _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("sectionName") }), _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("viewFieldClass") }), _jsx("p", { className: "text-base", children: className })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCapacity") }), _jsxs("p", { className: "text-base", children: [formatValue(capacity), " ", capacity !== null ? t("viewFieldStudents") : ""] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive") })] })] }) })] })] }));
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: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(Users, { 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("viewFieldClass"), ": ", className] })] })] }) }) }), _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("sectionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteSectionInformation") })] }), _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("sectionName") }), _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("viewFieldClass") }), _jsx("p", { className: "text-base", children: className })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCapacity") }), _jsxs("p", { className: "text-base", children: [formatValue(capacity), " ", capacity !== null ? t("viewFieldStudents") : ""] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
26
+ ? t("viewFieldStatusActive")
27
+ : t("viewFieldStatusInactive") })] })] }) })] })] }));
26
28
  };
@@ -27,7 +27,8 @@ 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
+ import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
31
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
31
32
  import { STUDENT_PROFILE_API_ROUTES, pageLimit } from "./constants";
32
33
  import { studentProfileFormValidation } from "./validate";
33
34
  import { getCachedStudentProfiles, invalidateStudentProfilesCache, } from "./cache";
@@ -130,14 +131,14 @@ export const useStudentProfileModule = () => {
130
131
  bloodGroup: state.bloodGroup,
131
132
  dateOfBirth: state.dateOfBirth,
132
133
  email: state.email,
133
- emergencyPhone: normalizePhone(state.emergencyPhone),
134
+ emergencyPhone: formatNumber(state.emergencyPhone),
134
135
  enabled: state.enabled,
135
136
  familyMemberId: state.familyMemberId,
136
137
  firstName: state.firstName,
137
138
  gender: state.gender,
138
139
  id: state.id,
139
140
  lastName: state.lastName,
140
- phone: normalizePhone(state.phone),
141
+ phone: formatNumber(state.phone),
141
142
  status: state.status,
142
143
  studentCode: state.studentCode,
143
144
  }), [
@@ -8,8 +8,8 @@ import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
8
8
  import { User, Phone, MapPin, Calendar, GraduationCap, CheckCircle2, XCircle, } from "lucide-react";
9
9
  import { useTranslations } from "next-intl";
10
10
  import { useStudentProfileModule } from "./context";
11
- import { formatValue } from "../../utils/format-value";
12
- import { formatPhoneDisplay } from "../../utils/phone-helpers";
11
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
12
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
13
13
  export const StudentProfileView = () => {
14
14
  const t = useTranslations("studentProfile");
15
15
  const context = useStudentProfileModule();
@@ -11,10 +11,12 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
11
11
  import { BookOpen, CheckCircle2, XCircle } from "lucide-react";
12
12
  import { useSubjectModule } from "./context";
13
13
  import { useTranslations } from "next-intl";
14
- import { formatValue } from "../../utils/format-value";
14
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
15
15
  export const SubjectView = () => {
16
16
  const { state } = useSubjectModule();
17
17
  const { code, description, enabled, name } = state;
18
18
  const t = useTranslations("subject");
19
- return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookOpen, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: name }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsx("p", { className: "text-muted-foreground mt-1", children: code })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionSubjectDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteSubjectInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubjectName") }), _jsx("p", { className: "text-base", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubjectCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), description && (_jsxs("div", { className: "col-span-full space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: description })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? t("viewFieldStatusActive") : t("viewFieldStatusInactive") })] })] }) })] })] }));
19
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookOpen, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: name }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsx("p", { className: "text-muted-foreground mt-1", children: code })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionSubjectDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteSubjectInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubjectName") }), _jsx("p", { className: "text-base", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubjectCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), description && (_jsxs("div", { className: "col-span-full space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: description })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
20
+ ? t("viewFieldStatusActive")
21
+ : t("viewFieldStatusInactive") })] })] }) })] })] }));
20
22
  };
@@ -27,7 +27,8 @@ 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 { GENDER } from "../../type";
30
- import { formatPhoneDisplay, normalizePhone } from "../../utils/phone-helpers";
30
+ import { formatNumber } from "@react-pakistan/util-functions/general/format-number";
31
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
31
32
  import { TEACHER_API_ROUTES, pageLimit } from "./constants";
32
33
  import { teacherFormValidation } from "./validate";
33
34
  import { getCachedTeachers, invalidateTeachersCache } from "./cache";
@@ -124,7 +125,7 @@ export const useTeacherModule = () => {
124
125
  city: state.city,
125
126
  country: state.country,
126
127
  dateOfBirth: state.dateOfBirth,
127
- emergencyPhone: normalizePhone(state.emergencyPhone),
128
+ emergencyPhone: formatNumber(state.emergencyPhone),
128
129
  enabled: state.enabled,
129
130
  experience: state.experience,
130
131
  firstName: state.firstName,
@@ -132,7 +133,7 @@ export const useTeacherModule = () => {
132
133
  id: state.id,
133
134
  joiningDate: state.joiningDate,
134
135
  lastName: state.lastName,
135
- phone: normalizePhone(state.phone),
136
+ phone: formatNumber(state.phone),
136
137
  postalCode: state.postalCode,
137
138
  qualification: state.qualification,
138
139
  schoolId,
@@ -6,8 +6,8 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
6
6
  import { Avatar, AvatarFallback, AvatarImage, } from "@appcorp/shadcn/components/ui/avatar";
7
7
  import { User, Phone, MapPin, Calendar, GraduationCap, CheckCircle2, XCircle, Briefcase, } from "lucide-react";
8
8
  import { useTranslations } from "next-intl";
9
- import { formatValue } from "../../utils/format-value";
10
- import { formatPhoneDisplay } from "../../utils/phone-helpers";
9
+ import { formatValue } from "@react-pakistan/util-functions/general/format-value";
10
+ import { formatPhoneDisplay } from "@react-pakistan/util-functions/general/format-phone-display";
11
11
  import { formatDate, DATE_FORMATS } from "@react-pakistan/util-functions";
12
12
  import { useTeacherModule } from "./context";
13
13
  export const TeacherView = () => {