@appcorp/fusion-storybook 0.2.67 → 0.2.69
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.
|
@@ -16,6 +16,7 @@ import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
|
16
16
|
import { useTranslations } from "next-intl";
|
|
17
17
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
18
18
|
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
19
|
+
import { useEffect } from "storybook/internal/preview-api";
|
|
19
20
|
export const FeeStructureForm = () => {
|
|
20
21
|
var _a, _b;
|
|
21
22
|
const { state, handleChange } = useFeeStructureModule();
|
|
@@ -40,10 +41,14 @@ export const FeeStructureForm = () => {
|
|
|
40
41
|
"One-time": t("formOptionOneTime"),
|
|
41
42
|
};
|
|
42
43
|
const workspace = getCachedWorkspaceSync();
|
|
43
|
-
const { data: classes } = useFetch(
|
|
44
|
+
const { fetchNow, data: classes } = useFetch(FEE_STRUCTURE_API_ROUTES.CLASS, {
|
|
44
45
|
params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
|
|
45
46
|
method: API_METHODS.GET,
|
|
46
47
|
});
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
fetchNow();
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
}, []);
|
|
47
52
|
// const cachedClasses = getCachedClassesSync();
|
|
48
53
|
const { enhancedComboboxElement: feeTypeCombo } = useEnhancedCombobox({
|
|
49
54
|
emptyText: t("formNoFeeTypeEmpty"),
|
|
@@ -104,11 +109,11 @@ export const FeeStructureForm = () => {
|
|
|
104
109
|
searchEndpoint: CLASS_API_ROUTES.UNIT,
|
|
105
110
|
searchPlaceholder: t("formSearchClassPlaceholder"),
|
|
106
111
|
formatSearchResult: (item) => {
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
-
label:
|
|
110
|
-
value:
|
|
111
|
-
}
|
|
112
|
+
const classItem = item;
|
|
113
|
+
return {
|
|
114
|
+
label: `${classItem.name} (${classItem.code})`,
|
|
115
|
+
value: classItem.id,
|
|
116
|
+
};
|
|
112
117
|
},
|
|
113
118
|
value: classId || "",
|
|
114
119
|
});
|
|
@@ -184,7 +184,7 @@ export const FeeStructureMoreActions = () => {
|
|
|
184
184
|
showSuccessToast(t("messagesBulkSuccess"));
|
|
185
185
|
}
|
|
186
186
|
const schoolId = ((_d = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _d === void 0 ? void 0 : _d.id) || "";
|
|
187
|
-
fetch(`${FEE_STRUCTURE_API_ROUTES.
|
|
187
|
+
fetch(`${FEE_STRUCTURE_API_ROUTES.UNIT}?currentPage=1&pageLimit=${pageLimit}&schoolId=${schoolId}`, {
|
|
188
188
|
headers: {
|
|
189
189
|
"Content-Type": "application/json",
|
|
190
190
|
},
|
package/constants.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare const FAMILY_MEMBER_API_ROUTES: {
|
|
|
40
40
|
readonly UNIT: "/api/v1/family-member";
|
|
41
41
|
};
|
|
42
42
|
export declare const FEE_STRUCTURE_API_ROUTES: {
|
|
43
|
-
readonly
|
|
43
|
+
readonly CLASS: "/api/v1/class";
|
|
44
44
|
readonly UNIT: "/api/v1/fee-structure";
|
|
45
45
|
readonly BULK: "/api/v1/fee-structure/bulk";
|
|
46
46
|
readonly BULK_STATUS: (jobId: string) => string;
|
package/constants.js
CHANGED
|
@@ -47,7 +47,7 @@ export const FAMILY_MEMBER_API_ROUTES = {
|
|
|
47
47
|
UNIT: "/api/v1/family-member",
|
|
48
48
|
};
|
|
49
49
|
export const FEE_STRUCTURE_API_ROUTES = {
|
|
50
|
-
|
|
50
|
+
CLASS: "/api/v1/class",
|
|
51
51
|
UNIT: "/api/v1/fee-structure",
|
|
52
52
|
BULK: "/api/v1/fee-structure/bulk",
|
|
53
53
|
BULK_STATUS: (jobId) => `/api/v1/fee-structure/bulk/${jobId}`,
|