@appcorp/fusion-storybook 0.1.98 → 0.1.100
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/base-modules/admission/context.d.ts +18 -18
- package/base-modules/admission/context.js +20 -26
- package/base-modules/admission/form.js +3 -3
- package/base-modules/admission/validate.d.ts +3 -3
- package/base-modules/admission/validate.js +3 -15
- package/base-modules/admission/view.js +4 -2
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.d.ts +3 -3
- package/utils/admission-pdf.d.ts +3 -3
- package/utils/admission-pdf.js +5 -5
|
@@ -28,7 +28,7 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
28
28
|
drawer: string | null;
|
|
29
29
|
errors: Record<string, string>;
|
|
30
30
|
id: string;
|
|
31
|
-
|
|
31
|
+
studentIdNumber: string;
|
|
32
32
|
discountCode: string;
|
|
33
33
|
dob: string;
|
|
34
34
|
emergencyContact: string;
|
|
@@ -38,13 +38,13 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
38
38
|
lastName: string;
|
|
39
39
|
orphan: boolean;
|
|
40
40
|
registrationCode: string;
|
|
41
|
-
|
|
41
|
+
fatherIdNumber: string;
|
|
42
42
|
fatherFirstName: string;
|
|
43
43
|
fatherLastName: string;
|
|
44
44
|
fatherMobile: string;
|
|
45
45
|
fatherOccupation: string;
|
|
46
46
|
fatherOrganization: string;
|
|
47
|
-
|
|
47
|
+
motherIdNumber: string;
|
|
48
48
|
motherFirstName: string;
|
|
49
49
|
motherLastName: string;
|
|
50
50
|
motherMobile: string;
|
|
@@ -80,7 +80,7 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
80
80
|
drawer: string | null;
|
|
81
81
|
errors: Record<string, string>;
|
|
82
82
|
id: string;
|
|
83
|
-
|
|
83
|
+
studentIdNumber: string;
|
|
84
84
|
discountCode: string;
|
|
85
85
|
dob: string;
|
|
86
86
|
emergencyContact: string;
|
|
@@ -90,13 +90,13 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
90
90
|
lastName: string;
|
|
91
91
|
orphan: boolean;
|
|
92
92
|
registrationCode: string;
|
|
93
|
-
|
|
93
|
+
fatherIdNumber: string;
|
|
94
94
|
fatherFirstName: string;
|
|
95
95
|
fatherLastName: string;
|
|
96
96
|
fatherMobile: string;
|
|
97
97
|
fatherOccupation: string;
|
|
98
98
|
fatherOrganization: string;
|
|
99
|
-
|
|
99
|
+
motherIdNumber: string;
|
|
100
100
|
motherFirstName: string;
|
|
101
101
|
motherLastName: string;
|
|
102
102
|
motherMobile: string;
|
|
@@ -134,7 +134,7 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
134
134
|
drawer: string | null;
|
|
135
135
|
errors: Record<string, string>;
|
|
136
136
|
id: string;
|
|
137
|
-
|
|
137
|
+
studentIdNumber: string;
|
|
138
138
|
discountCode: string;
|
|
139
139
|
dob: string;
|
|
140
140
|
emergencyContact: string;
|
|
@@ -144,13 +144,13 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
144
144
|
lastName: string;
|
|
145
145
|
orphan: boolean;
|
|
146
146
|
registrationCode: string;
|
|
147
|
-
|
|
147
|
+
fatherIdNumber: string;
|
|
148
148
|
fatherFirstName: string;
|
|
149
149
|
fatherLastName: string;
|
|
150
150
|
fatherMobile: string;
|
|
151
151
|
fatherOccupation: string;
|
|
152
152
|
fatherOrganization: string;
|
|
153
|
-
|
|
153
|
+
motherIdNumber: string;
|
|
154
154
|
motherFirstName: string;
|
|
155
155
|
motherLastName: string;
|
|
156
156
|
motherMobile: string;
|
|
@@ -186,7 +186,7 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
186
186
|
drawer: string | null;
|
|
187
187
|
errors: Record<string, string>;
|
|
188
188
|
id: string;
|
|
189
|
-
|
|
189
|
+
studentIdNumber: string;
|
|
190
190
|
discountCode: string;
|
|
191
191
|
dob: string;
|
|
192
192
|
emergencyContact: string;
|
|
@@ -196,13 +196,13 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
196
196
|
lastName: string;
|
|
197
197
|
orphan: boolean;
|
|
198
198
|
registrationCode: string;
|
|
199
|
-
|
|
199
|
+
fatherIdNumber: string;
|
|
200
200
|
fatherFirstName: string;
|
|
201
201
|
fatherLastName: string;
|
|
202
202
|
fatherMobile: string;
|
|
203
203
|
fatherOccupation: string;
|
|
204
204
|
fatherOrganization: string;
|
|
205
|
-
|
|
205
|
+
motherIdNumber: string;
|
|
206
206
|
motherFirstName: string;
|
|
207
207
|
motherLastName: string;
|
|
208
208
|
motherMobile: string;
|
|
@@ -238,7 +238,7 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
238
238
|
drawer: string | null;
|
|
239
239
|
errors: Record<string, string>;
|
|
240
240
|
id: string;
|
|
241
|
-
|
|
241
|
+
studentIdNumber: string;
|
|
242
242
|
discountCode: string;
|
|
243
243
|
dob: string;
|
|
244
244
|
emergencyContact: string;
|
|
@@ -248,13 +248,13 @@ export declare const ADMISSION_ACTION_TYPES: {
|
|
|
248
248
|
lastName: string;
|
|
249
249
|
orphan: boolean;
|
|
250
250
|
registrationCode: string;
|
|
251
|
-
|
|
251
|
+
fatherIdNumber: string;
|
|
252
252
|
fatherFirstName: string;
|
|
253
253
|
fatherLastName: string;
|
|
254
254
|
fatherMobile: string;
|
|
255
255
|
fatherOccupation: string;
|
|
256
256
|
fatherOrganization: string;
|
|
257
|
-
|
|
257
|
+
motherIdNumber: string;
|
|
258
258
|
motherFirstName: string;
|
|
259
259
|
motherLastName: string;
|
|
260
260
|
motherMobile: string;
|
|
@@ -322,7 +322,7 @@ export declare const useAdmissionModule: () => {
|
|
|
322
322
|
drawer: string | null;
|
|
323
323
|
errors: Record<string, string>;
|
|
324
324
|
id: string;
|
|
325
|
-
|
|
325
|
+
studentIdNumber: string;
|
|
326
326
|
discountCode: string;
|
|
327
327
|
dob: string;
|
|
328
328
|
emergencyContact: string;
|
|
@@ -332,13 +332,13 @@ export declare const useAdmissionModule: () => {
|
|
|
332
332
|
lastName: string;
|
|
333
333
|
orphan: boolean;
|
|
334
334
|
registrationCode: string;
|
|
335
|
-
|
|
335
|
+
fatherIdNumber: string;
|
|
336
336
|
fatherFirstName: string;
|
|
337
337
|
fatherLastName: string;
|
|
338
338
|
fatherMobile: string;
|
|
339
339
|
fatherOccupation: string;
|
|
340
340
|
fatherOrganization: string;
|
|
341
|
-
|
|
341
|
+
motherIdNumber: string;
|
|
342
342
|
motherFirstName: string;
|
|
343
343
|
motherLastName: string;
|
|
344
344
|
motherMobile: string;
|
|
@@ -22,7 +22,6 @@ import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
|
22
22
|
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
|
-
import { formatCnic } from "@react-pakistan/util-functions/general/cnic-formatter";
|
|
26
25
|
import { useModuleEntityV2, } from "@react-pakistan/util-functions/hooks/use-module-entity-v2";
|
|
27
26
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
28
27
|
import { createGenericModule } from "@react-pakistan/util-functions/factory/generic-module-factory";
|
|
@@ -68,7 +67,7 @@ const admissionConfig = {
|
|
|
68
67
|
errors: {},
|
|
69
68
|
// Form — student detail
|
|
70
69
|
id: "",
|
|
71
|
-
|
|
70
|
+
studentIdNumber: "",
|
|
72
71
|
discountCode: "",
|
|
73
72
|
dob: new Date().toISOString().slice(0, 10),
|
|
74
73
|
emergencyContact: "Mother",
|
|
@@ -79,14 +78,14 @@ const admissionConfig = {
|
|
|
79
78
|
orphan: false,
|
|
80
79
|
registrationCode: "",
|
|
81
80
|
// Form — father detail
|
|
82
|
-
|
|
81
|
+
fatherIdNumber: "",
|
|
83
82
|
fatherFirstName: "",
|
|
84
83
|
fatherLastName: "",
|
|
85
84
|
fatherMobile: "",
|
|
86
85
|
fatherOccupation: "",
|
|
87
86
|
fatherOrganization: "",
|
|
88
87
|
// Form — mother detail
|
|
89
|
-
|
|
88
|
+
motherIdNumber: "",
|
|
90
89
|
motherFirstName: "",
|
|
91
90
|
motherLastName: "",
|
|
92
91
|
motherMobile: "",
|
|
@@ -169,7 +168,7 @@ export const useAdmissionModule = () => {
|
|
|
169
168
|
address: state.address || "",
|
|
170
169
|
admissionNotes: state.admissionNotes || "",
|
|
171
170
|
admissionStatus: state.status || ADMISSION_STATUS.PENDING,
|
|
172
|
-
|
|
171
|
+
studentIdNumber: state.studentIdNumber || "",
|
|
173
172
|
city: state.city || "",
|
|
174
173
|
classForAdmission: state.classForAdmission || "",
|
|
175
174
|
country: state.country || "",
|
|
@@ -177,7 +176,7 @@ export const useAdmissionModule = () => {
|
|
|
177
176
|
dob: state.dob || null,
|
|
178
177
|
emergencyContact: state.emergencyContact || "",
|
|
179
178
|
enabled: (_a = state.enabled) !== null && _a !== void 0 ? _a : true,
|
|
180
|
-
|
|
179
|
+
fatherIdNumber: state.fatherIdNumber || "",
|
|
181
180
|
fatherFirstName: state.fatherFirstName || "",
|
|
182
181
|
fatherLastName: state.fatherLastName || "",
|
|
183
182
|
fatherMobile: normalizePhone(state.fatherMobile),
|
|
@@ -188,7 +187,7 @@ export const useAdmissionModule = () => {
|
|
|
188
187
|
hafiz: (_b = state.hafiz) !== null && _b !== void 0 ? _b : false,
|
|
189
188
|
id: state.id || "",
|
|
190
189
|
lastName: state.lastName || "",
|
|
191
|
-
|
|
190
|
+
motherIdNumber: state.motherIdNumber || "",
|
|
192
191
|
motherFirstName: state.motherFirstName || "",
|
|
193
192
|
motherLastName: state.motherLastName || "",
|
|
194
193
|
motherMobile: normalizePhone(state.motherMobile),
|
|
@@ -205,7 +204,7 @@ export const useAdmissionModule = () => {
|
|
|
205
204
|
state.address,
|
|
206
205
|
state.admissionNotes,
|
|
207
206
|
state.status,
|
|
208
|
-
state.
|
|
207
|
+
state.studentIdNumber,
|
|
209
208
|
state.city,
|
|
210
209
|
state.classForAdmission,
|
|
211
210
|
state.country,
|
|
@@ -213,7 +212,7 @@ export const useAdmissionModule = () => {
|
|
|
213
212
|
state.dob,
|
|
214
213
|
state.emergencyContact,
|
|
215
214
|
state.enabled,
|
|
216
|
-
state.
|
|
215
|
+
state.fatherIdNumber,
|
|
217
216
|
state.fatherFirstName,
|
|
218
217
|
state.fatherLastName,
|
|
219
218
|
state.fatherMobile,
|
|
@@ -224,7 +223,7 @@ export const useAdmissionModule = () => {
|
|
|
224
223
|
state.hafiz,
|
|
225
224
|
state.id,
|
|
226
225
|
state.lastName,
|
|
227
|
-
state.
|
|
226
|
+
state.motherIdNumber,
|
|
228
227
|
state.motherFirstName,
|
|
229
228
|
state.motherLastName,
|
|
230
229
|
state.motherMobile,
|
|
@@ -256,18 +255,13 @@ export const useAdmissionModule = () => {
|
|
|
256
255
|
});
|
|
257
256
|
}, [theme]);
|
|
258
257
|
const setField = useCallback((key, value) => {
|
|
259
|
-
var _a
|
|
258
|
+
var _a;
|
|
260
259
|
let formatted = value === null
|
|
261
260
|
? undefined
|
|
262
261
|
: value;
|
|
263
|
-
if ((key === "bForm" || key === "fatherCnic" || key === "motherCnic") &&
|
|
264
|
-
typeof value === "string" &&
|
|
265
|
-
value.length === 13) {
|
|
266
|
-
formatted = (_a = formatCnic(value)) !== null && _a !== void 0 ? _a : value;
|
|
267
|
-
}
|
|
268
262
|
if ((key === "fatherMobile" || key === "motherMobile") &&
|
|
269
263
|
typeof value === "string") {
|
|
270
|
-
formatted = (
|
|
264
|
+
formatted = (_a = formatPhoneDisplay(value)) !== null && _a !== void 0 ? _a : value;
|
|
271
265
|
}
|
|
272
266
|
dispatch({
|
|
273
267
|
type: ADMISSION_ACTION_TYPES.SET_INPUT_FIELD,
|
|
@@ -335,7 +329,7 @@ export const useAdmissionModule = () => {
|
|
|
335
329
|
setField("id", admission.id);
|
|
336
330
|
setField("firstName", (_c = admission.studentDetails) === null || _c === void 0 ? void 0 : _c.firstName);
|
|
337
331
|
setField("lastName", (_d = admission.studentDetails) === null || _d === void 0 ? void 0 : _d.lastName);
|
|
338
|
-
setField("
|
|
332
|
+
setField("studentIdNumber", (_e = admission.studentDetails) === null || _e === void 0 ? void 0 : _e.studentIdNumber);
|
|
339
333
|
// Normalise gender to match GENDER enum values (e.g. 'Male' → 'MALE')
|
|
340
334
|
const rawGender = (_f = admission.studentDetails) === null || _f === void 0 ? void 0 : _f.gender;
|
|
341
335
|
let normalizedGender = null;
|
|
@@ -353,13 +347,13 @@ export const useAdmissionModule = () => {
|
|
|
353
347
|
setField("orphan", (_l = admission.studentDetails) === null || _l === void 0 ? void 0 : _l.orphan);
|
|
354
348
|
setField("fatherFirstName", (_m = admission.fatherDetails) === null || _m === void 0 ? void 0 : _m.fatherFirstName);
|
|
355
349
|
setField("fatherLastName", (_o = admission.fatherDetails) === null || _o === void 0 ? void 0 : _o.fatherLastName);
|
|
356
|
-
setField("
|
|
350
|
+
setField("fatherIdNumber", (_p = admission.fatherDetails) === null || _p === void 0 ? void 0 : _p.fatherIdNumber);
|
|
357
351
|
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);
|
|
358
352
|
setField("fatherOccupation", (_t = admission.fatherDetails) === null || _t === void 0 ? void 0 : _t.fatherOccupation);
|
|
359
353
|
setField("fatherOrganization", (_u = admission.fatherDetails) === null || _u === void 0 ? void 0 : _u.fatherOrganization);
|
|
360
354
|
setField("motherFirstName", (_v = admission.motherDetails) === null || _v === void 0 ? void 0 : _v.motherFirstName);
|
|
361
355
|
setField("motherLastName", (_w = admission.motherDetails) === null || _w === void 0 ? void 0 : _w.motherLastName);
|
|
362
|
-
setField("
|
|
356
|
+
setField("motherIdNumber", (_x = admission.motherDetails) === null || _x === void 0 ? void 0 : _x.motherIdNumber);
|
|
363
357
|
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);
|
|
364
358
|
setField("address", (_1 = admission.homeDetails) === null || _1 === void 0 ? void 0 : _1.address);
|
|
365
359
|
setField("city", (_2 = admission.homeDetails) === null || _2 === void 0 ? void 0 : _2.city);
|
|
@@ -545,20 +539,20 @@ export const useAdmissionModule = () => {
|
|
|
545
539
|
const pdfData = {
|
|
546
540
|
firstName: studentDetails.firstName || "",
|
|
547
541
|
lastName: studentDetails.lastName || "",
|
|
548
|
-
|
|
542
|
+
studentIdNumber: studentDetails.studentIdNumber || "",
|
|
549
543
|
gender: studentDetails.gender || "",
|
|
550
544
|
dob: studentDetails.dob || "",
|
|
551
545
|
registrationCode: studentDetails.registrationCode || "",
|
|
552
546
|
discountCode: studentDetails.discountCode,
|
|
553
547
|
fatherFirstName: fatherDetails.fatherFirstName || "",
|
|
554
548
|
fatherLastName: fatherDetails.fatherLastName || "",
|
|
555
|
-
|
|
549
|
+
fatherIdNumber: fatherDetails.fatherIdNumber || "",
|
|
556
550
|
fatherMobile: fatherDetails.fatherMobile || "",
|
|
557
551
|
fatherOccupation: fatherDetails.fatherOccupation,
|
|
558
552
|
fatherOrganization: fatherDetails.fatherOrganization,
|
|
559
553
|
motherFirstName: motherDetails.motherFirstName || "",
|
|
560
554
|
motherLastName: motherDetails.motherLastName || "",
|
|
561
|
-
|
|
555
|
+
motherIdNumber: motherDetails.motherIdNumber || "",
|
|
562
556
|
motherMobile: motherDetails.motherMobile || "",
|
|
563
557
|
address: homeDetails.address || "",
|
|
564
558
|
city: homeDetails.city || "",
|
|
@@ -688,7 +682,7 @@ export const useAdmissionModule = () => {
|
|
|
688
682
|
siblings: updateParams.siblings,
|
|
689
683
|
},
|
|
690
684
|
fatherDetails: {
|
|
691
|
-
|
|
685
|
+
fatherIdNumber: updateParams.fatherIdNumber,
|
|
692
686
|
fatherFirstName: updateParams.fatherFirstName,
|
|
693
687
|
fatherLastName: updateParams.fatherLastName,
|
|
694
688
|
fatherMobile: updateParams.fatherMobile,
|
|
@@ -697,7 +691,7 @@ export const useAdmissionModule = () => {
|
|
|
697
691
|
emergencyContact: updateParams.emergencyContact === "Father",
|
|
698
692
|
},
|
|
699
693
|
motherDetails: {
|
|
700
|
-
|
|
694
|
+
motherIdNumber: updateParams.motherIdNumber || "",
|
|
701
695
|
motherFirstName: updateParams.motherFirstName || "N/A",
|
|
702
696
|
motherLastName: updateParams.motherLastName || "N/A",
|
|
703
697
|
motherMobile: updateParams.motherMobile,
|
|
@@ -715,7 +709,7 @@ export const useAdmissionModule = () => {
|
|
|
715
709
|
admissionNotes: updateParams.admissionNotes,
|
|
716
710
|
},
|
|
717
711
|
studentDetails: {
|
|
718
|
-
|
|
712
|
+
studentIdNumber: updateParams.studentIdNumber,
|
|
719
713
|
discountCode: updateParams.discountCode,
|
|
720
714
|
dob: updateParams.dob,
|
|
721
715
|
firstName: updateParams.firstName,
|
|
@@ -24,7 +24,7 @@ import { getCachedDiscountCodesSync } from "../discount-code/cache";
|
|
|
24
24
|
import { useTranslations } from "next-intl";
|
|
25
25
|
export const AdmissionForm = () => {
|
|
26
26
|
const { state, handleChange, dispatch } = useAdmissionModule();
|
|
27
|
-
const { address, admissionNotes,
|
|
27
|
+
const { address, admissionNotes, studentIdNumber, city, classForAdmission, country, discountCode, dob, emergencyContact, errors, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, previousSchool, registrationCode, siblings, state: provinceState, } = state;
|
|
28
28
|
const t = useTranslations("admission");
|
|
29
29
|
const workspace = getCachedWorkspaceSync();
|
|
30
30
|
const discountCodes = getCachedDiscountCodesSync();
|
|
@@ -78,9 +78,9 @@ export const AdmissionForm = () => {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
}, [id, dispatch, workspace]);
|
|
81
|
-
return (_jsxs("div", { className: "grid grid-cols-1 gap-2 space-y-2", children: [_jsx("h4", { className: "m-0 p-0", children: t("formSectionStudentInformation") }), _jsxs("div", { className: "grid grid-cols-5 gap-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: firstName || "" }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: lastName || "" }), _jsx(EnhancedInput, { error: errors.
|
|
81
|
+
return (_jsxs("div", { className: "grid grid-cols-1 gap-2 space-y-2", children: [_jsx("h4", { className: "m-0 p-0", children: t("formSectionStudentInformation") }), _jsxs("div", { className: "grid grid-cols-5 gap-4", children: [_jsx(EnhancedInput, { error: errors.firstName, id: "firstName", info: t("formFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("firstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: firstName || "" }), _jsx(EnhancedInput, { error: errors.lastName, id: "lastName", info: t("formLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("lastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: lastName || "" }), _jsx(EnhancedInput, { error: errors.studentIdNumber, id: "studentIdNumber", info: t("formStudentIdNumberInfo"), label: t("formStudentIdNumberLabel"), onChange: (e) => handleChange("studentIdNumber", e.target.value), placeholder: t("formStudentIdNumberPlaceholder"), required: true, type: "text", value: studentIdNumber || "" }), _jsx(EnhancedCombobox, { emptyText: t("formNoGenderOptionsEmpty"), error: errors.gender, id: "gender", info: t("formGenderInfo"), label: t("formGenderLabel"), required: true, onValueChange: (value) => handleChange("gender", value), options: [
|
|
82
82
|
{ label: t("formOptionMale"), value: GENDER.MALE },
|
|
83
83
|
{ label: t("formOptionFemale"), value: GENDER.FEMALE },
|
|
84
84
|
{ label: t("formOptionOther"), value: GENDER.OTHER },
|
|
85
|
-
], placeholder: t("formGenderPlaceholder"), searchPlaceholder: t("formSearchGenderPlaceholder"), value: gender }), _jsx(EnhancedInput, { error: errors.dob, id: "dob", info: t("formDobInfo"), label: t("formDobLabel"), onChange: (e) => handleChange("dob", e.target.value), placeholder: t("formDobPlaceholder"), required: true, type: "date", value: dob || "" }), _jsx(EnhancedInput, { error: errors.registrationCode, id: "registrationCode", info: t("formRegistrationCodeInfo"), label: t("formRegistrationCodeLabel"), onChange: (e) => handleChange("registrationCode", e.target.value), placeholder: t("formRegistrationCodePlaceholder"), required: true, type: "text", value: registrationCode || "", disabled: true }), _jsx(EnhancedCombobox, { emptyText: t("formNoDiscountCodesEmpty"), error: errors.discountCode, id: "discountCode", info: t("formDiscountCodeInfo"), label: t("formDiscountCodeLabel"), onValueChange: (value) => handleChange("discountCode", value), options: discountCodeOptions, placeholder: t("formDiscountCodePlaceholder"), searchPlaceholder: t("formSearchDiscountCodesPlaceholder"), value: discountCode || "" }), _jsx(EnhancedCheckbox, { label: t("formCheckboxHafizLabel"), id: "hafiz", info: t("formHafizInfo"), onCheckedChange: (checked) => handleChange("hafiz", checked) }), _jsx(EnhancedCheckbox, { label: t("formCheckboxOrphanLabel"), id: "orphan", info: t("formOrphanInfo"), onCheckedChange: (checked) => handleChange("orphan", checked) })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionFatherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.fatherFirstName, id: "fatherFirstName", info: t("formFatherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("fatherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: fatherFirstName || "" }), _jsx(EnhancedInput, { error: errors.fatherLastName, id: "fatherLastName", info: t("formFatherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("fatherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: fatherLastName || "" }), _jsx(EnhancedInput, { error: errors.
|
|
85
|
+
], placeholder: t("formGenderPlaceholder"), searchPlaceholder: t("formSearchGenderPlaceholder"), value: gender }), _jsx(EnhancedInput, { error: errors.dob, id: "dob", info: t("formDobInfo"), label: t("formDobLabel"), onChange: (e) => handleChange("dob", e.target.value), placeholder: t("formDobPlaceholder"), required: true, type: "date", value: dob || "" }), _jsx(EnhancedInput, { error: errors.registrationCode, id: "registrationCode", info: t("formRegistrationCodeInfo"), label: t("formRegistrationCodeLabel"), onChange: (e) => handleChange("registrationCode", e.target.value), placeholder: t("formRegistrationCodePlaceholder"), required: true, type: "text", value: registrationCode || "", disabled: true }), _jsx(EnhancedCombobox, { emptyText: t("formNoDiscountCodesEmpty"), error: errors.discountCode, id: "discountCode", info: t("formDiscountCodeInfo"), label: t("formDiscountCodeLabel"), onValueChange: (value) => handleChange("discountCode", value), options: discountCodeOptions, placeholder: t("formDiscountCodePlaceholder"), searchPlaceholder: t("formSearchDiscountCodesPlaceholder"), value: discountCode || "" }), _jsx(EnhancedCheckbox, { label: t("formCheckboxHafizLabel"), id: "hafiz", info: t("formHafizInfo"), onCheckedChange: (checked) => handleChange("hafiz", checked) }), _jsx(EnhancedCheckbox, { label: t("formCheckboxOrphanLabel"), id: "orphan", info: t("formOrphanInfo"), onCheckedChange: (checked) => handleChange("orphan", checked) })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionFatherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.fatherFirstName, id: "fatherFirstName", info: t("formFatherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("fatherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: fatherFirstName || "" }), _jsx(EnhancedInput, { error: errors.fatherLastName, id: "fatherLastName", info: t("formFatherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("fatherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: fatherLastName || "" }), _jsx(EnhancedInput, { error: errors.fatherIdNumber, id: "fatherIdNumber", info: t("formFatherIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("fatherIdNumber", e.target.value), placeholder: t("formIDNumberPlaceholder"), required: true, type: "text", value: fatherIdNumber || "" }), _jsx(EnhancedInput, { error: errors.fatherMobile, id: "fatherMobile", info: t("formFatherMobileInfo"), label: t("formMobileLabel"), onChange: (e) => handleChange("fatherMobile", e.target.value), placeholder: "+923001234567", required: true, type: "text", value: fatherMobile || "" }), _jsx(EnhancedInput, { error: errors.fatherOccupation, id: "fatherOccupation", info: t("formFatherOccupationInfo"), label: t("formOccupationLabel"), onChange: (e) => handleChange("fatherOccupation", e.target.value), placeholder: t("formOccupationPlaceholder"), required: false, type: "text", value: fatherOccupation || "" }), _jsx(EnhancedInput, { error: errors.fatherOrganization, id: "fatherOrganization", info: t("formFatherOrganizationInfo"), label: t("formOrganizationLabel"), onChange: (e) => handleChange("fatherOrganization", e.target.value), placeholder: t("formOrganizationPlaceholder"), required: false, type: "text", value: fatherOrganization || "" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactFather", info: t("formFatherEmergencyContactInfo"), checked: emergencyContact === "Father", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Father" : "") })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionMotherInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.motherFirstName, id: "motherFirstName", info: t("formMotherFirstNameInfo"), label: t("formFirstNameLabel"), onChange: (e) => handleChange("motherFirstName", e.target.value), placeholder: t("formFirstNamePlaceholder"), required: true, type: "text", value: motherFirstName || "" }), _jsx(EnhancedInput, { error: errors.motherLastName, id: "motherLastName", info: t("formMotherLastNameInfo"), label: t("formLastNameLabel"), onChange: (e) => handleChange("motherLastName", e.target.value), placeholder: t("formLastNamePlaceholder"), required: true, type: "text", value: motherLastName || "" }), _jsx(EnhancedInput, { error: errors.motherIdNumber, id: "motherIdNumber", info: t("formMotherIdNumberInfo"), label: t("formIdNumberLabel"), onChange: (e) => handleChange("motherIdNumber", e.target.value), placeholder: t("formIDNumberPlaceholder"), required: true, type: "text", value: motherIdNumber || "" }), _jsx(EnhancedInput, { error: errors.motherMobile, id: "motherMobile", info: t("formMotherMobileInfo"), label: t("formMobileLabel"), onChange: (e) => handleChange("motherMobile", e.target.value), placeholder: "+923001234567", required: true, type: "text", value: motherMobile || "" }), _jsx(EnhancedCheckbox, { label: t("formEmergencyContactLabel"), id: "emergencyContactMother", info: t("formMotherEmergencyContactInfo"), checked: emergencyContact === "Mother", onCheckedChange: (checked) => handleChange("emergencyContact", checked ? "Mother" : "") })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionHomeInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedTextarea, { error: errors.address, id: "homeAddress", info: t("formHomeAddressInfo"), label: t("formHomeAddressLabel"), onChange: (e) => handleChange("address", e.target.value), placeholder: t("formHomeAddressPlaceholder"), required: true, rows: 2, value: address || "" }), _jsx(EnhancedInput, { error: errors.city, id: "city", info: t("formCityInfo"), label: t("formCityLabel"), onChange: (e) => handleChange("city", e.target.value), placeholder: t("formCityPlaceholder"), required: true, type: "text", value: city || "" }), _jsx(EnhancedInput, { error: errors.state, id: "state", info: t("formStateInfo"), label: t("formStateLabel"), onChange: (e) => handleChange("state", e.target.value), placeholder: t("formStatePlaceholder"), required: true, type: "text", value: provinceState || "" }), _jsx(EnhancedInput, { error: errors.country, id: "country", info: t("formCountryInfo"), label: t("formCountryLabel"), onChange: (e) => handleChange("country", e.target.value), placeholder: t("formCountryPlaceholder"), required: true, type: "text", value: country || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionAdmissionInformation") }), _jsxs("div", { className: "grid grid-cols-6 gap-4", children: [_jsx(EnhancedInput, { error: errors.classForAdmission, id: "classForAdmission", info: t("formClassForAdmissionInfo"), label: t("formClassForAdmissionLabel"), onChange: (e) => handleChange("classForAdmission", e.target.value), placeholder: t("formClassForAdmissionPlaceholder"), required: true, type: "text", value: classForAdmission || "" }), _jsx(EnhancedInput, { error: errors.previousSchool, id: "previousSchool", info: t("formPreviousSchoolInfo"), label: t("formPreviousSchoolLabel"), onChange: (e) => handleChange("previousSchool", e.target.value), placeholder: t("formPreviousSchoolPlaceholder"), type: "text", value: previousSchool || "" }), _jsx(EnhancedTextarea, { error: errors.siblings, id: "siblings", info: t("formSiblingsInfo"), label: t("formSiblingsLabel"), onChange: (e) => handleChange("siblings", e.target.value), placeholder: t("formSiblingsPlaceholder"), rows: 3, value: siblings || "" })] }), _jsx(Separator, {}), _jsx("h4", { className: "m-0 p-0", children: t("formSectionOfficeUse") }), _jsxs("div", { className: "grid grid-cols-4 gap-4", children: [_jsx(EnhancedTextarea, { error: errors.notes, id: "notes", info: t("formNotesInfo"), label: t("formNotesLabel"), onChange: (e) => handleChange("notes", e.target.value), placeholder: t("formNotesPlaceholder"), rows: 3, value: notes || "" }), _jsx(EnhancedTextarea, { error: errors.admissionNotes, id: "admissionNotes", info: t("formAdmissionNotesInfo"), label: t("formAdmissionNotesLabel"), onChange: (e) => handleChange("admissionNotes", e.target.value), placeholder: t("formAdmissionNotesPlaceholder"), rows: 3, value: admissionNotes || "" })] })] }));
|
|
86
86
|
};
|
|
@@ -9,7 +9,7 @@ export declare const admissionFormValidation: z.ZodObject<{
|
|
|
9
9
|
registrationCode: z.ZodString;
|
|
10
10
|
firstName: z.ZodString;
|
|
11
11
|
lastName: z.ZodString;
|
|
12
|
-
|
|
12
|
+
studentIdNumber: z.ZodString;
|
|
13
13
|
dob: z.ZodString;
|
|
14
14
|
gender: z.ZodEnum<typeof GENDER>;
|
|
15
15
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
@@ -17,13 +17,13 @@ export declare const admissionFormValidation: z.ZodObject<{
|
|
|
17
17
|
orphan: z.ZodOptional<z.ZodBoolean>;
|
|
18
18
|
fatherFirstName: z.ZodString;
|
|
19
19
|
fatherLastName: z.ZodString;
|
|
20
|
-
|
|
20
|
+
fatherIdNumber: z.ZodString;
|
|
21
21
|
fatherMobile: z.ZodString;
|
|
22
22
|
fatherOccupation: z.ZodOptional<z.ZodString>;
|
|
23
23
|
fatherOrganization: z.ZodOptional<z.ZodString>;
|
|
24
24
|
motherFirstName: z.ZodString;
|
|
25
25
|
motherLastName: z.ZodString;
|
|
26
|
-
|
|
26
|
+
motherIdNumber: z.ZodString;
|
|
27
27
|
motherMobile: z.ZodString;
|
|
28
28
|
address: z.ZodString;
|
|
29
29
|
city: z.ZodString;
|
|
@@ -10,11 +10,7 @@ export const admissionFormValidation = z.object({
|
|
|
10
10
|
registrationCode: z.string().min(1, "Registration code is required"),
|
|
11
11
|
firstName: z.string().min(1, "First name is required"),
|
|
12
12
|
lastName: z.string().min(1, "Last name is required"),
|
|
13
|
-
|
|
14
|
-
.string()
|
|
15
|
-
.min(1, "B. Form is required")
|
|
16
|
-
.max(15, "B. Form must be 15 characters")
|
|
17
|
-
.regex(/^\d{5}-\d{7}-\d{1}$/, "B. Form must be in format XXXXX-XXXXXXX-X"),
|
|
13
|
+
studentIdNumber: z.string().min(1, "Student ID number is required"),
|
|
18
14
|
dob: z
|
|
19
15
|
.string()
|
|
20
16
|
.min(1, "Date of birth is required")
|
|
@@ -37,22 +33,14 @@ export const admissionFormValidation = z.object({
|
|
|
37
33
|
// Father Information
|
|
38
34
|
fatherFirstName: z.string().min(1, "Father's first name is required"),
|
|
39
35
|
fatherLastName: z.string().min(1, "Father's last name is required"),
|
|
40
|
-
|
|
41
|
-
.string()
|
|
42
|
-
.min(1, "Father's CNIC is required")
|
|
43
|
-
.max(15, "Father's CNIC must be 15 characters")
|
|
44
|
-
.regex(/^\d{5}-\d{7}-\d{1}$/, "Father's CNIC must be in format XXXXX-XXXXXXX-X"),
|
|
36
|
+
fatherIdNumber: z.string().min(1, "Father's ID number is required"),
|
|
45
37
|
fatherMobile: z.string().min(1, "Father's mobile number is required"),
|
|
46
38
|
fatherOccupation: z.string().optional(),
|
|
47
39
|
fatherOrganization: z.string().optional(),
|
|
48
40
|
// Mother Information
|
|
49
41
|
motherFirstName: z.string().min(1, "Mother's first name is required"),
|
|
50
42
|
motherLastName: z.string().min(1, "Mother's last name is required"),
|
|
51
|
-
|
|
52
|
-
.string()
|
|
53
|
-
.min(1, "Mother's CNIC is required")
|
|
54
|
-
.max(15, "Mother's CNIC must be 15 characters")
|
|
55
|
-
.regex(/^\d{5}-\d{7}-\d{1}$/, "Mother's CNIC must be in format XXXXX-XXXXXXX-X"),
|
|
43
|
+
motherIdNumber: z.string().min(1, "Mother's ID number is required"),
|
|
56
44
|
motherMobile: z.string().min(1, "Mother's mobile number is required"),
|
|
57
45
|
// Home Information
|
|
58
46
|
address: z.string().min(1, "Home address is required"),
|
|
@@ -24,7 +24,7 @@ import { ADMISSION_STATUS } from "../../type";
|
|
|
24
24
|
export const AdmissionView = () => {
|
|
25
25
|
var _a, _b;
|
|
26
26
|
const { state, handleAnalyze } = useAdmissionModule();
|
|
27
|
-
const { address, admissionNotes, aiAnalysis, analyzeLoading, analyzeError,
|
|
27
|
+
const { address, admissionNotes, aiAnalysis, analyzeLoading, analyzeError, studentIdNumber, city, classForAdmission, country, discountCode, dob, emergencyContact, enabled, fatherIdNumber, fatherFirstName, fatherLastName, fatherMobile, fatherOccupation, fatherOrganization, firstName, gender, hafiz, id, lastName, motherIdNumber, motherFirstName, motherLastName, motherMobile, notes, orphan, postalCode, previousSchool, registrationCode, siblings, state: provinceState, status, } = state;
|
|
28
28
|
const workspace = getCachedWorkspaceSync();
|
|
29
29
|
const hasGeminiSecrets = Boolean(((_a = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _a === void 0 ? void 0 : _a.GEMINI_API_KEY) && ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.secrets) === null || _b === void 0 ? void 0 : _b.GEMINI_MODEL));
|
|
30
30
|
const t = useTranslations("admission");
|
|
@@ -42,5 +42,7 @@ export const AdmissionView = () => {
|
|
|
42
42
|
return _jsx(ShieldX, { className: "h-4 w-4" });
|
|
43
43
|
return _jsx(AlertTriangle, { className: "h-4 w-4" });
|
|
44
44
|
};
|
|
45
|
-
return (_jsxs("div", { className: "space-y-6", children: [hasGeminiSecrets && (_jsxs(Card, { className: "border-primary/20 border-2", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Brain, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAiAnalysis") })] }), status === ADMISSION_STATUS.PENDING && (_jsxs(Button, { variant: "outline", size: "sm", disabled: analyzeLoading, onClick: () => handleAnalyze({ id }), children: [analyzeLoading ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(RefreshCw, { className: "mr-2 h-4 w-4" })), aiAnalysis ? t("viewButtonReRunAnalysis") : t("viewButtonAnalyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("viewFieldGeminiPoweredAdmissionScoring") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [analyzeLoading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: t("viewTextRunningAiAnalysis") })] })), analyzeError && !analyzeLoading && (_jsxs("div", { className: "text-destructive flex items-center gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "h-4 w-4" }), _jsx("span", { children: analyzeError })] })), !analyzeLoading && aiAnalysis && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsxs("div", { className: "bg-muted flex flex-col items-center rounded-lg px-6 py-3", children: [_jsx("span", { className: "text-primary text-3xl font-bold", children: aiAnalysis.score }), _jsx("span", { className: "text-muted-foreground text-xs tracking-wide uppercase", children: "/ 100" })] }), _jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium ${decisionColor(aiAnalysis.decision)}`, children: [decisionIcon(aiAnalysis.decision), aiAnalysis.decision.replace("_", " ")] }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [_jsxs("span", { className: "font-medium", children: [t("viewFieldConfidence"), ": "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("viewFieldAiReasoningAndRiskFlags") }), _jsx("ul", { className: "space-y-1.5", children: aiAnalysis.reasons.map((reason, i) => (_jsxs("li", { className: "flex items-start gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-yellow-500" }), _jsx("span", { children: reason })] }, i))) })] })), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t("viewFieldLastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("viewTextNoAiAnalysisYet") }))] })] })), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdmissionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionRegistrationAndAdmissionInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRegistrationCode") }), _jsx("p", { className: "font-mono text-base", children: formatValue(registrationCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassForAdmission") }), _jsx("p", { className: "text-base", children: formatValue(classForAdmission) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx("p", { className: "text-base", children: formatValue(status) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPreviousSchool") }), _jsx("p", { className: "text-base", children: formatValue(previousSchool) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSiblings") }), _jsx("p", { className: "text-base", children: formatValue(siblings) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionStudentInformation") })] }), _jsx(CardDescription, { children: t("viewSectionPersonalDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(firstName), " ", formatValue(lastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDob") }), _jsx("p", { className: "text-base", children: formatDate(String(dob), DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), _jsx("p", { className: "text-base", children: formatValue(gender) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldBForm") }), _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("viewFieldDiscountCode") }), _jsx("p", { className: "text-base", children: formatValue(discountCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmergencyContact") }), _jsx("p", { className: "text-base", children: formatValue(emergencyContact) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldHafizEQuran") }), _jsx("p", { className: "text-base", children: hafiz ? t("viewFieldYes") : t("viewFieldNo") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrphan") }), _jsx("p", { className: "text-base", children: orphan ? t("viewFieldYes") : t("viewFieldNo") })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionFatherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionFatherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(fatherFirstName), " ", formatValue(fatherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCnic") }), _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("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(fatherMobile) || formatValue(fatherMobile) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOccupation") }), _jsx("p", { className: "text-base", children: formatValue(fatherOccupation) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrganization") }), _jsx("p", { className: "text-base", children: formatValue(fatherOrganization) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionMotherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionMotherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(motherFirstName), " ", formatValue(motherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCnic") }), _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("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(motherMobile) || formatValue(motherMobile) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Home, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionHomeDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAddressInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCity") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldState") }), _jsx("p", { className: "text-base", children: formatValue(provinceState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCountry") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPostalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionOfficeUse") })] }), _jsx(CardDescription, { children: t("viewSectionInternalNotesAndProcessingInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldNotes") }), _jsx("p", { className: "text-base", children: formatValue(notes) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAdmissionNotes") }), _jsx("p", { className: "text-base", children: formatValue(admissionNotes) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionRecordStatus") })] }), _jsx(CardDescription, { children: t("viewFieldRecordStateAndMetadata") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEnabled") }), _jsxs(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] }) })] })] }));
|
|
45
|
+
return (_jsxs("div", { className: "space-y-6", children: [hasGeminiSecrets && (_jsxs(Card, { className: "border-primary/20 border-2", children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Brain, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAiAnalysis") })] }), status === ADMISSION_STATUS.PENDING && (_jsxs(Button, { variant: "outline", size: "sm", disabled: analyzeLoading, onClick: () => handleAnalyze({ id }), children: [analyzeLoading ? (_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" })) : (_jsx(RefreshCw, { className: "mr-2 h-4 w-4" })), aiAnalysis
|
|
46
|
+
? t("viewButtonReRunAnalysis")
|
|
47
|
+
: t("viewButtonAnalyzeWithAi")] }))] }), _jsx(CardDescription, { children: t("viewFieldGeminiPoweredAdmissionScoring") })] }), _jsx(Separator, {}), _jsxs(CardContent, { className: "pt-6", children: [analyzeLoading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3", children: [_jsx(Loader2, { className: "h-5 w-5 animate-spin" }), _jsx("span", { children: t("viewTextRunningAiAnalysis") })] })), analyzeError && !analyzeLoading && (_jsxs("div", { className: "text-destructive flex items-center gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "h-4 w-4" }), _jsx("span", { children: analyzeError })] })), !analyzeLoading && aiAnalysis && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [_jsxs("div", { className: "bg-muted flex flex-col items-center rounded-lg px-6 py-3", children: [_jsx("span", { className: "text-primary text-3xl font-bold", children: aiAnalysis.score }), _jsx("span", { className: "text-muted-foreground text-xs tracking-wide uppercase", children: "/ 100" })] }), _jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium ${decisionColor(aiAnalysis.decision)}`, children: [decisionIcon(aiAnalysis.decision), aiAnalysis.decision.replace("_", " ")] }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [_jsxs("span", { className: "font-medium", children: [t("viewFieldConfidence"), ":", " "] }), (aiAnalysis.confidence * 100).toFixed(0), "%"] })] }), aiAnalysis.reasons.length > 0 && (_jsxs("div", { children: [_jsx("p", { className: "mb-2 text-sm font-medium", children: t("viewFieldAiReasoningAndRiskFlags") }), _jsx("ul", { className: "space-y-1.5", children: aiAnalysis.reasons.map((reason, i) => (_jsxs("li", { className: "flex items-start gap-2 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-yellow-500" }), _jsx("span", { children: reason })] }, i))) })] })), _jsxs("p", { className: "text-muted-foreground text-xs", children: [t("viewFieldLastAnalyzed"), ":", " ", formatDate(String(aiAnalysis.processedAt), DATE_FORMATS.LOCALE_DATE)] })] })), !analyzeLoading && !aiAnalysis && !analyzeError && (_jsx("p", { className: "text-muted-foreground text-sm", children: t("viewTextNoAiAnalysisYet") }))] })] })), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionAdmissionDetails") })] }), _jsx(CardDescription, { children: t("viewSectionRegistrationAndAdmissionInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRegistrationCode") }), _jsx("p", { className: "font-mono text-base", children: formatValue(registrationCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassForAdmission") }), _jsx("p", { className: "text-base", children: formatValue(classForAdmission) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx("p", { className: "text-base", children: formatValue(status) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPreviousSchool") }), _jsx("p", { className: "text-base", children: formatValue(previousSchool) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSiblings") }), _jsx("p", { className: "text-base", children: formatValue(siblings) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionStudentInformation") })] }), _jsx(CardDescription, { children: t("viewSectionPersonalDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(firstName), " ", formatValue(lastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDob") }), _jsx("p", { className: "text-base", children: formatDate(String(dob), DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldGender") }), _jsx("p", { className: "text-base", children: formatValue(gender) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStudentIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(studentIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDiscountCode") }), _jsx("p", { className: "text-base", children: formatValue(discountCode) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEmergencyContact") }), _jsx("p", { className: "text-base", children: formatValue(emergencyContact) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldHafizEQuran") }), _jsx("p", { className: "text-base", children: hafiz ? t("viewFieldYes") : t("viewFieldNo") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrphan") }), _jsx("p", { className: "text-base", children: orphan ? t("viewFieldYes") : t("viewFieldNo") })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionFatherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionFatherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(fatherFirstName), " ", formatValue(fatherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(fatherIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(fatherMobile) || formatValue(fatherMobile) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOccupation") }), _jsx("p", { className: "text-base", children: formatValue(fatherOccupation) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldOrganization") }), _jsx("p", { className: "text-base", children: formatValue(fatherOrganization) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(User, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionMotherInformation") })] }), _jsx(CardDescription, { children: t("viewSectionMotherDetails") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldFullName") }), _jsxs("p", { className: "text-base", children: [formatValue(motherFirstName), " ", formatValue(motherLastName)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldIdNumber") }), _jsx("p", { className: "text-base", children: formatValue(motherIdNumber) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldMobile") }), _jsx("p", { className: "text-base", children: formatPhoneDisplay(motherMobile) || formatValue(motherMobile) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Home, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionHomeDetails") })] }), _jsx(CardDescription, { children: t("viewSectionAddressInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAddress") }), _jsx("p", { className: "text-base", children: formatValue(address) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCity") }), _jsx("p", { className: "text-base", children: formatValue(city) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldState") }), _jsx("p", { className: "text-base", children: formatValue(provinceState) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCountry") }), _jsx("p", { className: "text-base", children: formatValue(country) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldPostalCode") }), _jsx("p", { className: "text-base", children: formatValue(postalCode) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileText, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionOfficeUse") })] }), _jsx(CardDescription, { children: t("viewSectionInternalNotesAndProcessingInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldNotes") }), _jsx("p", { className: "text-base", children: formatValue(notes) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldAdmissionNotes") }), _jsx("p", { className: "text-base", children: formatValue(admissionNotes) })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionRecordStatus") })] }), _jsx(CardDescription, { children: t("viewFieldRecordStateAndMetadata") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldEnabled") }), _jsxs(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] }) })] })] }));
|
|
46
48
|
};
|