@appcorp/fusion-storybook 0.3.7 → 0.3.8
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.
|
@@ -18,6 +18,7 @@ export const SingleEntryStudentFeeForm = () => {
|
|
|
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");
|
|
21
|
+
const [amountPaid, setAmountPaid] = useState("");
|
|
21
22
|
const [computerNumber, setComputerNumber] = useState("");
|
|
22
23
|
const debouncedComputerNumber = useDebounce(computerNumber, 800);
|
|
23
24
|
const { fetchNow: fetchByComputerNumber, data: feeByComputerNumber, loading: fetchingByCN, } = useFetch(STUDENT_FEE_API_ROUTES.BY_COMPUTER_NUMBER, {
|
|
@@ -48,6 +49,11 @@ export const SingleEntryStudentFeeForm = () => {
|
|
|
48
49
|
: null;
|
|
49
50
|
const profile = (_d = response === null || response === void 0 ? void 0 : response.studentProfile) !== null && _d !== void 0 ? _d : null;
|
|
50
51
|
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;
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
(async () => {
|
|
54
|
+
setAmountPaid(String(fee === null || fee === void 0 ? void 0 : fee.amount));
|
|
55
|
+
})();
|
|
56
|
+
}, [fee]);
|
|
51
57
|
useEffect(() => {
|
|
52
58
|
dispatch({
|
|
53
59
|
type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
@@ -78,5 +84,11 @@ export const SingleEntryStudentFeeForm = () => {
|
|
|
78
84
|
const d = new Date(rawDate);
|
|
79
85
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
80
86
|
};
|
|
81
|
-
|
|
87
|
+
const handleUpdateAmountPaid = (value) => {
|
|
88
|
+
const amountPaid = parseFloat(value);
|
|
89
|
+
if (isNaN(amountPaid))
|
|
90
|
+
return;
|
|
91
|
+
setAmountPaid(value);
|
|
92
|
+
};
|
|
93
|
+
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, _jsxs(_Fragment, { children: [_jsx(EnhancedInput, { readOnly: true, id: "studentProfileId-readonly", label: t("formStudentLabel"), value: studentName }), _jsx(EnhancedInput, { readOnly: true, id: "computerNumber-readonly", label: t("formComputerNumberLabel"), value: profile === null || profile === void 0 ? void 0 : profile.computerNumber, type: "number" }), _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: "amount-readonly", info: t("formTotalAmountInfo"), label: t("formTotalAmountLabel"), value: fee === null || fee === void 0 ? void 0 : fee.amount, type: "number", step: "0.01" }), _jsx(EnhancedInput, { id: "amountPaid", info: t("formAmountPaidInfo"), label: t("formAmountPaidLabel"), value: amountPaid, 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: fee === null || fee === void 0 ? void 0 : fee.amountDue, 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, { readOnly: true, id: "remarks-readonly", label: t("formRemarksLabel"), value: (fee === null || fee === void 0 ? void 0 : fee.remarks) || "" })] })] }));
|
|
82
94
|
};
|