@appcorp/fusion-storybook 0.3.13 → 0.3.14
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,7 +29,7 @@ export const useStudentFeeModule = () => {
|
|
|
29
29
|
// ============================================================================
|
|
30
30
|
// 1.4.1 STATE & CORE HOOKS
|
|
31
31
|
// ============================================================================
|
|
32
|
-
var _a, _b, _c, _d, _e;
|
|
32
|
+
var _a, _b, _c, _d, _e, _f;
|
|
33
33
|
const context = useStudentFeeContext();
|
|
34
34
|
const { dispatch } = context;
|
|
35
35
|
const state = context.state;
|
|
@@ -231,7 +231,7 @@ export const useStudentFeeModule = () => {
|
|
|
231
231
|
// 1.4.6 HANDLERS
|
|
232
232
|
// ============================================================================
|
|
233
233
|
const handleChange = useCallback(async (field, value) => {
|
|
234
|
-
var _a, _b, _c, _d;
|
|
234
|
+
var _a, _b, _c, _d, _e;
|
|
235
235
|
dispatch({
|
|
236
236
|
type: STUDENT_FEE_ACTION_TYPES.SET_ERRORS,
|
|
237
237
|
payload: { errors: {} },
|
|
@@ -281,7 +281,7 @@ export const useStudentFeeModule = () => {
|
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
catch (
|
|
284
|
+
catch (_f) {
|
|
285
285
|
// silent fallback
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -291,10 +291,10 @@ export const useStudentFeeModule = () => {
|
|
|
291
291
|
url: "/api/v1/student-profile",
|
|
292
292
|
method: API_METHODS.GET,
|
|
293
293
|
headers: { "Content-Type": "application/json" },
|
|
294
|
-
params: { id: value,
|
|
294
|
+
params: { id: value, schoolId: (_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id },
|
|
295
295
|
});
|
|
296
296
|
const familyId = (data === null || data === void 0 ? void 0 : data.studentProfile.familyMember.familyId) || "";
|
|
297
|
-
const studentProfile = (
|
|
297
|
+
const studentProfile = (_c = getCachedStudentProfilesSync().items) === null || _c === void 0 ? void 0 : _c.find((s) => s.id === value);
|
|
298
298
|
dispatch({
|
|
299
299
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
300
300
|
payload: {
|
|
@@ -303,7 +303,7 @@ export const useStudentFeeModule = () => {
|
|
|
303
303
|
},
|
|
304
304
|
});
|
|
305
305
|
if (studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.discountCode) {
|
|
306
|
-
const discountCode = (
|
|
306
|
+
const discountCode = (_d = discountCodes.items) === null || _d === void 0 ? void 0 : _d.find((code) => code.code === studentProfile.discountCode && code.enabled);
|
|
307
307
|
if (discountCode) {
|
|
308
308
|
dispatch({
|
|
309
309
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
@@ -334,13 +334,13 @@ export const useStudentFeeModule = () => {
|
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
catch (
|
|
337
|
+
catch (_g) {
|
|
338
338
|
// silent fallback
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
if (field === "discountCodeId" && typeof value === "string" && value) {
|
|
342
342
|
try {
|
|
343
|
-
const discountCode = (
|
|
343
|
+
const discountCode = (_e = discountCodes.items) === null || _e === void 0 ? void 0 : _e.find((code) => code.id === value && code.enabled);
|
|
344
344
|
if (discountCode) {
|
|
345
345
|
const originalFee = Number(currentState.originalFee) || 0;
|
|
346
346
|
let discountAmount = discountCode.discountType === DISCOUNT_TYPE.PERCENTAGE
|
|
@@ -362,7 +362,7 @@ export const useStudentFeeModule = () => {
|
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
catch (
|
|
365
|
+
catch (_h) {
|
|
366
366
|
// silent fallback
|
|
367
367
|
}
|
|
368
368
|
}
|
|
@@ -430,7 +430,7 @@ export const useStudentFeeModule = () => {
|
|
|
430
430
|
payload: { key: "amountDue", value: amountDue },
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
-
}, [dispatch, state]);
|
|
433
|
+
}, [dispatch, state, (_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id]);
|
|
434
434
|
const handlePageChange = useCallback((page) => {
|
|
435
435
|
const nextPage = typeof page === "number" ? page : state.currentPage + 1;
|
|
436
436
|
dispatch({
|
|
@@ -584,7 +584,7 @@ export const useStudentFeeModule = () => {
|
|
|
584
584
|
payload: { disabled: false },
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
}, [dispatch, showToast, t, (
|
|
587
|
+
}, [dispatch, showToast, t, (_e = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _e === void 0 ? void 0 : _e.id, resetFormAndCloseDrawer]);
|
|
588
588
|
const handleSubmit = useCallback(() => {
|
|
589
589
|
dispatch({
|
|
590
590
|
type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
@@ -685,7 +685,7 @@ export const useStudentFeeModule = () => {
|
|
|
685
685
|
if (!((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id))
|
|
686
686
|
return;
|
|
687
687
|
(_b = listFetchNowRef.current) === null || _b === void 0 ? void 0 : _b.call(listFetchNowRef);
|
|
688
|
-
}, [dispatch, listParams, (
|
|
688
|
+
}, [dispatch, listParams, (_f = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _f === void 0 ? void 0 : _f.id, showToast, t]);
|
|
689
689
|
// ============================================================================
|
|
690
690
|
// 1.4.10 RETURN
|
|
691
691
|
// ============================================================================
|