@appcorp/fusion-storybook 0.3.85 → 0.3.87
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/index.d.ts +3 -0
- package/base-modules/student-fee/context/index.js +3 -0
- package/base-modules/student-fee/context/student-fee-api-provider.d.ts +16 -0
- package/base-modules/student-fee/context/student-fee-api-provider.js +233 -0
- package/base-modules/student-fee/context/use-student-fee-module.js +76 -181
- package/base-modules/student-fee/filter.js +5 -16
- package/base-modules/student-fee/page.js +2 -1
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -6,30 +6,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
* Filter UI for the student-fee list. Supports filterEnabled (radio) and
|
|
7
7
|
* filterStatus (payment status combobox).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* (each time the filter drawer opens). We only need state + a simple
|
|
13
|
-
* handleChange, which context provides directly.
|
|
9
|
+
* The API provider (StudentFeeApiProvider) manages a single useModuleEntityV2
|
|
10
|
+
* instance shared across all consumers, so calling useStudentFeeModule from
|
|
11
|
+
* child components no longer creates redundant API hooks or auto-fetch effects.
|
|
14
12
|
*/
|
|
15
|
-
import { useCallback } from "react";
|
|
16
13
|
import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
17
14
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
18
|
-
import {
|
|
15
|
+
import { useStudentFeeModule } from "./context";
|
|
19
16
|
import { PAYMENT_STATUS_OPTIONS } from "./constants";
|
|
20
17
|
import { STUDENT_FEE_API_ROUTES } from "../../constants";
|
|
21
18
|
import { useTranslations } from "next-intl";
|
|
22
19
|
export const StudentFeeFilter = () => {
|
|
23
|
-
const { state,
|
|
20
|
+
const { state, handleChange } = useStudentFeeModule();
|
|
24
21
|
const { filterEnabled, filterStatus } = state;
|
|
25
|
-
const handleChange = useCallback((field, value) => {
|
|
26
|
-
if (field === "filterEnabled" || field === "filterStatus") {
|
|
27
|
-
dispatch({
|
|
28
|
-
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
29
|
-
payload: { key: field, value },
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}, [dispatch]);
|
|
33
22
|
const t = useTranslations("studentFee");
|
|
34
23
|
const paymentStatusLabelMap = {
|
|
35
24
|
PENDING: t("formOptionPending"),
|
|
@@ -19,6 +19,7 @@ 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
21
|
import { useStudentFeeModule, StudentFeeProvider, STUDENT_FEE_ACTION_TYPES, } from "./context";
|
|
22
|
+
import { StudentFeeApiProvider } from "./context/student-fee-api-provider";
|
|
22
23
|
import { StudentFeeFilter } from "./filter";
|
|
23
24
|
import { StudentFeeForm } from "./form";
|
|
24
25
|
import { StudentFeeMoreActions } from "./more-actions";
|
|
@@ -199,4 +200,4 @@ const StudentFeePageInner = (props) => {
|
|
|
199
200
|
// ============================================================================
|
|
200
201
|
// PAGE EXPORTS
|
|
201
202
|
// ============================================================================
|
|
202
|
-
export const StudentFeePage = (props) => (_jsx(StudentFeeProvider, { children: _jsx(StudentFeePageInner, Object.assign({}, props)) }));
|
|
203
|
+
export const StudentFeePage = (props) => (_jsx(StudentFeeProvider, { children: _jsx(StudentFeeApiProvider, { children: _jsx(StudentFeePageInner, Object.assign({}, props)) }) }));
|