@appcorp/fusion-storybook 0.3.68 → 0.3.70
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 +10 -0
- package/base-modules/student-fee/context/shared.js +4 -1
- package/base-modules/student-fee/context/use-student-fee-module.d.ts +2 -0
- package/base-modules/student-fee/context/use-student-fee-module.js +22 -7
- package/base-modules/student-fee/form.js +5 -3
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -56,6 +56,8 @@ 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 | "";
|
|
59
61
|
}>, initialStudentFeeState: {
|
|
60
62
|
items: StudentFeeBE[];
|
|
61
63
|
count: number;
|
|
@@ -87,6 +89,8 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
87
89
|
studentProfileId: string;
|
|
88
90
|
filterEnabled: boolean | undefined;
|
|
89
91
|
filterStatus: PAYMENT_STATUS | "";
|
|
92
|
+
appliedFilterEnabled: boolean | undefined;
|
|
93
|
+
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
90
94
|
}, StudentFeeProvider: import("react").FC<{
|
|
91
95
|
children: React.ReactNode;
|
|
92
96
|
}>, studentFeeReducer: (state: {
|
|
@@ -120,6 +124,8 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
120
124
|
studentProfileId: string;
|
|
121
125
|
filterEnabled: boolean | undefined;
|
|
122
126
|
filterStatus: PAYMENT_STATUS | "";
|
|
127
|
+
appliedFilterEnabled: boolean | undefined;
|
|
128
|
+
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
123
129
|
}, action: any) => {
|
|
124
130
|
items: StudentFeeBE[];
|
|
125
131
|
count: number;
|
|
@@ -151,6 +157,8 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
151
157
|
studentProfileId: string;
|
|
152
158
|
filterEnabled: boolean | undefined;
|
|
153
159
|
filterStatus: PAYMENT_STATUS | "";
|
|
160
|
+
appliedFilterEnabled: boolean | undefined;
|
|
161
|
+
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
154
162
|
}, useStudentFeeContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContextWithHandlers<{
|
|
155
163
|
items: StudentFeeBE[];
|
|
156
164
|
count: number;
|
|
@@ -182,4 +190,6 @@ export declare const STUDENT_FEE_ACTION_TYPES: {
|
|
|
182
190
|
studentProfileId: string;
|
|
183
191
|
filterEnabled: boolean | undefined;
|
|
184
192
|
filterStatus: PAYMENT_STATUS | "";
|
|
193
|
+
appliedFilterEnabled: boolean | undefined;
|
|
194
|
+
appliedFilterStatus: PAYMENT_STATUS | "";
|
|
185
195
|
}>;
|
|
@@ -57,9 +57,12 @@ const studentFeeConfig = {
|
|
|
57
57
|
schoolId: "",
|
|
58
58
|
status: PAYMENT_STATUS.PENDING,
|
|
59
59
|
studentProfileId: "",
|
|
60
|
-
// Filters
|
|
60
|
+
// Filters (pending — updated immediately by UI)
|
|
61
61
|
filterEnabled: undefined,
|
|
62
62
|
filterStatus: "",
|
|
63
|
+
// Applied filters (only updated on "Apply" / "Clear")
|
|
64
|
+
appliedFilterEnabled: undefined,
|
|
65
|
+
appliedFilterStatus: "",
|
|
63
66
|
},
|
|
64
67
|
};
|
|
65
68
|
// ============================================================================
|
|
@@ -68,6 +68,8 @@ 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 | "";
|
|
71
73
|
};
|
|
72
74
|
dispatch: React.Dispatch<any>;
|
|
73
75
|
};
|
|
@@ -45,13 +45,15 @@ export const useStudentFeeModule = () => {
|
|
|
45
45
|
// ============================================================================
|
|
46
46
|
const listParams = useMemo(() => {
|
|
47
47
|
var _a;
|
|
48
|
-
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.
|
|
49
|
-
? { filterEnabled: state.
|
|
50
|
-
: {})), (state.
|
|
48
|
+
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.appliedFilterEnabled !== undefined
|
|
49
|
+
? { filterEnabled: state.appliedFilterEnabled }
|
|
50
|
+
: {})), (state.appliedFilterStatus
|
|
51
|
+
? { status: state.appliedFilterStatus }
|
|
52
|
+
: {})));
|
|
51
53
|
}, [
|
|
54
|
+
state.appliedFilterEnabled,
|
|
55
|
+
state.appliedFilterStatus,
|
|
52
56
|
state.currentPage,
|
|
53
|
-
state.filterEnabled,
|
|
54
|
-
state.filterStatus,
|
|
55
57
|
state.pageLimit,
|
|
56
58
|
debouncedQuery,
|
|
57
59
|
(_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.id,
|
|
@@ -501,17 +503,30 @@ export const useStudentFeeModule = () => {
|
|
|
501
503
|
});
|
|
502
504
|
}, [dispatch]);
|
|
503
505
|
const applyFilters = useCallback(() => {
|
|
506
|
+
dispatch({
|
|
507
|
+
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
508
|
+
payload: { key: "appliedFilterEnabled", value: state.filterEnabled },
|
|
509
|
+
});
|
|
510
|
+
dispatch({
|
|
511
|
+
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
512
|
+
payload: { key: "appliedFilterStatus", value: state.filterStatus },
|
|
513
|
+
});
|
|
504
514
|
dispatch({
|
|
505
515
|
type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
506
516
|
payload: { currentPage: 1 },
|
|
507
517
|
});
|
|
508
518
|
closeDrawer();
|
|
509
|
-
}, [dispatch, closeDrawer]);
|
|
519
|
+
}, [dispatch, closeDrawer, state.filterEnabled, state.filterStatus]);
|
|
510
520
|
const clearFilters = useCallback(() => {
|
|
511
521
|
dispatch({
|
|
512
522
|
type: STUDENT_FEE_ACTION_TYPES.SET_FILTERS,
|
|
513
523
|
payload: {
|
|
514
|
-
filters: {
|
|
524
|
+
filters: {
|
|
525
|
+
filterEnabled: undefined,
|
|
526
|
+
filterStatus: "",
|
|
527
|
+
appliedFilterEnabled: undefined,
|
|
528
|
+
appliedFilterStatus: "",
|
|
529
|
+
},
|
|
515
530
|
},
|
|
516
531
|
});
|
|
517
532
|
dispatch({
|
|
@@ -11,7 +11,7 @@ import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
|
11
11
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
12
12
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
13
13
|
import { useEffect } from "react";
|
|
14
|
-
import { useStudentFeeModule } from "./context";
|
|
14
|
+
import { useStudentFeeModule, STUDENT_FEE_DRAWER } from "./context";
|
|
15
15
|
import { PAYMENT_STATUS_OPTIONS } from "./constants";
|
|
16
16
|
import { STUDENT_FEE_API_ROUTES, DISCOUNT_CODE_API_ROUTES, FEE_STRUCTURE_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } from "../../constants";
|
|
17
17
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
@@ -24,7 +24,7 @@ import { getTranslatedError } from "../../utils/get-translated-error";
|
|
|
24
24
|
export const StudentFeeForm = () => {
|
|
25
25
|
var _a, _b, _c, _d, _e;
|
|
26
26
|
const { state, handleChange } = useStudentFeeModule();
|
|
27
|
-
const { amount, amountDue, amountPaid, discountAmount, discountCodeId, dueDate, enabled, errors, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
|
|
27
|
+
const { amount, amountDue, amountPaid, discountAmount, discountCodeId, drawer, dueDate, enabled, errors, feeStructureId, paidAt, remarks, status, studentProfileId, } = state;
|
|
28
28
|
const workspace = getCachedWorkspaceSync();
|
|
29
29
|
const currency = (_b = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency) !== null && _b !== void 0 ? _b : "";
|
|
30
30
|
const t = useTranslations("studentFee");
|
|
@@ -49,11 +49,13 @@ export const StudentFeeForm = () => {
|
|
|
49
49
|
method: API_METHODS.GET,
|
|
50
50
|
});
|
|
51
51
|
useEffect(() => {
|
|
52
|
+
if (drawer !== STUDENT_FEE_DRAWER.FORM_DRAWER)
|
|
53
|
+
return;
|
|
52
54
|
studentProfileFetchNow();
|
|
53
55
|
feeStructureFetchNow();
|
|
54
56
|
discountCodeFetchNow();
|
|
55
57
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
-
}, []);
|
|
58
|
+
}, [drawer]);
|
|
57
59
|
const { enhancedComboboxElement: studentProfileIdCombo } = useEnhancedCombobox({
|
|
58
60
|
emptyText: t("formNoStudentEmpty"),
|
|
59
61
|
id: "studentProfileId",
|