@appcorp/fusion-storybook 0.3.84 → 0.3.85
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/use-student-fee-module.js +4 -11
- package/base-modules/student-fee/filter.js +17 -2
- package/base-modules/student-fee/page.js +0 -2
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/base-modules/student-fee/monthly-create.d.ts +0 -0
- package/base-modules/student-fee/monthly-create.js +0 -56
- package/base-modules/student-fee/monthly-form.d.ts +0 -0
- package/base-modules/student-fee/monthly-form.js +0 -49
- package/base-modules/student-fee/single-entry-form.d.ts +0 -0
- package/base-modules/student-fee/single-entry-form.js +0 -274
- package/base-modules/student-fee/single-entry.d.ts +0 -0
- package/base-modules/student-fee/single-entry.js +0 -94
|
@@ -44,14 +44,7 @@ export const useStudentFeeModule = () => {
|
|
|
44
44
|
// ============================================================================
|
|
45
45
|
// 1.4.2 API PARAMETERS
|
|
46
46
|
// ============================================================================
|
|
47
|
-
const listParams = useMemo(() => (Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {}))), [
|
|
48
|
-
state.currentPage,
|
|
49
|
-
// state.filterEnabled,
|
|
50
|
-
// state.filterStatus,
|
|
51
|
-
state.pageLimit,
|
|
52
|
-
debouncedQuery,
|
|
53
|
-
schoolId,
|
|
54
|
-
]);
|
|
47
|
+
const listParams = useMemo(() => (Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {}))), [state.currentPage, state.pageLimit, debouncedQuery, schoolId]);
|
|
55
48
|
const updateParams = useMemo(() => ({
|
|
56
49
|
amount: Number(state.amount),
|
|
57
50
|
amountDue: Number(state.amountDue),
|
|
@@ -522,7 +515,7 @@ export const useStudentFeeModule = () => {
|
|
|
522
515
|
payload: { currentPage: 1 },
|
|
523
516
|
});
|
|
524
517
|
listFetchNow === null || listFetchNow === void 0 ? void 0 : listFetchNow(undefined, {
|
|
525
|
-
params: Object.assign(Object.assign({}, listParams), { filterEnabled: state.filterEnabled, filterStatus: state.filterStatus }),
|
|
518
|
+
params: Object.assign(Object.assign(Object.assign({}, listParams), (state.filterEnabled && { filterEnabled: state.filterEnabled })), (state.filterStatus && { filterStatus: state.filterStatus })),
|
|
526
519
|
});
|
|
527
520
|
}, [
|
|
528
521
|
closeDrawer,
|
|
@@ -546,7 +539,8 @@ export const useStudentFeeModule = () => {
|
|
|
546
539
|
type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
547
540
|
payload: { currentPage: 1 },
|
|
548
541
|
});
|
|
549
|
-
|
|
542
|
+
listFetchNow();
|
|
543
|
+
}, [dispatch, listFetchNow]);
|
|
550
544
|
const handleSearch = useCallback((query) => {
|
|
551
545
|
dispatch({
|
|
552
546
|
type: STUDENT_FEE_ACTION_TYPES.SET_SEARCH_QUERY,
|
|
@@ -620,7 +614,6 @@ export const useStudentFeeModule = () => {
|
|
|
620
614
|
}, [dispatch, updateParams, t, showToast, updateFetchNow]);
|
|
621
615
|
const handleSubmitSingleEntry = useCallback(async (fees, amountPaid, remarks, paidAt) => {
|
|
622
616
|
var _a, _b;
|
|
623
|
-
console.log("Submitting single entry fees:", fees);
|
|
624
617
|
dispatch({
|
|
625
618
|
type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
626
619
|
payload: { disabled: true },
|
|
@@ -5,16 +5,31 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*
|
|
6
6
|
* Filter UI for the student-fee list. Supports filterEnabled (radio) and
|
|
7
7
|
* filterStatus (payment status combobox).
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This component intentionally avoids useStudentFeeModule() because
|
|
10
|
+
* that hook creates an independent useModuleEntityV2 instance with its own
|
|
11
|
+
* listFetchNow + auto-fetch effect, causing a redundant API call on mount
|
|
12
|
+
* (each time the filter drawer opens). We only need state + a simple
|
|
13
|
+
* handleChange, which context provides directly.
|
|
8
14
|
*/
|
|
15
|
+
import { useCallback } from "react";
|
|
9
16
|
import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
10
17
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
11
|
-
import {
|
|
18
|
+
import { STUDENT_FEE_ACTION_TYPES, useStudentFeeContext, } from "./context/shared";
|
|
12
19
|
import { PAYMENT_STATUS_OPTIONS } from "./constants";
|
|
13
20
|
import { STUDENT_FEE_API_ROUTES } from "../../constants";
|
|
14
21
|
import { useTranslations } from "next-intl";
|
|
15
22
|
export const StudentFeeFilter = () => {
|
|
16
|
-
const { state,
|
|
23
|
+
const { state, dispatch } = useStudentFeeContext();
|
|
17
24
|
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]);
|
|
18
33
|
const t = useTranslations("studentFee");
|
|
19
34
|
const paymentStatusLabelMap = {
|
|
20
35
|
PENDING: t("formOptionPending"),
|
|
@@ -23,8 +23,6 @@ import { StudentFeeFilter } from "./filter";
|
|
|
23
23
|
import { StudentFeeForm } from "./form";
|
|
24
24
|
import { StudentFeeMoreActions } from "./more-actions";
|
|
25
25
|
import { StudentFeeView } from "./view";
|
|
26
|
-
// import { StudentFeeSingleEntry } from "./single-entry";
|
|
27
|
-
// import { StudentFeeCreateMonthly } from "./monthly-create";
|
|
28
26
|
import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
|
|
29
27
|
import { RbacNoAccess } from "../../components/rbac-no-access";
|
|
30
28
|
import { formatStudentName, formatAmount, formatAmountPaid, formatAmountDue, } from "./constants";
|