@appcorp/fusion-storybook 0.2.94 → 0.2.95
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.
|
@@ -29,45 +29,50 @@ export const useStudentFeeModule = () => {
|
|
|
29
29
|
// ============================================================================
|
|
30
30
|
// 1.4.1 STATE & CORE HOOKS
|
|
31
31
|
// ============================================================================
|
|
32
|
-
var _a;
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
33
|
const context = useStudentFeeContext();
|
|
34
34
|
const { dispatch } = context;
|
|
35
35
|
const state = context.state;
|
|
36
36
|
const t = useTranslations("studentFee");
|
|
37
37
|
const { theme } = useTheme();
|
|
38
38
|
const workspace = getCachedWorkspaceSync();
|
|
39
|
-
const schoolId = ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "";
|
|
40
39
|
const listFetchNowRef = useRef(null);
|
|
41
40
|
const debouncedQuery = useDebounce(state.searchQuery, 800);
|
|
42
41
|
// ============================================================================
|
|
43
42
|
// 1.4.2 API PARAMETERS
|
|
44
43
|
// ============================================================================
|
|
45
|
-
const listParams = useMemo(() =>
|
|
46
|
-
|
|
47
|
-
:
|
|
44
|
+
const listParams = useMemo(() => {
|
|
45
|
+
var _a;
|
|
46
|
+
return (Object.assign(Object.assign(Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "" }, (debouncedQuery ? { searchQuery: debouncedQuery } : {})), (state.filterEnabled !== undefined
|
|
47
|
+
? { filterEnabled: state.filterEnabled }
|
|
48
|
+
: {})), (state.filterStatus ? { status: state.filterStatus } : {})));
|
|
49
|
+
}, [
|
|
48
50
|
state.currentPage,
|
|
49
51
|
state.filterEnabled,
|
|
50
52
|
state.filterStatus,
|
|
51
53
|
state.pageLimit,
|
|
52
54
|
debouncedQuery,
|
|
53
|
-
|
|
55
|
+
(_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
|
|
54
56
|
]);
|
|
55
|
-
const updateParams = useMemo(() =>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
const updateParams = useMemo(() => {
|
|
58
|
+
var _a;
|
|
59
|
+
return ({
|
|
60
|
+
amount: Number(state.amount),
|
|
61
|
+
amountDue: Number(state.amountDue),
|
|
62
|
+
amountPaid: Number(state.amountPaid),
|
|
63
|
+
discountAmount: Number(state.discountAmount),
|
|
64
|
+
discountCodeId: state.discountCodeId,
|
|
65
|
+
dueDate: state.dueDate,
|
|
66
|
+
enabled: state.enabled,
|
|
67
|
+
familyId: state.familyId,
|
|
68
|
+
feeStructureId: state.feeStructureId,
|
|
69
|
+
id: state.id,
|
|
70
|
+
remarks: state.remarks || null,
|
|
71
|
+
schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "",
|
|
72
|
+
status: state.status,
|
|
73
|
+
studentProfileId: state.studentProfileId,
|
|
74
|
+
});
|
|
75
|
+
}, [state, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
|
|
71
76
|
const byIdParams = useMemo(() => ({ id: state.id }), [state.id]);
|
|
72
77
|
const deleteParams = useMemo(() => ({ id: state.id }), [state.id]);
|
|
73
78
|
// ============================================================================
|
|
@@ -96,6 +101,7 @@ export const useStudentFeeModule = () => {
|
|
|
96
101
|
});
|
|
97
102
|
}, [dispatch]);
|
|
98
103
|
const resetRecordFormState = useCallback(() => {
|
|
104
|
+
var _a;
|
|
99
105
|
dispatch({
|
|
100
106
|
type: STUDENT_FEE_ACTION_TYPES.SET_ERRORS,
|
|
101
107
|
payload: { errors: {} },
|
|
@@ -126,13 +132,13 @@ export const useStudentFeeModule = () => {
|
|
|
126
132
|
reliabilityScore: null,
|
|
127
133
|
remarks: null,
|
|
128
134
|
riskLevel: null,
|
|
129
|
-
schoolId,
|
|
135
|
+
schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "",
|
|
130
136
|
status: PAYMENT_STATUS.PENDING,
|
|
131
137
|
studentProfileId: "",
|
|
132
138
|
},
|
|
133
139
|
},
|
|
134
140
|
});
|
|
135
|
-
}, [dispatch,
|
|
141
|
+
}, [dispatch, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id]);
|
|
136
142
|
// ============================================================================
|
|
137
143
|
// 1.4.4 API CALLBACKS
|
|
138
144
|
// ============================================================================
|
|
@@ -591,11 +597,11 @@ export const useStudentFeeModule = () => {
|
|
|
591
597
|
listFetchNowRef.current = listFetchNow;
|
|
592
598
|
}, [listFetchNow]);
|
|
593
599
|
useEffect(() => {
|
|
594
|
-
var _a;
|
|
595
|
-
if (!
|
|
600
|
+
var _a, _b;
|
|
601
|
+
if (!((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id))
|
|
596
602
|
return;
|
|
597
|
-
(
|
|
598
|
-
}, [dispatch, listParams,
|
|
603
|
+
(_b = listFetchNowRef.current) === null || _b === void 0 ? void 0 : _b.call(listFetchNowRef);
|
|
604
|
+
}, [dispatch, listParams, (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id, showToast, t]);
|
|
599
605
|
// ============================================================================
|
|
600
606
|
// 1.4.10 RETURN
|
|
601
607
|
// ============================================================================
|