@appcorp/fusion-storybook 0.3.48 → 0.3.49
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/student-fee/context/shared.d.ts +5 -0
- package/base-modules/student-fee/context/shared.js +4 -0
- package/base-modules/student-fee/context/use-student-fee-module.d.ts +2 -1
- package/base-modules/student-fee/context/use-student-fee-module.js +21 -1
- package/base-modules/student-fee/form.js +2 -2
- package/base-modules/student-fee/single-entry-form.d.ts +2 -0
- package/base-modules/student-fee/single-entry-form.js +2 -2
- package/base-modules/student-fee/single-entry.js +5 -1
- package/base-modules/student-fee/validate.d.ts +1 -0
- package/base-modules/student-fee/validate.js +1 -0
- package/base-modules/student-fee/view.js +2 -2
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -47,6 +47,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
47
47
|
lastRemindedAt: Date | string | null;
|
|
48
48
|
nextFollowUpAt: Date | string | null;
|
|
49
49
|
originalFee: number;
|
|
50
|
+
paidAt: string;
|
|
50
51
|
reliabilityScore: number | null;
|
|
51
52
|
remarks: string | null;
|
|
52
53
|
riskLevel: FEE_RISK_LEVEL | null;
|
|
@@ -77,6 +78,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
77
78
|
lastRemindedAt: Date | string | null;
|
|
78
79
|
nextFollowUpAt: Date | string | null;
|
|
79
80
|
originalFee: number;
|
|
81
|
+
paidAt: string;
|
|
80
82
|
reliabilityScore: number | null;
|
|
81
83
|
remarks: string | null;
|
|
82
84
|
riskLevel: FEE_RISK_LEVEL | null;
|
|
@@ -109,6 +111,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
109
111
|
lastRemindedAt: Date | string | null;
|
|
110
112
|
nextFollowUpAt: Date | string | null;
|
|
111
113
|
originalFee: number;
|
|
114
|
+
paidAt: string;
|
|
112
115
|
reliabilityScore: number | null;
|
|
113
116
|
remarks: string | null;
|
|
114
117
|
riskLevel: FEE_RISK_LEVEL | null;
|
|
@@ -139,6 +142,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
139
142
|
lastRemindedAt: Date | string | null;
|
|
140
143
|
nextFollowUpAt: Date | string | null;
|
|
141
144
|
originalFee: number;
|
|
145
|
+
paidAt: string;
|
|
142
146
|
reliabilityScore: number | null;
|
|
143
147
|
remarks: string | null;
|
|
144
148
|
riskLevel: FEE_RISK_LEVEL | null;
|
|
@@ -169,6 +173,7 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
169
173
|
lastRemindedAt: Date | string | null;
|
|
170
174
|
nextFollowUpAt: Date | string | null;
|
|
171
175
|
originalFee: number;
|
|
176
|
+
paidAt: string;
|
|
172
177
|
reliabilityScore: number | null;
|
|
173
178
|
remarks: string | null;
|
|
174
179
|
riskLevel: FEE_RISK_LEVEL | null;
|
|
@@ -47,6 +47,10 @@ const studentFeeConfig = {
|
|
|
47
47
|
lastRemindedAt: null,
|
|
48
48
|
nextFollowUpAt: null,
|
|
49
49
|
originalFee: 0,
|
|
50
|
+
paidAt: (() => {
|
|
51
|
+
const d = new Date();
|
|
52
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
53
|
+
})(),
|
|
50
54
|
reliabilityScore: null,
|
|
51
55
|
remarks: null,
|
|
52
56
|
riskLevel: null,
|
|
@@ -22,7 +22,7 @@ export declare const useStudentFeeModule: () => {
|
|
|
22
22
|
handleSubmit: () => void;
|
|
23
23
|
handleSubmitSingleEntry: (fees: {
|
|
24
24
|
studentFees: StudentFeeBE[];
|
|
25
|
-
}, amountPaid: string, remarks: string) => Promise<void>;
|
|
25
|
+
}, amountPaid: string, remarks: string, paidAt?: string) => Promise<void>;
|
|
26
26
|
handleView: (row?: TableRow) => void;
|
|
27
27
|
headerActions: {
|
|
28
28
|
enabled: boolean;
|
|
@@ -59,6 +59,7 @@ export declare const useStudentFeeModule: () => {
|
|
|
59
59
|
lastRemindedAt: Date | string | null;
|
|
60
60
|
nextFollowUpAt: Date | string | null;
|
|
61
61
|
originalFee: number;
|
|
62
|
+
paidAt: string;
|
|
62
63
|
reliabilityScore: number | null;
|
|
63
64
|
remarks: string | null;
|
|
64
65
|
riskLevel: FEE_RISK_LEVEL | null;
|
|
@@ -69,6 +69,7 @@ export const useStudentFeeModule = () => {
|
|
|
69
69
|
familyId: state.familyId,
|
|
70
70
|
feeStructureId: state.feeStructureId,
|
|
71
71
|
id: state.id,
|
|
72
|
+
paidAt: state.paidAt || null,
|
|
72
73
|
remarks: state.remarks || null,
|
|
73
74
|
schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "",
|
|
74
75
|
status: state.status,
|
|
@@ -105,6 +106,7 @@ export const useStudentFeeModule = () => {
|
|
|
105
106
|
const resetRecordFormState = useCallback(() => {
|
|
106
107
|
var _a, _b;
|
|
107
108
|
const dueDay = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength) !== null && _a !== void 0 ? _a : 1;
|
|
109
|
+
const currentDate = new Date();
|
|
108
110
|
const dueDate = new Date();
|
|
109
111
|
dueDate.setDate(dueDay);
|
|
110
112
|
dispatch({
|
|
@@ -134,6 +136,7 @@ export const useStudentFeeModule = () => {
|
|
|
134
136
|
lastRemindedAt: null,
|
|
135
137
|
nextFollowUpAt: null,
|
|
136
138
|
originalFee: 0,
|
|
139
|
+
paidAt: `${currentDate.getFullYear()}-${String(currentDate.getMonth() + 1).padStart(2, "0")}-${String(currentDate.getDate()).padStart(2, "0")}`,
|
|
137
140
|
reliabilityScore: null,
|
|
138
141
|
remarks: null,
|
|
139
142
|
riskLevel: null,
|
|
@@ -187,11 +190,20 @@ export const useStudentFeeModule = () => {
|
|
|
187
190
|
const dueDate = rawDueDate instanceof Date
|
|
188
191
|
? `${rawDueDate.getFullYear()}-${String(rawDueDate.getMonth() + 1).padStart(2, "0")}-${String(rawDueDate.getDate()).padStart(2, "0")}`
|
|
189
192
|
: String(rawDueDate).slice(0, 10);
|
|
193
|
+
const rawPaidAt = fee.paidAt;
|
|
194
|
+
const today = new Date();
|
|
195
|
+
const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, "0")}-${String(today.getDate()).padStart(2, "0")}`;
|
|
196
|
+
const paidAt = rawPaidAt instanceof Date
|
|
197
|
+
? `${rawPaidAt.getFullYear()}-${String(rawPaidAt.getMonth() + 1).padStart(2, "0")}-${String(rawPaidAt.getDate()).padStart(2, "0")}`
|
|
198
|
+
: rawPaidAt
|
|
199
|
+
? String(rawPaidAt).slice(0, 10)
|
|
200
|
+
: todayStr;
|
|
190
201
|
const originalFee = Number(fee.amount) + Number(fee.discountAmount || 0);
|
|
191
202
|
dispatch({
|
|
192
203
|
type: STUDENT_FEE_ACTION_TYPES.SET_FORM_DATA,
|
|
193
204
|
payload: {
|
|
194
205
|
form: Object.assign(Object.assign({}, fee), { dueDate,
|
|
206
|
+
paidAt,
|
|
195
207
|
originalFee, filterEnabled: undefined, filterStatus: state.filterStatus }),
|
|
196
208
|
},
|
|
197
209
|
});
|
|
@@ -375,10 +387,17 @@ export const useStudentFeeModule = () => {
|
|
|
375
387
|
: validatedPaid >= totalAmount
|
|
376
388
|
? PAYMENT_STATUS.PAID
|
|
377
389
|
: PAYMENT_STATUS.PARTIAL;
|
|
390
|
+
const today = new Date();
|
|
391
|
+
const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, "0")}-${String(today.getDate()).padStart(2, "0")}`;
|
|
392
|
+
const newPaidAt = newStatus === PAYMENT_STATUS.PAID ? todayStr : null;
|
|
378
393
|
dispatch({
|
|
379
394
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
380
395
|
payload: { key: "status", value: newStatus },
|
|
381
396
|
});
|
|
397
|
+
dispatch({
|
|
398
|
+
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
399
|
+
payload: { key: "paidAt", value: newPaidAt },
|
|
400
|
+
});
|
|
382
401
|
}
|
|
383
402
|
if (field === "amount" && typeof value === "number") {
|
|
384
403
|
const amountPaid = Number(currentState.amountPaid) || 0;
|
|
@@ -569,7 +588,7 @@ export const useStudentFeeModule = () => {
|
|
|
569
588
|
},
|
|
570
589
|
});
|
|
571
590
|
}, [dispatch, updateParams, t, showToast, updateFetchNow]);
|
|
572
|
-
const handleSubmitSingleEntry = useCallback(async (fees, amountPaid, remarks) => {
|
|
591
|
+
const handleSubmitSingleEntry = useCallback(async (fees, amountPaid, remarks, paidAt) => {
|
|
573
592
|
var _a, _b;
|
|
574
593
|
console.log("Submitting single entry fees:", fees);
|
|
575
594
|
dispatch({
|
|
@@ -584,6 +603,7 @@ export const useStudentFeeModule = () => {
|
|
|
584
603
|
body: JSON.stringify({
|
|
585
604
|
studentFees: fees.studentFees,
|
|
586
605
|
amountPaid: Number(amountPaid),
|
|
606
|
+
paidAt: paidAt || null,
|
|
587
607
|
remarks,
|
|
588
608
|
schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "",
|
|
589
609
|
}),
|
|
@@ -24,7 +24,7 @@ import { getTranslatedError } from "../../utils/get-translated-error";
|
|
|
24
24
|
export const StudentFeeForm = () => {
|
|
25
25
|
var _a, _b, _c, _d, _e;
|
|
26
26
|
const { state, handleChange } = useStudentFeeModule();
|
|
27
|
-
const { amount, amountDue, amountPaid, discountAmount, discountCodeId, dueDate, enabled, errors, feeStructureId, remarks, status, studentProfileId, } = state;
|
|
27
|
+
const { amount, amountDue, amountPaid, discountAmount, discountCodeId, dueDate, enabled, errors, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
|
|
28
28
|
const workspace = getCachedWorkspaceSync();
|
|
29
29
|
const currency = (_b = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency) !== null && _b !== void 0 ? _b : "";
|
|
30
30
|
const t = useTranslations("studentFee");
|
|
@@ -152,5 +152,5 @@ export const StudentFeeForm = () => {
|
|
|
152
152
|
},
|
|
153
153
|
value: status,
|
|
154
154
|
});
|
|
155
|
-
return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [studentProfileIdCombo, feeStructureIdCombo, discountCodeIdCombo, _jsx(EnhancedInput, { error: errors.discountAmount, id: "discountAmount", info: t("formDiscountAmountInfo"), label: t("formDiscountAmountLabel"), min: "0", onChange: (e) => handleChange("discountAmount", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: discountAmount || 0 }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "amount", t }), id: "amount", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), min: "0", onChange: (e) => handleChange("amount", Number(e.target.value)), placeholder: "0.00", required: true, step: "0.01", type: "number", value: amount }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "amountPaid", t }), id: "amountPaid", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), min: "0", required: true, onChange: (e) => handleChange("amountPaid", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: amountPaid }), _jsx(EnhancedInput, { disabled: true, error: getTranslatedError({ errors, key: "amountDue", t }), id: "amountDue", info: t("formAmountDueInfo"), label: t("formAmountDueLabel"), min: "0", required: true, onChange: (e) => handleChange("amountDue", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: amountDue }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "dueDate", t }), id: "dueDate", info: t("formDueDateInfo"), label: t("formDueDateLabel"), onChange: (e) => handleChange("dueDate", e.target.value), required: true, type: "date", value: dueDate || "" }), statusCombo, _jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "remarks", t }), id: "remarks", label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), value: remarks || "" }), _jsx(EnhancedCheckbox, { checked: enabled, error: getTranslatedError({ errors, key: "enabled", t }), id: "enabled", info: t("formEnabledInfo"), label: t("formEnabledLabel"), onCheckedChange: (checked) => handleChange("enabled", !!checked) })] }));
|
|
155
|
+
return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [studentProfileIdCombo, feeStructureIdCombo, discountCodeIdCombo, _jsx(EnhancedInput, { error: errors.discountAmount, id: "discountAmount", info: t("formDiscountAmountInfo"), label: t("formDiscountAmountLabel"), min: "0", onChange: (e) => handleChange("discountAmount", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: discountAmount || 0 }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "amount", t }), id: "amount", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), min: "0", onChange: (e) => handleChange("amount", Number(e.target.value)), placeholder: "0.00", required: true, step: "0.01", type: "number", value: amount }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "amountPaid", t }), id: "amountPaid", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), min: "0", required: true, onChange: (e) => handleChange("amountPaid", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: amountPaid }), _jsx(EnhancedInput, { disabled: true, error: getTranslatedError({ errors, key: "amountDue", t }), id: "amountDue", info: t("formAmountDueInfo"), label: t("formAmountDueLabel"), min: "0", required: true, onChange: (e) => handleChange("amountDue", Number(e.target.value)), placeholder: "0.00", step: "0.01", type: "number", value: amountDue }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "dueDate", t }), id: "dueDate", info: t("formDueDateInfo"), label: t("formDueDateLabel"), onChange: (e) => handleChange("dueDate", e.target.value), required: true, type: "date", value: dueDate || "" }), _jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "paidAt", t }), id: "paidAt", info: t("formPaidAtInfo"), label: t("formPaidAtLabel"), onChange: (e) => handleChange("paidAt", e.target.value), type: "date", value: paidAt || "" }), statusCombo, _jsx(EnhancedTextarea, { error: getTranslatedError({ errors, key: "remarks", t }), id: "remarks", label: t("formRemarksLabel"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("formRemarksPlaceholder"), value: remarks || "" }), _jsx(EnhancedCheckbox, { checked: enabled, error: getTranslatedError({ errors, key: "enabled", t }), id: "enabled", info: t("formEnabledInfo"), label: t("formEnabledLabel"), onCheckedChange: (checked) => handleChange("enabled", !!checked) })] }));
|
|
156
156
|
};
|
|
@@ -56,8 +56,10 @@ interface SingleEntryStudentFeeFormProps {
|
|
|
56
56
|
feeByComputerNumber: StudentFeeByCNResponse | null;
|
|
57
57
|
fetchByComputerNumber: (url: string | undefined, options: object) => void;
|
|
58
58
|
fetchingByCN: boolean;
|
|
59
|
+
paidAt: string;
|
|
59
60
|
remarks: string;
|
|
60
61
|
setAmountPaid: (value: string) => void;
|
|
62
|
+
setPaidAt: (value: string) => void;
|
|
61
63
|
setRemarks: (value: string) => void;
|
|
62
64
|
}
|
|
63
65
|
export declare const SingleEntryStudentFeeForm: FC<SingleEntryStudentFeeFormProps>;
|
|
@@ -9,7 +9,7 @@ import { DISCOUNT_TYPE } from "../../type";
|
|
|
9
9
|
import { useTranslations } from "next-intl";
|
|
10
10
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
11
11
|
import { Loader2 } from "lucide-react";
|
|
12
|
-
export const SingleEntryStudentFeeForm = ({ amountPaid, feeByComputerNumber, fetchByComputerNumber, fetchingByCN, remarks, setAmountPaid, setRemarks, }) => {
|
|
12
|
+
export const SingleEntryStudentFeeForm = ({ amountPaid, feeByComputerNumber, fetchByComputerNumber, fetchingByCN, paidAt, remarks, setAmountPaid, setPaidAt, setRemarks, }) => {
|
|
13
13
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
14
|
const { dispatch } = useStudentFeeModule();
|
|
15
15
|
const workspace = getCachedWorkspaceSync();
|
|
@@ -99,5 +99,5 @@ export const SingleEntryStudentFeeForm = ({ amountPaid, feeByComputerNumber, fet
|
|
|
99
99
|
}, [fee, accumulatedFine, accumulatedAmount, setAmountPaid]);
|
|
100
100
|
return (_jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { id: "computerNumber", info: t("formComputerNumberInfo"), label: t("formComputerNumberLabel"), onChange: (e) => setComputerNumber(e.target.value), placeholder: t("formComputerNumberPlaceholder"), type: "number", required: true, value: computerNumber }), fetchingByCN && debouncedComputerNumber ? (_jsx("div", { className: "flex items-center justify-center py-4", children: _jsx(Loader2, { className: "text-muted-foreground h-5 w-5 animate-spin" }) })) : null, fee && profile ? (_jsxs(_Fragment, { children: [_jsx(EnhancedInput, { readOnly: true, id: "studentProfileId-readonly", label: t("formStudentLabel"), value: studentName }), _jsx(EnhancedInput, { readOnly: true, id: "feeStructureId-readonly", label: t("formFeeStructureLabel"), value: feeStructureName }), _jsx(EnhancedInput, { readOnly: true, id: "discountCodeId-readonly", label: t("formDiscountCodeLabel"), value: discountCodeLabel }), _jsx(EnhancedInput, { readOnly: true, id: "discountAmount-readonly", label: t("formDiscountAmountLabel"), value: (_h = fee === null || fee === void 0 ? void 0 : fee.discountAmount) !== null && _h !== void 0 ? _h : 0, type: "number", step: "0.01" }), _jsx(EnhancedInput, { readOnly: true, id: "accumulatedFine-readonly", info: t("formAccumulatedFineInfo"), label: t("formAccumulatedFineLabel"), value: accumulatedFine, type: "number", step: "0.01" }), _jsx(EnhancedInput, { readOnly: true, id: "amount-readonly", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), value: accumulatedAmount + (accumulatedFine !== null && accumulatedFine !== void 0 ? accumulatedFine : 0), type: "number", step: "0.01" }), _jsx(EnhancedInput, { id: "amountPaid", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), value: accumulatedAmount + (accumulatedFine !== null && accumulatedFine !== void 0 ? accumulatedFine : 0) - fee.amountPaid || "0", onChange: (e) => handleUpdateAmountPaid(e.target.value), type: "number", step: "0.01" }), _jsx(EnhancedInput, { readOnly: true, id: "amountDue-readonly", info: t("formAmountDueInfo"), label: t("formAmountDueLabel"), value: (accumulatedAmount !== null && accumulatedAmount !== void 0 ? accumulatedAmount : 0) +
|
|
101
101
|
(accumulatedFine !== null && accumulatedFine !== void 0 ? accumulatedFine : 0) -
|
|
102
|
-
parseFloat(amountPaid || "0"), type: "number", step: "0.01" }), _jsx(EnhancedInput, { readOnly: true, id: "dueDate-readonly", label: t("formDueDateLabel"), value: formatDisplayDate(fee === null || fee === void 0 ? void 0 : fee.dueDate), type: "date" }), _jsx(EnhancedInput, { readOnly: true, id: "status-readonly", label: t("formStatusLabel"), value: statusDisplay }), _jsx(EnhancedTextarea, { id: "remarks-readonly", label: t("formRemarksLabel"), value: remarks || "", onChange: (e) => setRemarks(e.target.value) })] })) : null] }));
|
|
102
|
+
parseFloat(amountPaid || "0"), type: "number", step: "0.01" }), _jsx(EnhancedInput, { readOnly: true, id: "dueDate-readonly", label: t("formDueDateLabel"), value: formatDisplayDate(fee === null || fee === void 0 ? void 0 : fee.dueDate), type: "date" }), _jsx(EnhancedInput, { id: "paidAt", info: t("formPaidAtInfo"), label: t("formPaidAtLabel"), onChange: (e) => setPaidAt(e.target.value), type: "date", value: paidAt || "" }), _jsx(EnhancedInput, { readOnly: true, id: "status-readonly", label: t("formStatusLabel"), value: statusDisplay }), _jsx(EnhancedTextarea, { id: "remarks-readonly", label: t("formRemarksLabel"), value: remarks || "", onChange: (e) => setRemarks(e.target.value) })] })) : null] }));
|
|
103
103
|
};
|
|
@@ -13,6 +13,10 @@ import { useState } from "react";
|
|
|
13
13
|
export const StudentFeeSingleEntry = () => {
|
|
14
14
|
const { closeDrawer, handleSubmitSingleEntry, state, updateLoading } = useStudentFeeModule();
|
|
15
15
|
const [amountPaid, setAmountPaid] = useState("");
|
|
16
|
+
const [paidAt, setPaidAt] = useState(() => {
|
|
17
|
+
const d = new Date();
|
|
18
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
19
|
+
});
|
|
16
20
|
const [remarks, setRemarks] = useState("");
|
|
17
21
|
const t = useTranslations("studentFee");
|
|
18
22
|
const { disableSaveButton, drawer, errors } = state;
|
|
@@ -20,5 +24,5 @@ export const StudentFeeSingleEntry = () => {
|
|
|
20
24
|
const { fetchNow: fetchByComputerNumber, data: feeByComputerNumber, loading: fetchingByCN, } = useFetch(STUDENT_FEE_API_ROUTES.BY_COMPUTER_NUMBER, {
|
|
21
25
|
method: API_METHODS.GET,
|
|
22
26
|
});
|
|
23
|
-
return (_jsx(DrawerGeneric, { filterDrawer: null, filterDrawerHeader: null, filterDrawerFooter: null, formDrawer: isOpen ? (_jsx(SingleEntryStudentFeeForm, { amountPaid: amountPaid, feeByComputerNumber: feeByComputerNumber, fetchByComputerNumber: fetchByComputerNumber, fetchingByCN: fetchingByCN, remarks: remarks, setAmountPaid: setAmountPaid, setRemarks: setRemarks })) : null, formDrawerHeader: isOpen ? (_jsx(EnhancedDrawerHeader, { title: t("drawerSingleEntryTitle"), description: t("drawerSingleEntryDescription") })) : null, formDrawerFooter: isOpen ? (_jsx(EnhancedDrawerFooter, { applyFilters: () => { }, clearFilters: () => { }, closeDrawer: closeDrawer, disableSaveButton: disableSaveButton, drawerType: DRAWER_FOOTER_COMPONENT_TYPE.FORM_DRAWER, errors: errors, handleSubmit: () => handleSubmitSingleEntry(feeByComputerNumber, amountPaid, remarks), updateLoading: updateLoading })) : null, viewDrawer: null, viewDrawerHeader: null, viewDrawerFooter: null, moreActionsDrawer: null, moreActionsDrawerHeader: null, moreActionsDrawerFooter: null, onOpenChange: (open) => !open && closeDrawer(), open: isOpen }));
|
|
27
|
+
return (_jsx(DrawerGeneric, { filterDrawer: null, filterDrawerHeader: null, filterDrawerFooter: null, formDrawer: isOpen ? (_jsx(SingleEntryStudentFeeForm, { amountPaid: amountPaid, feeByComputerNumber: feeByComputerNumber, fetchByComputerNumber: fetchByComputerNumber, fetchingByCN: fetchingByCN, paidAt: paidAt, remarks: remarks, setAmountPaid: setAmountPaid, setPaidAt: setPaidAt, setRemarks: setRemarks })) : null, formDrawerHeader: isOpen ? (_jsx(EnhancedDrawerHeader, { title: t("drawerSingleEntryTitle"), description: t("drawerSingleEntryDescription") })) : null, formDrawerFooter: isOpen ? (_jsx(EnhancedDrawerFooter, { applyFilters: () => { }, clearFilters: () => { }, closeDrawer: closeDrawer, disableSaveButton: disableSaveButton, drawerType: DRAWER_FOOTER_COMPONENT_TYPE.FORM_DRAWER, errors: errors, handleSubmit: () => handleSubmitSingleEntry(feeByComputerNumber, amountPaid, remarks, paidAt), updateLoading: updateLoading })) : null, viewDrawer: null, viewDrawerHeader: null, viewDrawerFooter: null, moreActionsDrawer: null, moreActionsDrawerHeader: null, moreActionsDrawerFooter: null, onOpenChange: (open) => !open && closeDrawer(), open: isOpen }));
|
|
24
28
|
};
|
|
@@ -24,6 +24,7 @@ export declare const studentFeeFormValidation: z.ZodObject<{
|
|
|
24
24
|
amountDue: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
dueDate: z.ZodString;
|
|
26
26
|
status: z.ZodEnum<typeof PAYMENT_STATUS>;
|
|
27
|
+
paidAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
27
28
|
remarks: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
28
29
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
29
30
|
}, z.core.$strip>;
|
|
@@ -29,6 +29,7 @@ export const studentFeeFormValidation = z.object({
|
|
|
29
29
|
status: z.nativeEnum(PAYMENT_STATUS, {
|
|
30
30
|
error: VALIDATION_KEYS.statusInvalid,
|
|
31
31
|
}),
|
|
32
|
+
paidAt: z.string().optional().nullable(),
|
|
32
33
|
remarks: z.string().optional().nullable(),
|
|
33
34
|
enabled: z.boolean().optional(),
|
|
34
35
|
});
|
|
@@ -14,7 +14,7 @@ import { useTranslations } from "next-intl";
|
|
|
14
14
|
export const StudentFeeView = () => {
|
|
15
15
|
var _a, _b, _c;
|
|
16
16
|
const { state } = useStudentFeeModule();
|
|
17
|
-
const { amount, amountDue, amountPaid, dueDate, enabled, feeStructureId, remarks, status, studentProfileId, } = state;
|
|
17
|
+
const { amount, amountDue, amountPaid, dueDate, enabled, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
|
|
18
18
|
const workspace = getCachedWorkspaceSync();
|
|
19
19
|
const currency = (_b = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency) !== null && _b !== void 0 ? _b : "";
|
|
20
20
|
const t = useTranslations("studentFee");
|
|
@@ -30,5 +30,5 @@ export const StudentFeeView = () => {
|
|
|
30
30
|
? `${studentProfile.firstName} ${studentProfile.lastName}`
|
|
31
31
|
: "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldComputerNumber") }), _jsx("p", { className: "text-base", children: ((_c = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) !== null && _c !== void 0 ? _c : "").split(":")[1] ||
|
|
32
32
|
(studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.computerNumber) ||
|
|
33
|
-
"—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] })] }) })] }) }));
|
|
33
|
+
"—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formFeeStructureLabel") }), _jsx("p", { className: "text-base", children: (feeStructure === null || feeStructure === void 0 ? void 0 : feeStructure.name) || "—" })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formTotalAmountLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amount !== null && amount !== void 0 ? amount : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountPaidLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountPaid !== null && amountPaid !== void 0 ? amountPaid : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formAmountDueLabel") }), _jsxs("p", { className: "text-base", children: [currency, " ", (amountDue !== null && amountDue !== void 0 ? amountDue : 0).toFixed(2)] })] }), _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Calendar, { className: "text-muted-foreground h-4 w-4" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formDueDateLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(dueDate, DATE_FORMATS.LOCALE_DATE) })] }), paidAt && (_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("formPaidAtLabel") })] }), _jsx("p", { className: "text-base", children: formatDate(paidAt, DATE_FORMATS.LOCALE_DATE) })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formStatusLabel") }), _jsx(Badge, { variant: "secondary", children: status || "—" })] }), remarks && (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formRemarksLabel") }), _jsx("p", { className: "text-base", children: remarks })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldRecordState") }), _jsxs(Badge, { className: "gap-1", variant: enabled ? "default" : "destructive", children: [enabled ? (_jsx(CheckCircle2, { className: "h-3 w-3" })) : (_jsx(XCircle, { className: "h-3 w-3" })), enabled ? t("badgeActive") : t("badgeInactive")] })] })] }) })] }) }));
|
|
34
34
|
};
|