@appcorp/fusion-storybook 0.3.70 → 0.3.72
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/shared.d.ts +0 -10
- package/base-modules/student-fee/context/shared.js +1 -4
- package/base-modules/student-fee/context/use-student-fee-module.d.ts +0 -2
- package/base-modules/student-fee/context/use-student-fee-module.js +38 -49
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -56,8 +56,6 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
56
56
|
studentProfileId: string;
|
|
57
57
|
filterEnabled: boolean | undefined;
|
|
58
58
|
filterStatus: PAYMENT_STATUS | "";
|
|
59
|
-
appliedFilterEnabled: boolean | undefined;
|
|
60
|
-
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
61
59
|
}>, initialStudentFeeState: {
|
|
62
60
|
items: StudentFeeBE[];
|
|
63
61
|
count: number;
|
|
@@ -89,8 +87,6 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
89
87
|
studentProfileId: string;
|
|
90
88
|
filterEnabled: boolean | undefined;
|
|
91
89
|
filterStatus: PAYMENT_STATUS | "";
|
|
92
|
-
appliedFilterEnabled: boolean | undefined;
|
|
93
|
-
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
94
90
|
}, StudentFeeProvider: import("react").FC<{
|
|
95
91
|
children: React.ReactNode;
|
|
96
92
|
}>, studentFeeReducer: (state: {
|
|
@@ -124,8 +120,6 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
124
120
|
studentProfileId: string;
|
|
125
121
|
filterEnabled: boolean | undefined;
|
|
126
122
|
filterStatus: PAYMENT_STATUS | "";
|
|
127
|
-
appliedFilterEnabled: boolean | undefined;
|
|
128
|
-
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
129
123
|
}, action: any) => {
|
|
130
124
|
items: StudentFeeBE[];
|
|
131
125
|
count: number;
|
|
@@ -157,8 +151,6 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
157
151
|
studentProfileId: string;
|
|
158
152
|
filterEnabled: boolean | undefined;
|
|
159
153
|
filterStatus: PAYMENT_STATUS | "";
|
|
160
|
-
appliedFilterEnabled: boolean | undefined;
|
|
161
|
-
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
162
154
|
}, useStudentFeeContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContextWithHandlers<{
|
|
163
155
|
items: StudentFeeBE[];
|
|
164
156
|
count: number;
|
|
@@ -190,6 +182,4 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
190
182
|
studentProfileId: string;
|
|
191
183
|
filterEnabled: boolean | undefined;
|
|
192
184
|
filterStatus: PAYMENT_STATUS | "";
|
|
193
|
-
appliedFilterEnabled: boolean | undefined;
|
|
194
|
-
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
195
185
|
}>;
|
|
@@ -57,12 +57,9 @@ const studentFeeConfig = {
|
|
|
57
57
|
schoolId: "",
|
|
58
58
|
status: PAYMENT_STATUS.PENDING,
|
|
59
59
|
studentProfileId: "",
|
|
60
|
-
// Filters
|
|
60
|
+
// Filters
|
|
61
61
|
filterEnabled: undefined,
|
|
62
62
|
filterStatus: "",
|
|
63
|
-
// Applied filters (only updated on "Apply" / "Clear")
|
|
64
|
-
appliedFilterEnabled: undefined,
|
|
65
|
-
appliedFilterStatus: "",
|
|
66
63
|
},
|
|
67
64
|
};
|
|
68
65
|
// ============================================================================
|
|
@@ -68,8 +68,6 @@ export declare const useStudentFeeModule: () => {
|
|
|
68
68
|
studentProfileId: string;
|
|
69
69
|
filterEnabled: boolean | undefined;
|
|
70
70
|
filterStatus: PAYMENT_STATUS | "";
|
|
71
|
-
appliedFilterEnabled: boolean | undefined;
|
|
72
|
-
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
73
71
|
};
|
|
74
72
|
dispatch: React.Dispatch<any>;
|
|
75
73
|
};
|
|
@@ -31,7 +31,7 @@ export const useStudentFeeModule = () => {
|
|
|
31
31
|
// ============================================================================
|
|
32
32
|
// 1.4.1 STATE & CORE HOOKS
|
|
33
33
|
// ============================================================================
|
|
34
|
-
var _a, _b, _c, _d
|
|
34
|
+
var _a, _b, _c, _d;
|
|
35
35
|
const context = useStudentFeeContext();
|
|
36
36
|
const { dispatch } = context;
|
|
37
37
|
const state = context.state;
|
|
@@ -40,44 +40,37 @@ export const useStudentFeeModule = () => {
|
|
|
40
40
|
const workspace = getCachedWorkspaceSync();
|
|
41
41
|
const listFetchNowRef = useRef(null);
|
|
42
42
|
const debouncedQuery = useDebounce(state.searchQuery, 800);
|
|
43
|
+
const schoolId = ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "";
|
|
43
44
|
// ============================================================================
|
|
44
45
|
// 1.4.2 API PARAMETERS
|
|
45
46
|
// ============================================================================
|
|
46
|
-
const listParams = useMemo(() => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
? { filterEnabled: state.appliedFilterEnabled }
|
|
50
|
-
: {})), (state.appliedFilterStatus
|
|
51
|
-
? { status: state.appliedFilterStatus }
|
|
52
|
-
: {})));
|
|
53
|
-
}, [
|
|
54
|
-
state.appliedFilterEnabled,
|
|
55
|
-
state.appliedFilterStatus,
|
|
47
|
+
const listParams = useMemo(() => (Object.assign(Object.assign(Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {})), (state.filterEnabled !== undefined
|
|
48
|
+
? { filterEnabled: String(state.filterEnabled) }
|
|
49
|
+
: {})), (state.filterStatus ? { status: state.filterStatus } : {}))), [
|
|
56
50
|
state.currentPage,
|
|
51
|
+
state.filterEnabled,
|
|
52
|
+
state.filterStatus,
|
|
57
53
|
state.pageLimit,
|
|
58
54
|
debouncedQuery,
|
|
59
|
-
|
|
55
|
+
schoolId,
|
|
60
56
|
]);
|
|
61
|
-
const updateParams = useMemo(() => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
studentProfileId: state.studentProfileId,
|
|
79
|
-
});
|
|
80
|
-
}, [state, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
|
|
57
|
+
const updateParams = useMemo(() => ({
|
|
58
|
+
amount: Number(state.amount),
|
|
59
|
+
amountDue: Number(state.amountDue),
|
|
60
|
+
amountPaid: Number(state.amountPaid),
|
|
61
|
+
discountAmount: Number(state.discountAmount),
|
|
62
|
+
discountCodeId: state.discountCodeId,
|
|
63
|
+
dueDate: state.dueDate,
|
|
64
|
+
enabled: state.enabled,
|
|
65
|
+
familyId: state.familyId,
|
|
66
|
+
feeStructureId: state.feeStructureId,
|
|
67
|
+
id: state.id,
|
|
68
|
+
paidAt: state.paidAt || null,
|
|
69
|
+
remarks: state.remarks || null,
|
|
70
|
+
schoolId,
|
|
71
|
+
status: state.status,
|
|
72
|
+
studentProfileId: state.studentProfileId,
|
|
73
|
+
}), [state, schoolId]);
|
|
81
74
|
const byIdParams = useMemo(() => ({ id: state.id }), [state.id]);
|
|
82
75
|
const deleteParams = useMemo(() => ({ id: state.id }), [state.id]);
|
|
83
76
|
// ============================================================================
|
|
@@ -132,8 +125,6 @@ export const useStudentFeeModule = () => {
|
|
|
132
125
|
enabled: true,
|
|
133
126
|
familyId: "",
|
|
134
127
|
feeStructureId: "",
|
|
135
|
-
filterEnabled: undefined,
|
|
136
|
-
filterStatus: "",
|
|
137
128
|
id: "",
|
|
138
129
|
lastRemindedAt: null,
|
|
139
130
|
nextFollowUpAt: null,
|
|
@@ -148,7 +139,7 @@ export const useStudentFeeModule = () => {
|
|
|
148
139
|
},
|
|
149
140
|
},
|
|
150
141
|
});
|
|
151
|
-
}, [dispatch, workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength, (
|
|
142
|
+
}, [dispatch, workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength, (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id]);
|
|
152
143
|
// ============================================================================
|
|
153
144
|
// 1.4.4 API CALLBACKS
|
|
154
145
|
// ============================================================================
|
|
@@ -206,11 +197,11 @@ export const useStudentFeeModule = () => {
|
|
|
206
197
|
payload: {
|
|
207
198
|
form: Object.assign(Object.assign({}, fee), { dueDate,
|
|
208
199
|
paidAt,
|
|
209
|
-
originalFee
|
|
200
|
+
originalFee }),
|
|
210
201
|
},
|
|
211
202
|
});
|
|
212
203
|
}
|
|
213
|
-
}, [dispatch, showToast, t
|
|
204
|
+
}, [dispatch, showToast, t]);
|
|
214
205
|
const deleteCallback = useCallback(({ data, error }) => {
|
|
215
206
|
var _a;
|
|
216
207
|
if (error) {
|
|
@@ -503,19 +494,21 @@ export const useStudentFeeModule = () => {
|
|
|
503
494
|
});
|
|
504
495
|
}, [dispatch]);
|
|
505
496
|
const applyFilters = useCallback(() => {
|
|
497
|
+
const currentEnabled = state.filterEnabled;
|
|
498
|
+
const currentStatus = state.filterStatus;
|
|
499
|
+
closeDrawer();
|
|
506
500
|
dispatch({
|
|
507
501
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
508
|
-
payload: { key: "
|
|
502
|
+
payload: { key: "filterEnabled", value: currentEnabled },
|
|
509
503
|
});
|
|
510
504
|
dispatch({
|
|
511
505
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
512
|
-
payload: { key: "
|
|
506
|
+
payload: { key: "filterStatus", value: currentStatus },
|
|
513
507
|
});
|
|
514
508
|
dispatch({
|
|
515
509
|
type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
516
510
|
payload: { currentPage: 1 },
|
|
517
511
|
});
|
|
518
|
-
closeDrawer();
|
|
519
512
|
}, [dispatch, closeDrawer, state.filterEnabled, state.filterStatus]);
|
|
520
513
|
const clearFilters = useCallback(() => {
|
|
521
514
|
dispatch({
|
|
@@ -524,8 +517,6 @@ export const useStudentFeeModule = () => {
|
|
|
524
517
|
filters: {
|
|
525
518
|
filterEnabled: undefined,
|
|
526
519
|
filterStatus: "",
|
|
527
|
-
appliedFilterEnabled: undefined,
|
|
528
|
-
appliedFilterStatus: "",
|
|
529
520
|
},
|
|
530
521
|
},
|
|
531
522
|
});
|
|
@@ -578,7 +569,7 @@ export const useStudentFeeModule = () => {
|
|
|
578
569
|
payload: { disabled: false },
|
|
579
570
|
});
|
|
580
571
|
}
|
|
581
|
-
}, [dispatch, showToast, t, (
|
|
572
|
+
}, [dispatch, showToast, t, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id, resetFormAndCloseDrawer]);
|
|
582
573
|
const handleSubmit = useCallback(() => {
|
|
583
574
|
dispatch({
|
|
584
575
|
type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
@@ -643,7 +634,7 @@ export const useStudentFeeModule = () => {
|
|
|
643
634
|
payload: { disabled: false },
|
|
644
635
|
});
|
|
645
636
|
}
|
|
646
|
-
}, [dispatch, showToast, t, (
|
|
637
|
+
}, [dispatch, showToast, t, (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id, resetFormAndCloseDrawer]);
|
|
647
638
|
// ============================================================================
|
|
648
639
|
// 1.4.8 HEADER & ROW ACTIONS
|
|
649
640
|
// ============================================================================
|
|
@@ -695,11 +686,9 @@ export const useStudentFeeModule = () => {
|
|
|
695
686
|
listFetchNowRef.current = listFetchNow;
|
|
696
687
|
}, [listFetchNow]);
|
|
697
688
|
useEffect(() => {
|
|
698
|
-
var _a
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
(_b = listFetchNowRef.current) === null || _b === void 0 ? void 0 : _b.call(listFetchNowRef);
|
|
702
|
-
}, [dispatch, listParams, (_f = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _f === void 0 ? void 0 : _f.id, showToast, t]);
|
|
689
|
+
var _a;
|
|
690
|
+
(_a = listFetchNowRef.current) === null || _a === void 0 ? void 0 : _a.call(listFetchNowRef);
|
|
691
|
+
}, [listParams]);
|
|
703
692
|
// ============================================================================
|
|
704
693
|
// 1.4.10 RETURN
|
|
705
694
|
// ============================================================================
|