@appcorp/fusion-storybook 0.3.29 → 0.3.30
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.d.ts +1 -0
- package/base-modules/student-fee/context/use-student-fee-module.js +4 -0
- package/base-modules/student-fee/single-entry-form.d.ts +60 -1
- package/base-modules/student-fee/single-entry-form.js +8 -7
- package/base-modules/student-fee/single-entry.js +8 -2
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -20,6 +20,7 @@ export declare const useStudentFeeModule: () => {
|
|
|
20
20
|
handleProceedMonthlyCreation: () => Promise<void>;
|
|
21
21
|
handleSearch: (query: string) => void;
|
|
22
22
|
handleSubmit: () => void;
|
|
23
|
+
handleSubmitSingleEntry: (fees: StudentFeeBE[]) => void;
|
|
23
24
|
handleView: (row?: TableRow) => void;
|
|
24
25
|
headerActions: {
|
|
25
26
|
enabled: boolean;
|
|
@@ -566,6 +566,9 @@ export const useStudentFeeModule = () => {
|
|
|
566
566
|
},
|
|
567
567
|
});
|
|
568
568
|
}, [dispatch, updateParams, t, showToast, updateFetchNow]);
|
|
569
|
+
const handleSubmitSingleEntry = useCallback((fees) => {
|
|
570
|
+
console.log("Submitting single entry fees:", fees);
|
|
571
|
+
}, []);
|
|
569
572
|
// ============================================================================
|
|
570
573
|
// 1.4.8 HEADER & ROW ACTIONS
|
|
571
574
|
// ============================================================================
|
|
@@ -663,6 +666,7 @@ export const useStudentFeeModule = () => {
|
|
|
663
666
|
handleProceedMonthlyCreation,
|
|
664
667
|
handleSearch,
|
|
665
668
|
handleSubmit,
|
|
669
|
+
handleSubmitSingleEntry,
|
|
666
670
|
handleView,
|
|
667
671
|
headerActions,
|
|
668
672
|
listFetchNow,
|
|
@@ -1 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { DISCOUNT_TYPE, PAYMENT_STATUS } from "../../type";
|
|
3
|
+
interface StudentProfileSummary {
|
|
4
|
+
id: string;
|
|
5
|
+
computerNumber: number;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
status: string;
|
|
9
|
+
}
|
|
10
|
+
interface FeeRecordSummary {
|
|
11
|
+
amount: number;
|
|
12
|
+
amountDue: number;
|
|
13
|
+
amountPaid: number;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
discountAmount: number | null;
|
|
16
|
+
discountCodeId: string | null;
|
|
17
|
+
dueDate: string;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
familyId: string;
|
|
20
|
+
feeStructureId: string;
|
|
21
|
+
fine?: number | null;
|
|
22
|
+
id: string;
|
|
23
|
+
lastRemindedAt: string | null;
|
|
24
|
+
paidAt?: Date | string | null;
|
|
25
|
+
nextFollowUpAt: string | null;
|
|
26
|
+
reliabilityScore: number | null;
|
|
27
|
+
remarks: string | null;
|
|
28
|
+
riskLevel: string | null;
|
|
29
|
+
schoolId: string;
|
|
30
|
+
status: PAYMENT_STATUS;
|
|
31
|
+
studentProfileId: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
family: {
|
|
34
|
+
address: string;
|
|
35
|
+
city: string;
|
|
36
|
+
country: string;
|
|
37
|
+
id: string;
|
|
38
|
+
} | null;
|
|
39
|
+
feeStructure: {
|
|
40
|
+
name: string;
|
|
41
|
+
amount: number;
|
|
42
|
+
id: string;
|
|
43
|
+
} | 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
|
+
fetchByComputerNumber: (url: string | undefined, options: object) => void;
|
|
56
|
+
feeByComputerNumber: StudentFeeByCNResponse | null;
|
|
57
|
+
fetchingByCN: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare const SingleEntryStudentFeeForm: FC<SingleEntryStudentFeeFormProps>;
|
|
60
|
+
export {};
|
|
@@ -4,15 +4,12 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
4
4
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
5
5
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { useStudentFeeModule, STUDENT_FEE_ACTION_TYPES } from "./context";
|
|
7
|
-
import { STUDENT_FEE_API_ROUTES } from "../../constants";
|
|
8
7
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
9
|
-
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
10
8
|
import { DISCOUNT_TYPE } from "../../type";
|
|
11
9
|
import { useTranslations } from "next-intl";
|
|
12
|
-
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
13
10
|
import { useDebounce } from "@react-pakistan/util-functions/hooks/use-debounce";
|
|
14
11
|
import { Loader2 } from "lucide-react";
|
|
15
|
-
export const SingleEntryStudentFeeForm = () => {
|
|
12
|
+
export const SingleEntryStudentFeeForm = ({ fetchByComputerNumber, feeByComputerNumber, fetchingByCN, }) => {
|
|
16
13
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
17
14
|
const { dispatch } = useStudentFeeModule();
|
|
18
15
|
const workspace = getCachedWorkspaceSync();
|
|
@@ -22,9 +19,13 @@ export const SingleEntryStudentFeeForm = () => {
|
|
|
22
19
|
const [remarks, setRemarks] = useState("");
|
|
23
20
|
const [computerNumber, setComputerNumber] = useState("");
|
|
24
21
|
const debouncedComputerNumber = useDebounce(computerNumber, 800);
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
// const {
|
|
23
|
+
// fetchNow: fetchByComputerNumber,
|
|
24
|
+
// data: feeByComputerNumber,
|
|
25
|
+
// loading: fetchingByCN,
|
|
26
|
+
// } = useFetch(STUDENT_FEE_API_ROUTES.BY_COMPUTER_NUMBER, {
|
|
27
|
+
// method: API_METHODS.GET,
|
|
28
|
+
// });
|
|
28
29
|
const fetchByCNRef = useRef(fetchByComputerNumber);
|
|
29
30
|
useEffect(() => {
|
|
30
31
|
fetchByCNRef.current = fetchByComputerNumber;
|
|
@@ -6,10 +6,16 @@ import { DrawerGeneric } from "@appcorp/shadcn/components/drawer-generic";
|
|
|
6
6
|
import { useStudentFeeModule, STUDENT_FEE_DRAWER } from "./context";
|
|
7
7
|
import { useTranslations } from "next-intl";
|
|
8
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";
|
|
9
12
|
export const StudentFeeSingleEntry = () => {
|
|
10
|
-
const { closeDrawer,
|
|
13
|
+
const { closeDrawer, handleSubmitSingleEntry, state, updateLoading } = useStudentFeeModule();
|
|
11
14
|
const t = useTranslations("studentFee");
|
|
12
15
|
const { disableSaveButton, drawer, errors } = state;
|
|
13
16
|
const isOpen = drawer === STUDENT_FEE_DRAWER.SINGLE_ENTRY_DRAWER;
|
|
14
|
-
|
|
17
|
+
const { fetchNow: fetchByComputerNumber, data: feeByComputerNumber, loading: fetchingByCN, } = useFetch(STUDENT_FEE_API_ROUTES.BY_COMPUTER_NUMBER, {
|
|
18
|
+
method: API_METHODS.GET,
|
|
19
|
+
});
|
|
20
|
+
return (_jsx(DrawerGeneric, { filterDrawer: null, filterDrawerHeader: null, filterDrawerFooter: null, formDrawer: isOpen ? (_jsx(SingleEntryStudentFeeForm, { fetchByComputerNumber: fetchByComputerNumber, feeByComputerNumber: feeByComputerNumber, fetchingByCN: fetchingByCN })) : 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), updateLoading: updateLoading })) : null, viewDrawer: null, viewDrawerHeader: null, viewDrawerFooter: null, moreActionsDrawer: null, moreActionsDrawerHeader: null, moreActionsDrawerFooter: null, onOpenChange: (open) => !open && closeDrawer(), open: isOpen }));
|
|
15
21
|
};
|