@appcorp/fusion-storybook 0.2.95 → 0.2.96

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.
@@ -101,7 +101,11 @@ export const useStudentFeeModule = () => {
101
101
  });
102
102
  }, [dispatch]);
103
103
  const resetRecordFormState = useCallback(() => {
104
- var _a;
104
+ var _a, _b;
105
+ const days = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength) !== null && _a !== void 0 ? _a : 0;
106
+ const dueDate = new Date();
107
+ if (days > 0)
108
+ dueDate.setDate(dueDate.getDate() + days);
105
109
  dispatch({
106
110
  type: STUDENT_FEE_ACTION_TYPES.SET_ERRORS,
107
111
  payload: { errors: {} },
@@ -119,7 +123,7 @@ export const useStudentFeeModule = () => {
119
123
  amountPaid: 0,
120
124
  discountAmount: 0,
121
125
  discountCodeId: null,
122
- dueDate: new Date().toISOString().slice(0, 10),
126
+ dueDate: dueDate.toISOString().slice(0, 10),
123
127
  enabled: true,
124
128
  familyId: "",
125
129
  feeStructureId: "",
@@ -132,13 +136,13 @@ export const useStudentFeeModule = () => {
132
136
  reliabilityScore: null,
133
137
  remarks: null,
134
138
  riskLevel: null,
135
- schoolId: ((_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id) || "",
139
+ schoolId: ((_b = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _b === void 0 ? void 0 : _b.id) || "",
136
140
  status: PAYMENT_STATUS.PENDING,
137
141
  studentProfileId: "",
138
142
  },
139
143
  },
140
144
  });
141
- }, [dispatch, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id]);
145
+ }, [dispatch, workspace === null || workspace === void 0 ? void 0 : workspace.dueDateLength, (_c = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _c === void 0 ? void 0 : _c.id]);
142
146
  // ============================================================================
143
147
  // 1.4.4 API CALLBACKS
144
148
  // ============================================================================
@@ -454,11 +458,12 @@ export const useStudentFeeModule = () => {
454
458
  });
455
459
  }, [updateFetchNow]);
456
460
  const handleCreate = useCallback(() => {
461
+ resetRecordFormState();
457
462
  dispatch({
458
463
  type: STUDENT_FEE_ACTION_TYPES.SET_DRAWER,
459
464
  payload: { drawer: STUDENT_FEE_DRAWER.FORM_DRAWER },
460
465
  });
461
- }, [dispatch]);
466
+ }, [dispatch, resetRecordFormState]);
462
467
  const handleView = useCallback((row) => {
463
468
  resetRecordFormState();
464
469
  byIdFetchNow === null || byIdFetchNow === void 0 ? void 0 : byIdFetchNow(undefined, { params: { id: row === null || row === void 0 ? void 0 : row.id } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.95",
3
+ "version": "0.2.96",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",