@appcorp/fusion-storybook 0.3.88 → 0.3.90
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.
|
@@ -414,7 +414,6 @@ export const useStudentFeeModule = () => {
|
|
|
414
414
|
state.pageLimit,
|
|
415
415
|
]);
|
|
416
416
|
const clearFilters = useCallback(() => {
|
|
417
|
-
console.log("clearFilters");
|
|
418
417
|
dispatch({
|
|
419
418
|
type: STUDENT_FEE_ACTION_TYPES.SET_FILTERS,
|
|
420
419
|
payload: {
|
|
@@ -458,7 +457,7 @@ export const useStudentFeeModule = () => {
|
|
|
458
457
|
});
|
|
459
458
|
try {
|
|
460
459
|
const res = await fetch(STUDENT_FEE_API_ROUTES.CREATE_MONTHLY, {
|
|
461
|
-
method:
|
|
460
|
+
method: API_METHODS.POST,
|
|
462
461
|
headers: { "Content-Type": "application/json" },
|
|
463
462
|
body: JSON.stringify({ schoolId }),
|
|
464
463
|
});
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { FC } from "react";
|
|
16
16
|
import { USER_ROLE } from "../../type";
|
|
17
|
-
interface
|
|
17
|
+
interface ConfigProps {
|
|
18
|
+
clearFilters: () => void;
|
|
19
|
+
dispatch: React.Dispatch<{
|
|
20
|
+
type: string;
|
|
21
|
+
payload?: unknown;
|
|
22
|
+
}>;
|
|
18
23
|
drawerButtonCancel: string;
|
|
19
24
|
drawerButtonSave: string;
|
|
20
25
|
drawerFilterDescription: string;
|
|
@@ -42,6 +47,8 @@ interface Props {
|
|
|
42
47
|
tableDescription: string;
|
|
43
48
|
tableSearchPlaceholder: string;
|
|
44
49
|
tableTitle: string;
|
|
50
|
+
}
|
|
51
|
+
interface Props extends ConfigProps {
|
|
45
52
|
userRole: USER_ROLE;
|
|
46
53
|
}
|
|
47
54
|
export declare const StudentFeePage: FC<Props>;
|
|
@@ -18,7 +18,7 @@ import { useMemo } from "react";
|
|
|
18
18
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
19
19
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
20
20
|
import { DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions/general/format-date";
|
|
21
|
-
import { useStudentFeeModule, StudentFeeProvider
|
|
21
|
+
import { useStudentFeeModule, StudentFeeProvider } from "./context";
|
|
22
22
|
import { StudentFeeApiProvider } from "./context/student-fee-api-provider";
|
|
23
23
|
import { StudentFeeFilter } from "./filter";
|
|
24
24
|
import { StudentFeeForm } from "./form";
|
|
@@ -79,22 +79,9 @@ const createComponentInstances = () => ({
|
|
|
79
79
|
misc1: _jsx(StudentFeeMonthly, {}),
|
|
80
80
|
misc2: _jsx(StudentFeeSingle, {}),
|
|
81
81
|
});
|
|
82
|
-
const createStudentFeeConfig = ({
|
|
82
|
+
const createStudentFeeConfig = ({ clearFilters, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMisc1Description, drawerMisc1Title, drawerMisc2Description, drawerMisc2Title, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderAmount, tableColumnHeaderAmountDue, tableColumnHeaderAmountPaid, tableColumnHeaderDueDate, tableColumnHeaderFeeStructure, tableColumnHeaderId, tableColumnHeaderRemarks, tableColumnHeaderStatus, tableColumnHeaderStudent, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
|
|
83
83
|
const components = createComponentInstances();
|
|
84
84
|
return {
|
|
85
|
-
moduleName: "studentFee",
|
|
86
|
-
tableColumns: [
|
|
87
|
-
{ label: tableColumnHeaderId, width: "5%" },
|
|
88
|
-
{ label: tableColumnHeaderStudent, width: "12%" },
|
|
89
|
-
{ label: tableColumnHeaderFeeStructure, width: "12%" },
|
|
90
|
-
{ label: tableColumnHeaderAmount, width: "10%" },
|
|
91
|
-
{ label: tableColumnHeaderAmountPaid, width: "10%" },
|
|
92
|
-
{ label: tableColumnHeaderAmountDue, width: "10%" },
|
|
93
|
-
{ label: tableColumnHeaderDueDate, width: "10%" },
|
|
94
|
-
{ label: tableColumnHeaderStatus, width: "10%" },
|
|
95
|
-
{ label: tableColumnHeaderRemarks, width: "11%" },
|
|
96
|
-
{ label: tableColumnHeaderActions, width: "5%" },
|
|
97
|
-
],
|
|
98
85
|
cancelLabel: drawerButtonCancel,
|
|
99
86
|
drawerFilterDescription,
|
|
100
87
|
drawerFilterTitle,
|
|
@@ -112,25 +99,40 @@ const createStudentFeeConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave
|
|
|
112
99
|
formContent: components.form,
|
|
113
100
|
misc1Content: components.misc1,
|
|
114
101
|
misc2Content: components.misc2,
|
|
102
|
+
moduleName: "studentFee",
|
|
115
103
|
moreActionsContent: components.moreActions,
|
|
104
|
+
onClearFilters: clearFilters,
|
|
116
105
|
saveLabel: drawerButtonSave,
|
|
117
106
|
searchPlaceholder: tableSearchPlaceholder,
|
|
107
|
+
tableColumns: [
|
|
108
|
+
{ label: tableColumnHeaderId, width: "5%" },
|
|
109
|
+
{ label: tableColumnHeaderStudent, width: "12%" },
|
|
110
|
+
{ label: tableColumnHeaderFeeStructure, width: "12%" },
|
|
111
|
+
{ label: tableColumnHeaderAmount, width: "10%" },
|
|
112
|
+
{ label: tableColumnHeaderAmountPaid, width: "10%" },
|
|
113
|
+
{ label: tableColumnHeaderAmountDue, width: "10%" },
|
|
114
|
+
{ label: tableColumnHeaderDueDate, width: "10%" },
|
|
115
|
+
{ label: tableColumnHeaderStatus, width: "10%" },
|
|
116
|
+
{ label: tableColumnHeaderRemarks, width: "11%" },
|
|
117
|
+
{ label: tableColumnHeaderActions, width: "5%" },
|
|
118
|
+
],
|
|
118
119
|
tableDescription,
|
|
119
120
|
tableTitle,
|
|
120
121
|
viewContent: components.view,
|
|
121
|
-
onClearFilters: () => {
|
|
122
|
-
dispatch({ type: STUDENT_FEE_ACTION_TYPES.RESET_FORM });
|
|
123
|
-
},
|
|
124
122
|
};
|
|
125
123
|
};
|
|
126
124
|
// ============================================================================
|
|
127
125
|
// STABLE PAGE COMPONENT (created once, outside render)
|
|
128
126
|
// ============================================================================
|
|
129
127
|
const GenericStudentFeePage = createGenericModulePage();
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// INNER PAGE (requires StudentFeeProvider context)
|
|
130
|
+
// ============================================================================
|
|
130
131
|
const StudentFeePageInner = (props) => {
|
|
131
132
|
const context = useStudentFeeModule();
|
|
132
133
|
// Memoize config creation - destructure props to avoid object reference changes
|
|
133
134
|
const studentFeeConfig = useMemo(() => createStudentFeeConfig({
|
|
135
|
+
clearFilters: context.clearFilters,
|
|
134
136
|
dispatch: context.dispatch,
|
|
135
137
|
drawerButtonCancel: props.drawerButtonCancel,
|
|
136
138
|
drawerButtonSave: props.drawerButtonSave,
|
|
@@ -160,6 +162,7 @@ const StudentFeePageInner = (props) => {
|
|
|
160
162
|
tableSearchPlaceholder: props.tableSearchPlaceholder,
|
|
161
163
|
tableTitle: props.tableTitle,
|
|
162
164
|
}), [
|
|
165
|
+
context.clearFilters,
|
|
163
166
|
context.dispatch,
|
|
164
167
|
props.drawerButtonCancel,
|
|
165
168
|
props.drawerButtonSave,
|
|
@@ -189,13 +192,13 @@ const StudentFeePageInner = (props) => {
|
|
|
189
192
|
props.tableTitle,
|
|
190
193
|
]);
|
|
191
194
|
const hasPermission = resolveRbacPermissions({
|
|
192
|
-
userRole: props.userRole,
|
|
193
195
|
moduleName: "Student Fee",
|
|
196
|
+
userRole: props.userRole,
|
|
194
197
|
});
|
|
195
198
|
if (!hasPermission) {
|
|
196
199
|
return _jsx(RbacNoAccess, { moduleName: "Student Fee" });
|
|
197
200
|
}
|
|
198
|
-
return (_jsx("div", { className: "p-4", children: _jsx(GenericStudentFeePage, {
|
|
201
|
+
return (_jsx("div", { className: "p-4", children: _jsx(GenericStudentFeePage, { context: context, overrideConfig: studentFeeConfig, tableBodyCols: tableBodyCols }) }));
|
|
199
202
|
};
|
|
200
203
|
// ============================================================================
|
|
201
204
|
// PAGE EXPORTS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/fusion-storybook",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.90",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build-storybook": "storybook build",
|
|
6
6
|
"build:next": "next build",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@appcorp/shadcn": "^2.0.
|
|
40
|
+
"@appcorp/shadcn": "^2.0.14",
|
|
41
41
|
"@chromatic-com/storybook": "^5.1.2",
|
|
42
42
|
"@commitlint/cli": "^20.5.0",
|
|
43
43
|
"@commitlint/config-conventional": "^20.5.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@radix-ui/react-slider": "^1",
|
|
56
56
|
"@radix-ui/react-slot": "^1",
|
|
57
57
|
"@radix-ui/react-toast": "^1",
|
|
58
|
-
"@react-pakistan/util-functions": "^3.0.
|
|
58
|
+
"@react-pakistan/util-functions": "^3.0.9",
|
|
59
59
|
"@storybook/addon-a11y": "^10.3.4",
|
|
60
60
|
"@storybook/addon-docs": "^10.3.4",
|
|
61
61
|
"@storybook/addon-onboarding": "^10.3.4",
|