@appcorp/fusion-storybook 0.3.76 → 0.3.78

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.
@@ -1,103 +1,274 @@
1
- "use client";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
4
- import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
5
- import { 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 } 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
- export const SingleEntryStudentFeeForm = ({ amountPaid, feeByComputerNumber, fetchByComputerNumber, fetchingByCN, paidAt, remarks, setAmountPaid, setPaidAt, setRemarks, }) => {
13
- var _a, _b, _c, _d, _e, _f, _g, _h;
14
- const { dispatch } = useStudentFeeModule();
15
- const workspace = getCachedWorkspaceSync();
16
- 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 : "";
17
- const t = useTranslations("studentFee");
18
- // const [amountPaid, setAmountPaid] = useState("");
19
- // const [remarks, setRemarks] = useState("");
20
- const [computerNumber, setComputerNumber] = useState("");
21
- const debouncedComputerNumber = useDebounce(computerNumber, 800);
22
- const fetchByCNRef = useRef(fetchByComputerNumber);
23
- useEffect(() => {
24
- fetchByCNRef.current = fetchByComputerNumber;
25
- }, [fetchByComputerNumber]);
26
- useEffect(() => {
27
- var _a;
28
- if (!debouncedComputerNumber)
29
- return;
30
- fetchByCNRef.current(undefined, {
31
- params: {
32
- computerNumber: debouncedComputerNumber,
33
- schoolId: (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
34
- },
35
- });
36
- }, [debouncedComputerNumber, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id]);
37
- const isStale = computerNumber !== debouncedComputerNumber;
38
- const hasData = !!feeByComputerNumber &&
39
- !!debouncedComputerNumber &&
40
- !isStale &&
41
- !fetchingByCN;
42
- const response = hasData
43
- ? feeByComputerNumber
44
- : null;
45
- const profile = (_d = response === null || response === void 0 ? void 0 : response.studentProfile) !== null && _d !== void 0 ? _d : null;
46
- const fee = (_f = (_e = response === null || response === void 0 ? void 0 : response.studentFees) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : null;
47
- useEffect(() => {
48
- dispatch({
49
- type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
50
- payload: { disabled: false },
51
- });
52
- }, [fee, dispatch]);
53
- const paymentStatusLabelMap = {
54
- PENDING: t("formOptionPending"),
55
- PARTIAL: t("formOptionPartial"),
56
- PAID: t("formOptionPaid"),
57
- OVERDUE: t("formOptionOverdue"),
58
- CANCELLED: t("formOptionCancelled"),
59
- REFUNDED: t("formOptionRefunded"),
60
- };
61
- const studentName = profile
62
- ? `${profile.firstName} ${profile.lastName}`.trim() || profile.id
63
- : "";
64
- const feeStructureName = ((_g = fee === null || fee === void 0 ? void 0 : fee.feeStructure) === null || _g === void 0 ? void 0 : _g.name) || (fee === null || fee === void 0 ? void 0 : fee.feeStructureId) || "";
65
- const discountCodeLabel = (fee === null || fee === void 0 ? void 0 : fee.discountCode)
66
- ? `${fee.discountCode.code} - ${fee.discountCode.discountValue}${fee.discountCode.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`
67
- : (fee === null || fee === void 0 ? void 0 : fee.discountCodeId) || "";
68
- const statusDisplay = (fee === null || fee === void 0 ? void 0 : fee.status)
69
- ? paymentStatusLabelMap[fee.status] || fee.status
70
- : "";
71
- const formatDisplayDate = (rawDate) => {
72
- if (!rawDate)
73
- return "";
74
- const d = new Date(rawDate);
75
- return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
76
- };
77
- const accumulatedAmount = useMemo(() => {
78
- var _a;
79
- if (!((_a = response === null || response === void 0 ? void 0 : response.studentFees) === null || _a === void 0 ? void 0 : _a.length))
80
- return 0;
81
- return response.studentFees.reduce((sum, f) => { var _a; return sum + ((_a = f.amount) !== null && _a !== void 0 ? _a : 0); }, 0);
82
- }, [response]);
83
- const accumulatedFine = useMemo(() => {
84
- var _a;
85
- if (!((_a = response === null || response === void 0 ? void 0 : response.studentFees) === null || _a === void 0 ? void 0 : _a.length))
86
- return 0;
87
- return response.studentFees.reduce((sum, f) => { var _a; return sum + ((_a = f.fine) !== null && _a !== void 0 ? _a : 0); }, 0);
88
- }, [response]);
89
- const handleUpdateAmountPaid = (value) => {
90
- const amountPaid = parseFloat(value);
91
- if (isNaN(amountPaid))
92
- return;
93
- setAmountPaid(value);
94
- };
95
- useEffect(() => {
96
- (async () => {
97
- setAmountPaid(String((accumulatedAmount !== null && accumulatedAmount !== void 0 ? accumulatedAmount : 0) + (accumulatedFine !== null && accumulatedFine !== void 0 ? accumulatedFine : 0)));
98
- })();
99
- }, [fee, accumulatedFine, accumulatedAmount, setAmountPaid]);
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
- (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, { id: "paidAt", info: t("formPaidAtInfo"), label: t("formPaidAtLabel"), onChange: (e) => setPaidAt(e.target.value), onClick: (e) => { var _a, _b; return (_b = (_a = e.currentTarget).showPicker) === null || _b === void 0 ? void 0 : _b.call(_a); }, 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
- };
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
+ // };
@@ -1 +0,0 @@
1
- export declare const StudentFeeSingleEntry: () => import("react").JSX.Element;
@@ -1,28 +1,94 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { EnhancedDrawerHeader } from "@appcorp/shadcn/components/enhanced-drawer-header";
4
- import { EnhancedDrawerFooter, DRAWER_FOOTER_COMPONENT_TYPE, } from "@appcorp/shadcn/components/enhanced-drawer-footer";
5
- import { DrawerGeneric } from "@appcorp/shadcn/components/drawer-generic";
6
- import { useStudentFeeModule, STUDENT_FEE_DRAWER } from "./context";
7
- import { useTranslations } from "next-intl";
8
- import { SingleEntryStudentFeeForm } from "./single-entry-form";
9
- import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
10
- import { STUDENT_FEE_API_ROUTES } from "../../constants";
11
- import { API_METHODS } from "@react-pakistan/util-functions/constants/api-methods";
12
- import { useState } from "react";
13
- export const StudentFeeSingleEntry = () => {
14
- const { closeDrawer, handleSubmitSingleEntry, state, updateLoading } = useStudentFeeModule();
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
- });
20
- const [remarks, setRemarks] = useState("");
21
- const t = useTranslations("studentFee");
22
- const { disableSaveButton, drawer, errors } = state;
23
- const isOpen = drawer === STUDENT_FEE_DRAWER.MISC_DRAWER_2;
24
- const { fetchNow: fetchByComputerNumber, data: feeByComputerNumber, loading: fetchingByCN, } = useFetch(STUDENT_FEE_API_ROUTES.BY_COMPUTER_NUMBER, {
25
- method: API_METHODS.GET,
26
- });
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 }));
28
- };
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
+ // };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.76",
3
+ "version": "0.3.78",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",
@@ -55,7 +55,7 @@
55
55
  "@radix-ui/react-slider": "^1",
56
56
  "@radix-ui/react-slot": "^1",
57
57
  "@radix-ui/react-toast": "^1",
58
- "@react-pakistan/util-functions": "^3.0.5",
58
+ "@react-pakistan/util-functions": "^3.0.7",
59
59
  "@storybook/addon-a11y": "^10.3.4",
60
60
  "@storybook/addon-docs": "^10.3.4",
61
61
  "@storybook/addon-onboarding": "^10.3.4",