@appcorp/fusion-storybook 0.3.89 → 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.
|
@@ -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
|