@appcorp/fusion-storybook 0.3.91 → 0.3.92

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.
@@ -72,13 +72,8 @@ export const ExpenseApiProvider = ({ children, }) => {
72
72
  // ==========================================================================
73
73
  // API PARAMETERS
74
74
  // ==========================================================================
75
- const listParams = useMemo(() => (Object.assign(Object.assign(Object.assign(Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {})), (state.filterCategory ? { filterCategory: state.filterCategory } : {})), (state.filterStatus ? { filterStatus: state.filterStatus } : {})), (state.filterEnabled !== undefined
76
- ? { filterEnabled: state.filterEnabled }
77
- : {}))), [
75
+ const listParams = useMemo(() => (Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {}))), [
78
76
  state.currentPage,
79
- state.filterCategory,
80
- state.filterEnabled,
81
- state.filterStatus,
82
77
  state.pageLimit,
83
78
  debouncedQuery,
84
79
  schoolId,
@@ -149,12 +149,38 @@ export const useExpenseModule = () => {
149
149
  });
150
150
  }, [dispatch]);
151
151
  const applyFilters = useCallback(() => {
152
+ closeDrawer();
153
+ dispatch({
154
+ type: EXPENSE_ACTION_TYPES.SET_INPUT_FIELD,
155
+ payload: { key: "filterCategory", value: state.filterCategory },
156
+ });
157
+ dispatch({
158
+ type: EXPENSE_ACTION_TYPES.SET_INPUT_FIELD,
159
+ payload: { key: "filterStatus", value: state.filterStatus },
160
+ });
161
+ dispatch({
162
+ type: EXPENSE_ACTION_TYPES.SET_INPUT_FIELD,
163
+ payload: { key: "filterEnabled", value: state.filterEnabled },
164
+ });
152
165
  dispatch({
153
166
  type: EXPENSE_ACTION_TYPES.SET_CURRENT_PAGE,
154
167
  payload: { currentPage: 1 },
155
168
  });
156
- closeDrawer();
157
- }, [dispatch, closeDrawer]);
169
+ listFetchNow === null || listFetchNow === void 0 ? void 0 : listFetchNow(undefined, {
170
+ params: Object.assign(Object.assign(Object.assign({ currentPage: 1, pageLimit: state.pageLimit, schoolId }, (state.filterCategory && { filterCategory: state.filterCategory })), (state.filterStatus && { filterStatus: state.filterStatus })), (state.filterEnabled !== undefined && {
171
+ filterEnabled: state.filterEnabled,
172
+ })),
173
+ });
174
+ }, [
175
+ closeDrawer,
176
+ dispatch,
177
+ listFetchNow,
178
+ schoolId,
179
+ state.filterCategory,
180
+ state.filterEnabled,
181
+ state.filterStatus,
182
+ state.pageLimit,
183
+ ]);
158
184
  const clearFilters = useCallback(() => {
159
185
  dispatch({
160
186
  type: EXPENSE_ACTION_TYPES.SET_CURRENT_PAGE,
@@ -170,7 +196,14 @@ export const useExpenseModule = () => {
170
196
  },
171
197
  },
172
198
  });
173
- }, [dispatch]);
199
+ listFetchNow(undefined, {
200
+ params: {
201
+ currentPage: 1,
202
+ pageLimit: state.pageLimit,
203
+ schoolId,
204
+ },
205
+ });
206
+ }, [dispatch, listFetchNow, state.pageLimit, schoolId]);
174
207
  // ============================================================================
175
208
  // 1.4.5 NETWORK ACTIONS
176
209
  // ============================================================================
@@ -62,15 +62,7 @@ export const FeeStructureApiProvider = ({ children, }) => {
62
62
  // ==========================================================================
63
63
  // API PARAMETERS
64
64
  // ==========================================================================
65
- const listParams = useMemo(() => (Object.assign(Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {})), (state.filterEnabled !== undefined
66
- ? { filterEnabled: String(state.filterEnabled) }
67
- : {}))), [
68
- state.currentPage,
69
- state.filterEnabled,
70
- state.pageLimit,
71
- debouncedQuery,
72
- schoolId,
73
- ]);
65
+ const listParams = useMemo(() => (Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {}))), [state.currentPage, state.pageLimit, debouncedQuery, schoolId]);
74
66
  const updateParams = useMemo(() => (Object.assign(Object.assign(Object.assign({}, (state.id ? { id: state.id } : {})), (!state.id ? { schoolId } : {})), { amount: Number(state.amount), classId: state.classId || null, description: state.description || null, enabled: state.enabled, feeType: state.feeType, frequency: state.frequency || null, name: state.name })), [state, schoolId]);
75
67
  const byIdParams = useMemo(() => ({ id: state.id }), [state.id]);
76
68
  const deleteParams = useMemo(() => ({ id: state.id }), [state.id]);
@@ -128,12 +128,21 @@ export const useFeeStructureModule = () => {
128
128
  });
129
129
  }, [dispatch]);
130
130
  const applyFilters = useCallback(() => {
131
+ closeDrawer();
132
+ dispatch({
133
+ type: FEE_STRUCTURE_ACTION_TYPES.SET_INPUT_FIELD,
134
+ payload: { key: "filterEnabled", value: state.filterEnabled },
135
+ });
131
136
  dispatch({
132
137
  type: FEE_STRUCTURE_ACTION_TYPES.SET_CURRENT_PAGE,
133
138
  payload: { currentPage: 1 },
134
139
  });
135
- closeDrawer();
136
- }, [dispatch, closeDrawer]);
140
+ listFetchNow === null || listFetchNow === void 0 ? void 0 : listFetchNow(undefined, {
141
+ params: Object.assign({ currentPage: 1, pageLimit: state.pageLimit, schoolId }, (state.filterEnabled !== undefined
142
+ ? { filterEnabled: String(state.filterEnabled) }
143
+ : {})),
144
+ });
145
+ }, [closeDrawer, dispatch, listFetchNow, schoolId, state.filterEnabled, state.pageLimit]);
137
146
  const clearFilters = useCallback(() => {
138
147
  dispatch({
139
148
  type: FEE_STRUCTURE_ACTION_TYPES.SET_FILTERS,
@@ -143,7 +152,14 @@ export const useFeeStructureModule = () => {
143
152
  type: FEE_STRUCTURE_ACTION_TYPES.SET_CURRENT_PAGE,
144
153
  payload: { currentPage: 1 },
145
154
  });
146
- }, [dispatch]);
155
+ listFetchNow === null || listFetchNow === void 0 ? void 0 : listFetchNow(undefined, {
156
+ params: {
157
+ currentPage: 1,
158
+ pageLimit: state.pageLimit,
159
+ schoolId,
160
+ },
161
+ });
162
+ }, [dispatch, listFetchNow, state.pageLimit, schoolId]);
147
163
  const toggleStatus = useCallback((row) => {
148
164
  updateFetchNow(undefined, {
149
165
  body: JSON.stringify(Object.assign(Object.assign({}, row), { enabled: !(row === null || row === void 0 ? void 0 : row.enabled) })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.91",
3
+ "version": "0.3.92",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",