@appcorp/fusion-storybook 0.3.83 → 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 +16 -19
- 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,18 +44,7 @@ export const useStudentFeeModule = () => {
|
|
|
44
44
|
// ============================================================================
|
|
45
45
|
// 1.4.2 API PARAMETERS
|
|
46
46
|
// ============================================================================
|
|
47
|
-
const listParams = useMemo(() => (Object.assign(
|
|
48
|
-
? { filterEnabled: String(state.filterEnabled) }
|
|
49
|
-
: {})), (state.filterStatus ? { status: state.filterStatus } : {}))),
|
|
50
|
-
// eslint-disable-next-line
|
|
51
|
-
[
|
|
52
|
-
state.currentPage,
|
|
53
|
-
// state.filterEnabled,
|
|
54
|
-
// state.filterStatus,
|
|
55
|
-
state.pageLimit,
|
|
56
|
-
debouncedQuery,
|
|
57
|
-
schoolId,
|
|
58
|
-
]);
|
|
47
|
+
const listParams = useMemo(() => (Object.assign({ currentPage: state.currentPage, pageLimit: state.pageLimit, schoolId }, (debouncedQuery ? { searchQuery: debouncedQuery } : {}))), [state.currentPage, state.pageLimit, debouncedQuery, schoolId]);
|
|
59
48
|
const updateParams = useMemo(() => ({
|
|
60
49
|
amount: Number(state.amount),
|
|
61
50
|
amountDue: Number(state.amountDue),
|
|
@@ -512,22 +501,30 @@ export const useStudentFeeModule = () => {
|
|
|
512
501
|
});
|
|
513
502
|
}, [dispatch]);
|
|
514
503
|
const applyFilters = useCallback(() => {
|
|
515
|
-
const currentEnabled = state.filterEnabled;
|
|
516
|
-
const currentStatus = state.filterStatus;
|
|
517
504
|
closeDrawer();
|
|
518
505
|
dispatch({
|
|
519
506
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
520
|
-
payload: { key: "filterEnabled", value:
|
|
507
|
+
payload: { key: "filterEnabled", value: state.filterEnabled },
|
|
521
508
|
});
|
|
522
509
|
dispatch({
|
|
523
510
|
type: STUDENT_FEE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
524
|
-
payload: { key: "filterStatus", value:
|
|
511
|
+
payload: { key: "filterStatus", value: state.filterStatus },
|
|
525
512
|
});
|
|
526
513
|
dispatch({
|
|
527
514
|
type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
528
515
|
payload: { currentPage: 1 },
|
|
529
516
|
});
|
|
530
|
-
|
|
517
|
+
listFetchNow === null || listFetchNow === void 0 ? void 0 : listFetchNow(undefined, {
|
|
518
|
+
params: Object.assign(Object.assign(Object.assign({}, listParams), (state.filterEnabled && { filterEnabled: state.filterEnabled })), (state.filterStatus && { filterStatus: state.filterStatus })),
|
|
519
|
+
});
|
|
520
|
+
}, [
|
|
521
|
+
closeDrawer,
|
|
522
|
+
dispatch,
|
|
523
|
+
listFetchNow,
|
|
524
|
+
listParams,
|
|
525
|
+
state.filterEnabled,
|
|
526
|
+
state.filterStatus,
|
|
527
|
+
]);
|
|
531
528
|
const clearFilters = useCallback(() => {
|
|
532
529
|
dispatch({
|
|
533
530
|
type: STUDENT_FEE_ACTION_TYPES.SET_FILTERS,
|
|
@@ -542,7 +539,8 @@ export const useStudentFeeModule = () => {
|
|
|
542
539
|
type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
543
540
|
payload: { currentPage: 1 },
|
|
544
541
|
});
|
|
545
|
-
|
|
542
|
+
listFetchNow();
|
|
543
|
+
}, [dispatch, listFetchNow]);
|
|
546
544
|
const handleSearch = useCallback((query) => {
|
|
547
545
|
dispatch({
|
|
548
546
|
type: STUDENT_FEE_ACTION_TYPES.SET_SEARCH_QUERY,
|
|
@@ -616,7 +614,6 @@ export const useStudentFeeModule = () => {
|
|
|
616
614
|
}, [dispatch, updateParams, t, showToast, updateFetchNow]);
|
|
617
615
|
const handleSubmitSingleEntry = useCallback(async (fees, amountPaid, remarks, paidAt) => {
|
|
618
616
|
var _a, _b;
|
|
619
|
-
console.log("Submitting single entry fees:", fees);
|
|
620
617
|
dispatch({
|
|
621
618
|
type: STUDENT_FEE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
622
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";
|