@appcorp/fusion-storybook 0.3.83 → 0.3.85
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/use-student-fee-module.js +16 -19
- package/base-modules/student-fee/filter.js +17 -2
- package/base-modules/student-fee/page.js +0 -2
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/base-modules/student-fee/monthly-create.d.ts +0 -0
- package/base-modules/student-fee/monthly-create.js +0 -56
- package/base-modules/student-fee/monthly-form.d.ts +0 -0
- package/base-modules/student-fee/monthly-form.js +0 -49
- package/base-modules/student-fee/single-entry-form.d.ts +0 -0
- package/base-modules/student-fee/single-entry-form.js +0 -274
- package/base-modules/student-fee/single-entry.d.ts +0 -0
- package/base-modules/student-fee/single-entry.js +0 -94
|
File without changes
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// "use client";
|
|
3
|
-
// import { EnhancedDrawerHeader } from "@appcorp/shadcn/components/enhanced-drawer-header";
|
|
4
|
-
// import {
|
|
5
|
-
// EnhancedDrawerFooter,
|
|
6
|
-
// DRAWER_FOOTER_COMPONENT_TYPE,
|
|
7
|
-
// } from "@appcorp/shadcn/components/enhanced-drawer-footer";
|
|
8
|
-
// import { DrawerGeneric } from "@appcorp/shadcn/components/drawer-generic";
|
|
9
|
-
// import { useStudentFeeModule, STUDENT_FEE_DRAWER } from "./context";
|
|
10
|
-
// import { useTranslations } from "next-intl";
|
|
11
|
-
// import { StudentFeeMonthlyForm } from "./monthly-form";
|
|
12
|
-
// export const StudentFeeCreateMonthly = () => {
|
|
13
|
-
// const { closeDrawer, handleProceedMonthlyCreation, state, updateLoading } =
|
|
14
|
-
// useStudentFeeModule();
|
|
15
|
-
// const t = useTranslations("studentFee");
|
|
16
|
-
// const { disableSaveButton, drawer, errors } = state;
|
|
17
|
-
// const isOpen = drawer === STUDENT_FEE_DRAWER.MISC_DRAWER_1;
|
|
18
|
-
// return (
|
|
19
|
-
// <DrawerGeneric
|
|
20
|
-
// filterDrawer={null}
|
|
21
|
-
// filterDrawerHeader={null}
|
|
22
|
-
// filterDrawerFooter={null}
|
|
23
|
-
// formDrawer={isOpen ? <StudentFeeMonthlyForm /> : null}
|
|
24
|
-
// formDrawerHeader={
|
|
25
|
-
// isOpen ? (
|
|
26
|
-
// <EnhancedDrawerHeader
|
|
27
|
-
// title={t("drawerCreateMonthlyTitle")}
|
|
28
|
-
// description={t("drawerCreateMonthlyDescription")}
|
|
29
|
-
// />
|
|
30
|
-
// ) : null
|
|
31
|
-
// }
|
|
32
|
-
// formDrawerFooter={
|
|
33
|
-
// isOpen ? (
|
|
34
|
-
// <EnhancedDrawerFooter
|
|
35
|
-
// applyFilters={() => {}}
|
|
36
|
-
// clearFilters={() => {}}
|
|
37
|
-
// closeDrawer={closeDrawer}
|
|
38
|
-
// disableSaveButton={disableSaveButton}
|
|
39
|
-
// drawerType={DRAWER_FOOTER_COMPONENT_TYPE.FORM_DRAWER}
|
|
40
|
-
// errors={errors}
|
|
41
|
-
// handleSubmit={handleProceedMonthlyCreation}
|
|
42
|
-
// updateLoading={updateLoading}
|
|
43
|
-
// />
|
|
44
|
-
// ) : null
|
|
45
|
-
// }
|
|
46
|
-
// viewDrawer={null}
|
|
47
|
-
// viewDrawerHeader={null}
|
|
48
|
-
// viewDrawerFooter={null}
|
|
49
|
-
// moreActionsDrawer={null}
|
|
50
|
-
// moreActionsDrawerHeader={null}
|
|
51
|
-
// moreActionsDrawerFooter={null}
|
|
52
|
-
// onOpenChange={(open: boolean) => !open && closeDrawer()}
|
|
53
|
-
// open={isOpen}
|
|
54
|
-
// />
|
|
55
|
-
// );
|
|
56
|
-
// };
|
|
File without changes
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// "use client";
|
|
3
|
-
// import { useCallback, useState } from "react";
|
|
4
|
-
// import { useTranslations } from "next-intl";
|
|
5
|
-
// import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
6
|
-
// import { useStudentFeeModule, STUDENT_FEE_ACTION_TYPES } from "./context";
|
|
7
|
-
// const CHECKBOX_KEYS = [
|
|
8
|
-
// "formMonthlyCheckStudentProfile",
|
|
9
|
-
// "formMonthlyCheckFeeStructure",
|
|
10
|
-
// "formMonthlyCheckGmail",
|
|
11
|
-
// "formMonthlyCheckReady",
|
|
12
|
-
// ] as const;
|
|
13
|
-
// export const StudentFeeMonthlyForm = () => {
|
|
14
|
-
// const t = useTranslations("studentFee");
|
|
15
|
-
// const { dispatch } = useStudentFeeModule();
|
|
16
|
-
// const [checked, setChecked] = useState<Record<string, boolean>>(
|
|
17
|
-
// Object.fromEntries(CHECKBOX_KEYS.map((key) => [key, false]))
|
|
18
|
-
// );
|
|
19
|
-
// // const allChecked = CHECKBOX_KEYS.every((key) => checked[key]);
|
|
20
|
-
// const handleCheckChange = useCallback(
|
|
21
|
-
// (key: string, value: boolean) => {
|
|
22
|
-
// const next = { ...checked, [key]: value };
|
|
23
|
-
// setChecked(next);
|
|
24
|
-
// dispatch({
|
|
25
|
-
// type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
26
|
-
// payload: { disabled: !CHECKBOX_KEYS.every((k) => next[k]) },
|
|
27
|
-
// });
|
|
28
|
-
// },
|
|
29
|
-
// [checked, dispatch]
|
|
30
|
-
// );
|
|
31
|
-
// return (
|
|
32
|
-
// <div className="grid grid-cols-1 gap-4">
|
|
33
|
-
// <p className="text-foreground text-sm">
|
|
34
|
-
// {t("formMonthlyWarningMessage")}
|
|
35
|
-
// </p>
|
|
36
|
-
// <div className="flex flex-col gap-3">
|
|
37
|
-
// {CHECKBOX_KEYS.map((key) => (
|
|
38
|
-
// <EnhancedCheckbox
|
|
39
|
-
// key={key}
|
|
40
|
-
// checked={checked[key]}
|
|
41
|
-
// id={key}
|
|
42
|
-
// label={t(key)}
|
|
43
|
-
// onCheckedChange={(value: boolean) => handleCheckChange(key, value)}
|
|
44
|
-
// />
|
|
45
|
-
// ))}
|
|
46
|
-
// </div>
|
|
47
|
-
// </div>
|
|
48
|
-
// );
|
|
49
|
-
// };
|
|
File without changes
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// "use client";
|
|
3
|
-
// import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
4
|
-
// import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
5
|
-
// import { FC, useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
-
// import { useStudentFeeModule, STUDENT_FEE_ACTION_TYPES } from "./context";
|
|
7
|
-
// import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
8
|
-
// import { DISCOUNT_TYPE, PAYMENT_STATUS } from "../../type";
|
|
9
|
-
// import { useTranslations } from "next-intl";
|
|
10
|
-
// import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
11
|
-
// import { Loader2 } from "lucide-react";
|
|
12
|
-
// interface StudentProfileSummary {
|
|
13
|
-
// id: string;
|
|
14
|
-
// computerNumber: string;
|
|
15
|
-
// firstName: string;
|
|
16
|
-
// lastName: string;
|
|
17
|
-
// status: string;
|
|
18
|
-
// }
|
|
19
|
-
// interface FeeRecordSummary {
|
|
20
|
-
// amount: number;
|
|
21
|
-
// amountDue: number;
|
|
22
|
-
// amountPaid: number;
|
|
23
|
-
// createdAt: string;
|
|
24
|
-
// discountAmount: number | null;
|
|
25
|
-
// discountCodeId: string | null;
|
|
26
|
-
// dueDate: string;
|
|
27
|
-
// enabled: boolean;
|
|
28
|
-
// familyId: string;
|
|
29
|
-
// feeStructureId: string;
|
|
30
|
-
// fine?: number | null;
|
|
31
|
-
// id: string;
|
|
32
|
-
// lastRemindedAt: string | null;
|
|
33
|
-
// paidAt?: Date | string | null;
|
|
34
|
-
// nextFollowUpAt: string | null;
|
|
35
|
-
// reliabilityScore: number | null;
|
|
36
|
-
// remarks: string | null;
|
|
37
|
-
// riskLevel: string | null;
|
|
38
|
-
// schoolId: string;
|
|
39
|
-
// status: PAYMENT_STATUS;
|
|
40
|
-
// studentProfileId: string;
|
|
41
|
-
// updatedAt: string;
|
|
42
|
-
// family: { address: string; city: string; country: string; id: string } | null;
|
|
43
|
-
// feeStructure: { name: string; amount: number; id: string } | null;
|
|
44
|
-
// discountCode: {
|
|
45
|
-
// code: string;
|
|
46
|
-
// discountValue: number;
|
|
47
|
-
// discountType: DISCOUNT_TYPE;
|
|
48
|
-
// } | null;
|
|
49
|
-
// }
|
|
50
|
-
// interface StudentFeeByCNResponse {
|
|
51
|
-
// studentProfile: StudentProfileSummary;
|
|
52
|
-
// studentFees: FeeRecordSummary[];
|
|
53
|
-
// }
|
|
54
|
-
// interface SingleEntryStudentFeeFormProps {
|
|
55
|
-
// amountPaid: string;
|
|
56
|
-
// feeByComputerNumber: StudentFeeByCNResponse | null;
|
|
57
|
-
// fetchByComputerNumber: (url: string | undefined, options: object) => void;
|
|
58
|
-
// fetchingByCN: boolean;
|
|
59
|
-
// paidAt: string;
|
|
60
|
-
// remarks: string;
|
|
61
|
-
// setAmountPaid: (value: string) => void;
|
|
62
|
-
// setPaidAt: (value: string) => void;
|
|
63
|
-
// setRemarks: (value: string) => void;
|
|
64
|
-
// }
|
|
65
|
-
// export const SingleEntryStudentFeeForm: FC<SingleEntryStudentFeeFormProps> = ({
|
|
66
|
-
// amountPaid,
|
|
67
|
-
// feeByComputerNumber,
|
|
68
|
-
// fetchByComputerNumber,
|
|
69
|
-
// fetchingByCN,
|
|
70
|
-
// paidAt,
|
|
71
|
-
// remarks,
|
|
72
|
-
// setAmountPaid,
|
|
73
|
-
// setPaidAt,
|
|
74
|
-
// setRemarks,
|
|
75
|
-
// }) => {
|
|
76
|
-
// const { dispatch } = useStudentFeeModule();
|
|
77
|
-
// const workspace = getCachedWorkspaceSync();
|
|
78
|
-
// const currency = workspace?.school?.currency ?? "";
|
|
79
|
-
// const t = useTranslations("studentFee");
|
|
80
|
-
// // const [amountPaid, setAmountPaid] = useState("");
|
|
81
|
-
// // const [remarks, setRemarks] = useState("");
|
|
82
|
-
// const [computerNumber, setComputerNumber] = useState("");
|
|
83
|
-
// const debouncedComputerNumber = useDebounce(computerNumber, 800);
|
|
84
|
-
// const fetchByCNRef = useRef(fetchByComputerNumber);
|
|
85
|
-
// useEffect(() => {
|
|
86
|
-
// fetchByCNRef.current = fetchByComputerNumber;
|
|
87
|
-
// }, [fetchByComputerNumber]);
|
|
88
|
-
// useEffect(() => {
|
|
89
|
-
// if (!debouncedComputerNumber) return;
|
|
90
|
-
// fetchByCNRef.current(undefined, {
|
|
91
|
-
// params: {
|
|
92
|
-
// computerNumber: debouncedComputerNumber,
|
|
93
|
-
// schoolId: workspace?.school?.id,
|
|
94
|
-
// },
|
|
95
|
-
// });
|
|
96
|
-
// }, [debouncedComputerNumber, workspace?.school?.id]);
|
|
97
|
-
// const isStale = computerNumber !== debouncedComputerNumber;
|
|
98
|
-
// const hasData =
|
|
99
|
-
// !!feeByComputerNumber &&
|
|
100
|
-
// !!debouncedComputerNumber &&
|
|
101
|
-
// !isStale &&
|
|
102
|
-
// !fetchingByCN;
|
|
103
|
-
// const response = hasData
|
|
104
|
-
// ? (feeByComputerNumber as StudentFeeByCNResponse)
|
|
105
|
-
// : null;
|
|
106
|
-
// const profile = response?.studentProfile ?? null;
|
|
107
|
-
// const fee = response?.studentFees?.[0] ?? null;
|
|
108
|
-
// useEffect(() => {
|
|
109
|
-
// dispatch({
|
|
110
|
-
// type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
111
|
-
// payload: { disabled: false },
|
|
112
|
-
// });
|
|
113
|
-
// }, [fee, dispatch]);
|
|
114
|
-
// const paymentStatusLabelMap: Record<string, string> = {
|
|
115
|
-
// PENDING: t("formOptionPending"),
|
|
116
|
-
// PARTIAL: t("formOptionPartial"),
|
|
117
|
-
// PAID: t("formOptionPaid"),
|
|
118
|
-
// OVERDUE: t("formOptionOverdue"),
|
|
119
|
-
// CANCELLED: t("formOptionCancelled"),
|
|
120
|
-
// REFUNDED: t("formOptionRefunded"),
|
|
121
|
-
// };
|
|
122
|
-
// const studentName = profile
|
|
123
|
-
// ? `${profile.firstName} ${profile.lastName}`.trim() || profile.id
|
|
124
|
-
// : "";
|
|
125
|
-
// const feeStructureName = fee?.feeStructure?.name || fee?.feeStructureId || "";
|
|
126
|
-
// const discountCodeLabel = fee?.discountCode
|
|
127
|
-
// ? `${fee.discountCode.code} - ${fee.discountCode.discountValue}${fee.discountCode.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`
|
|
128
|
-
// : fee?.discountCodeId || "";
|
|
129
|
-
// const statusDisplay = fee?.status
|
|
130
|
-
// ? paymentStatusLabelMap[fee.status] || fee.status
|
|
131
|
-
// : "";
|
|
132
|
-
// const formatDisplayDate = (rawDate: string | undefined | null): string => {
|
|
133
|
-
// if (!rawDate) return "";
|
|
134
|
-
// const d = new Date(rawDate);
|
|
135
|
-
// return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
136
|
-
// };
|
|
137
|
-
// const accumulatedAmount = useMemo(() => {
|
|
138
|
-
// if (!response?.studentFees?.length) return 0;
|
|
139
|
-
// return response.studentFees.reduce((sum, f) => sum + (f.amount ?? 0), 0);
|
|
140
|
-
// }, [response]);
|
|
141
|
-
// const accumulatedFine = useMemo(() => {
|
|
142
|
-
// if (!response?.studentFees?.length) return 0;
|
|
143
|
-
// return response.studentFees.reduce((sum, f) => sum + (f.fine ?? 0), 0);
|
|
144
|
-
// }, [response]);
|
|
145
|
-
// const handleUpdateAmountPaid = (value: string) => {
|
|
146
|
-
// const amountPaid = parseFloat(value);
|
|
147
|
-
// if (isNaN(amountPaid)) return;
|
|
148
|
-
// setAmountPaid(value);
|
|
149
|
-
// };
|
|
150
|
-
// useEffect(() => {
|
|
151
|
-
// (async () => {
|
|
152
|
-
// setAmountPaid(String((accumulatedAmount ?? 0) + (accumulatedFine ?? 0)));
|
|
153
|
-
// })();
|
|
154
|
-
// }, [fee, accumulatedFine, accumulatedAmount, setAmountPaid]);
|
|
155
|
-
// return (
|
|
156
|
-
// <div className="grid grid-cols-1 gap-4">
|
|
157
|
-
// <EnhancedInput
|
|
158
|
-
// id="computerNumber"
|
|
159
|
-
// info={t("formComputerNumberInfo")}
|
|
160
|
-
// label={t("formComputerNumberLabel")}
|
|
161
|
-
// onChange={(e) => setComputerNumber(e.target.value)}
|
|
162
|
-
// placeholder={t("formComputerNumberPlaceholder")}
|
|
163
|
-
// type="number"
|
|
164
|
-
// required
|
|
165
|
-
// value={computerNumber}
|
|
166
|
-
// />
|
|
167
|
-
// {fetchingByCN && debouncedComputerNumber ? (
|
|
168
|
-
// <div className="flex items-center justify-center py-4">
|
|
169
|
-
// <Loader2 className="text-muted-foreground h-5 w-5 animate-spin" />
|
|
170
|
-
// </div>
|
|
171
|
-
// ) : null}
|
|
172
|
-
// {fee && profile ? (
|
|
173
|
-
// <>
|
|
174
|
-
// <EnhancedInput
|
|
175
|
-
// readOnly
|
|
176
|
-
// id="studentProfileId-readonly"
|
|
177
|
-
// label={t("formStudentLabel")}
|
|
178
|
-
// value={studentName}
|
|
179
|
-
// />
|
|
180
|
-
// <EnhancedInput
|
|
181
|
-
// readOnly
|
|
182
|
-
// id="feeStructureId-readonly"
|
|
183
|
-
// label={t("formFeeStructureLabel")}
|
|
184
|
-
// value={feeStructureName}
|
|
185
|
-
// />
|
|
186
|
-
// <EnhancedInput
|
|
187
|
-
// readOnly
|
|
188
|
-
// id="discountCodeId-readonly"
|
|
189
|
-
// label={t("formDiscountCodeLabel")}
|
|
190
|
-
// value={discountCodeLabel}
|
|
191
|
-
// />
|
|
192
|
-
// <EnhancedInput
|
|
193
|
-
// readOnly
|
|
194
|
-
// id="discountAmount-readonly"
|
|
195
|
-
// label={t("formDiscountAmountLabel")}
|
|
196
|
-
// value={fee?.discountAmount ?? 0}
|
|
197
|
-
// type="number"
|
|
198
|
-
// step="0.01"
|
|
199
|
-
// />
|
|
200
|
-
// <EnhancedInput
|
|
201
|
-
// readOnly
|
|
202
|
-
// id="accumulatedFine-readonly"
|
|
203
|
-
// info={t("formAccumulatedFineInfo")}
|
|
204
|
-
// label={t("formAccumulatedFineLabel")}
|
|
205
|
-
// value={accumulatedFine}
|
|
206
|
-
// type="number"
|
|
207
|
-
// step="0.01"
|
|
208
|
-
// />
|
|
209
|
-
// <EnhancedInput
|
|
210
|
-
// readOnly
|
|
211
|
-
// id="amount-readonly"
|
|
212
|
-
// info={t("formTotalAmountInfo")}
|
|
213
|
-
// label={t("formTotalAmountLabel")}
|
|
214
|
-
// value={accumulatedAmount + (accumulatedFine ?? 0)}
|
|
215
|
-
// type="number"
|
|
216
|
-
// step="0.01"
|
|
217
|
-
// />
|
|
218
|
-
// <EnhancedInput
|
|
219
|
-
// id="amountPaid"
|
|
220
|
-
// info={t("formAmountPaidInfo")}
|
|
221
|
-
// label={t("formAmountPaidLabel")}
|
|
222
|
-
// value={
|
|
223
|
-
// accumulatedAmount + (accumulatedFine ?? 0) - fee.amountPaid || "0"
|
|
224
|
-
// }
|
|
225
|
-
// onChange={(e) => handleUpdateAmountPaid(e.target.value)}
|
|
226
|
-
// type="number"
|
|
227
|
-
// step="0.01"
|
|
228
|
-
// />
|
|
229
|
-
// <EnhancedInput
|
|
230
|
-
// readOnly
|
|
231
|
-
// id="amountDue-readonly"
|
|
232
|
-
// info={t("formAmountDueInfo")}
|
|
233
|
-
// label={t("formAmountDueLabel")}
|
|
234
|
-
// value={
|
|
235
|
-
// (accumulatedAmount ?? 0) +
|
|
236
|
-
// (accumulatedFine ?? 0) -
|
|
237
|
-
// parseFloat(amountPaid || "0")
|
|
238
|
-
// }
|
|
239
|
-
// type="number"
|
|
240
|
-
// step="0.01"
|
|
241
|
-
// />
|
|
242
|
-
// <EnhancedInput
|
|
243
|
-
// readOnly
|
|
244
|
-
// id="dueDate-readonly"
|
|
245
|
-
// label={t("formDueDateLabel")}
|
|
246
|
-
// value={formatDisplayDate(fee?.dueDate)}
|
|
247
|
-
// type="date"
|
|
248
|
-
// />
|
|
249
|
-
// <EnhancedInput
|
|
250
|
-
// id="paidAt"
|
|
251
|
-
// info={t("formPaidAtInfo")}
|
|
252
|
-
// label={t("formPaidAtLabel")}
|
|
253
|
-
// onChange={(e) => setPaidAt(e.target.value)}
|
|
254
|
-
// onClick={(e) => e.currentTarget.showPicker?.()}
|
|
255
|
-
// type="date"
|
|
256
|
-
// value={paidAt || ""}
|
|
257
|
-
// />
|
|
258
|
-
// <EnhancedInput
|
|
259
|
-
// readOnly
|
|
260
|
-
// id="status-readonly"
|
|
261
|
-
// label={t("formStatusLabel")}
|
|
262
|
-
// value={statusDisplay}
|
|
263
|
-
// />
|
|
264
|
-
// <EnhancedTextarea
|
|
265
|
-
// id="remarks-readonly"
|
|
266
|
-
// label={t("formRemarksLabel")}
|
|
267
|
-
// value={remarks || ""}
|
|
268
|
-
// onChange={(e) => setRemarks(e.target.value)}
|
|
269
|
-
// />
|
|
270
|
-
// </>
|
|
271
|
-
// ) : null}
|
|
272
|
-
// </div>
|
|
273
|
-
// );
|
|
274
|
-
// };
|
|
File without changes
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// "use client";
|
|
3
|
-
// import { EnhancedDrawerHeader } from "@appcorp/shadcn/components/enhanced-drawer-header";
|
|
4
|
-
// import {
|
|
5
|
-
// EnhancedDrawerFooter,
|
|
6
|
-
// DRAWER_FOOTER_COMPONENT_TYPE,
|
|
7
|
-
// } from "@appcorp/shadcn/components/enhanced-drawer-footer";
|
|
8
|
-
// import { DrawerGeneric } from "@appcorp/shadcn/components/drawer-generic";
|
|
9
|
-
// import { useStudentFeeModule, STUDENT_FEE_DRAWER } from "./context";
|
|
10
|
-
// import { useTranslations } from "next-intl";
|
|
11
|
-
// import { SingleEntryStudentFeeForm } from "./single-entry-form";
|
|
12
|
-
// import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
13
|
-
// import { STUDENT_FEE_API_ROUTES } from "../../constants";
|
|
14
|
-
// import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
|
|
15
|
-
// import { useState } from "react";
|
|
16
|
-
// export const StudentFeeSingleEntry = () => {
|
|
17
|
-
// const { closeDrawer, handleSubmitSingleEntry, state, updateLoading } =
|
|
18
|
-
// useStudentFeeModule();
|
|
19
|
-
// const [amountPaid, setAmountPaid] = useState("");
|
|
20
|
-
// const [paidAt, setPaidAt] = useState(() => {
|
|
21
|
-
// const d = new Date();
|
|
22
|
-
// return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
23
|
-
// });
|
|
24
|
-
// const [remarks, setRemarks] = useState("");
|
|
25
|
-
// const t = useTranslations("studentFee");
|
|
26
|
-
// const { disableSaveButton, drawer, errors } = state;
|
|
27
|
-
// const isOpen = drawer === STUDENT_FEE_DRAWER.MISC_DRAWER_2;
|
|
28
|
-
// const {
|
|
29
|
-
// fetchNow: fetchByComputerNumber,
|
|
30
|
-
// data: feeByComputerNumber,
|
|
31
|
-
// loading: fetchingByCN,
|
|
32
|
-
// } = useFetch(STUDENT_FEE_API_ROUTES.BY_COMPUTER_NUMBER, {
|
|
33
|
-
// method: API_METHODS.GET,
|
|
34
|
-
// });
|
|
35
|
-
// return (
|
|
36
|
-
// <DrawerGeneric
|
|
37
|
-
// filterDrawer={null}
|
|
38
|
-
// filterDrawerHeader={null}
|
|
39
|
-
// filterDrawerFooter={null}
|
|
40
|
-
// formDrawer={
|
|
41
|
-
// isOpen ? (
|
|
42
|
-
// <SingleEntryStudentFeeForm
|
|
43
|
-
// amountPaid={amountPaid}
|
|
44
|
-
// feeByComputerNumber={feeByComputerNumber}
|
|
45
|
-
// fetchByComputerNumber={fetchByComputerNumber}
|
|
46
|
-
// fetchingByCN={fetchingByCN}
|
|
47
|
-
// paidAt={paidAt}
|
|
48
|
-
// remarks={remarks}
|
|
49
|
-
// setAmountPaid={setAmountPaid}
|
|
50
|
-
// setPaidAt={setPaidAt}
|
|
51
|
-
// setRemarks={setRemarks}
|
|
52
|
-
// />
|
|
53
|
-
// ) : null
|
|
54
|
-
// }
|
|
55
|
-
// formDrawerHeader={
|
|
56
|
-
// isOpen ? (
|
|
57
|
-
// <EnhancedDrawerHeader
|
|
58
|
-
// title={t("drawerSingleEntryTitle")}
|
|
59
|
-
// description={t("drawerSingleEntryDescription")}
|
|
60
|
-
// />
|
|
61
|
-
// ) : null
|
|
62
|
-
// }
|
|
63
|
-
// formDrawerFooter={
|
|
64
|
-
// isOpen ? (
|
|
65
|
-
// <EnhancedDrawerFooter
|
|
66
|
-
// applyFilters={() => {}}
|
|
67
|
-
// clearFilters={() => {}}
|
|
68
|
-
// closeDrawer={closeDrawer}
|
|
69
|
-
// disableSaveButton={disableSaveButton}
|
|
70
|
-
// drawerType={DRAWER_FOOTER_COMPONENT_TYPE.FORM_DRAWER}
|
|
71
|
-
// errors={errors}
|
|
72
|
-
// handleSubmit={() =>
|
|
73
|
-
// handleSubmitSingleEntry(
|
|
74
|
-
// feeByComputerNumber,
|
|
75
|
-
// amountPaid,
|
|
76
|
-
// remarks,
|
|
77
|
-
// paidAt
|
|
78
|
-
// )
|
|
79
|
-
// }
|
|
80
|
-
// updateLoading={updateLoading}
|
|
81
|
-
// />
|
|
82
|
-
// ) : null
|
|
83
|
-
// }
|
|
84
|
-
// viewDrawer={null}
|
|
85
|
-
// viewDrawerHeader={null}
|
|
86
|
-
// viewDrawerFooter={null}
|
|
87
|
-
// moreActionsDrawer={null}
|
|
88
|
-
// moreActionsDrawerHeader={null}
|
|
89
|
-
// moreActionsDrawerFooter={null}
|
|
90
|
-
// onOpenChange={(open: boolean) => !open && closeDrawer()}
|
|
91
|
-
// open={isOpen}
|
|
92
|
-
// />
|
|
93
|
-
// );
|
|
94
|
-
// };
|