@appcorp/fusion-storybook 0.2.55 → 0.2.57
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/attendance/more-actions.js +2 -2
- package/base-modules/course/form.js +4 -4
- package/base-modules/enrollment/form.js +26 -9
- package/base-modules/fee-structure/form.js +2 -2
- package/base-modules/section/form.js +2 -2
- package/base-modules/student-fee/form.js +2 -2
- package/base-modules/workspace/form.js +2 -2
- package/constants.d.ts +3 -0
- package/constants.js +3 -0
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -4,7 +4,7 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
|
|
|
4
4
|
import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
|
|
5
5
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
-
import {
|
|
7
|
+
import { COURSE_API_ROUTES } from "../../constants";
|
|
8
8
|
export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labelCourseInfo, labelCoursePlaceholder, labelNoCourseFound, labelRemarks, labelRemarksInfo, labelRemarksPlaceholder, labelSearchCourses, labelStatusAbsent, labelStatusExcused, labelStatusHalfDay, labelStatusLate, labelStatusPresent, }) => {
|
|
9
9
|
// const enrollment = getCachedEnrollmentsSync().items;
|
|
10
10
|
// const studentProfiles = getCachedStudentProfilesSync().items;
|
|
@@ -25,7 +25,7 @@ export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labe
|
|
|
25
25
|
})),
|
|
26
26
|
placeholder: labelCoursePlaceholder,
|
|
27
27
|
required: true,
|
|
28
|
-
searchEndpoint:
|
|
28
|
+
searchEndpoint: COURSE_API_ROUTES.UNIT,
|
|
29
29
|
searchPlaceholder: labelSearchCourses,
|
|
30
30
|
formatSearchResult: (item) => {
|
|
31
31
|
var _a, _b;
|
|
@@ -10,7 +10,7 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
10
10
|
import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
11
11
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
12
12
|
import { useCourseModule } from "./context";
|
|
13
|
-
import {
|
|
13
|
+
import { SECTION_API_ROUTES, SUBJECT_API_ROUTES, TEACHER_API_ROUTES, } from "../../constants";
|
|
14
14
|
import { useTranslations } from "next-intl";
|
|
15
15
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
16
16
|
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
@@ -53,7 +53,7 @@ export const CourseForm = () => {
|
|
|
53
53
|
}),
|
|
54
54
|
placeholder: t("sectionPlaceholder"),
|
|
55
55
|
required: true,
|
|
56
|
-
searchEndpoint:
|
|
56
|
+
searchEndpoint: SECTION_API_ROUTES.UNIT,
|
|
57
57
|
searchPlaceholder: t("formSearchSectionsPlaceholder"),
|
|
58
58
|
formatSearchResult: (item) => {
|
|
59
59
|
var _a, _b;
|
|
@@ -80,7 +80,7 @@ export const CourseForm = () => {
|
|
|
80
80
|
})),
|
|
81
81
|
placeholder: t("formSubjectPlaceholder"),
|
|
82
82
|
required: true,
|
|
83
|
-
searchEndpoint:
|
|
83
|
+
searchEndpoint: SUBJECT_API_ROUTES.UNIT,
|
|
84
84
|
searchPlaceholder: t("formSearchSubjectsPlaceholder"),
|
|
85
85
|
formatSearchResult: (item) => {
|
|
86
86
|
var _a, _b;
|
|
@@ -113,7 +113,7 @@ export const CourseForm = () => {
|
|
|
113
113
|
})),
|
|
114
114
|
placeholder: t("formTeacherPlaceholder"),
|
|
115
115
|
required: true,
|
|
116
|
-
searchEndpoint:
|
|
116
|
+
searchEndpoint: TEACHER_API_ROUTES.UNIT,
|
|
117
117
|
searchPlaceholder: t("formSearchTeachersPlaceholder"),
|
|
118
118
|
formatSearchResult: (item) => {
|
|
119
119
|
var _a, _b;
|
|
@@ -13,31 +13,48 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
13
13
|
import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
14
14
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
15
15
|
import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
16
|
-
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
16
|
+
import { API_METHODS, DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions";
|
|
17
17
|
import { useEnrollmentModule } from "./context";
|
|
18
|
-
import {
|
|
19
|
-
import { getCachedSectionsSync } from "../section/cache";
|
|
20
|
-
import { ENROLLMENT_API_ROUTES } from "../../constants";
|
|
18
|
+
import { SECTION_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } from "../../constants";
|
|
21
19
|
import { useTranslations } from "next-intl";
|
|
20
|
+
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
21
|
+
import { useEffect } from "storybook/internal/preview-api";
|
|
22
|
+
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
22
23
|
// ============================================================================
|
|
23
24
|
// COMPONENT
|
|
24
25
|
// ============================================================================
|
|
25
26
|
export const EnrollmentForm = () => {
|
|
26
27
|
const { state: { enabled, enrollmentDate, errors, sectionId, studentProfileId }, handleChange, } = useEnrollmentModule();
|
|
28
|
+
const workspace = getCachedWorkspaceSync();
|
|
27
29
|
const t = useTranslations("enrollment");
|
|
30
|
+
const { fetchNow: studentProfileFetchNow, data: studentProfileData } = useFetch(STUDENT_PROFILE_API_ROUTES.UNIT, {
|
|
31
|
+
method: API_METHODS.GET,
|
|
32
|
+
params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
|
|
33
|
+
});
|
|
34
|
+
const { fetchNow: sectionFetchNow, data: sectionData } = useFetch(SECTION_API_ROUTES.UNIT, {
|
|
35
|
+
method: API_METHODS.GET,
|
|
36
|
+
params: { workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id },
|
|
37
|
+
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (workspace === null || workspace === void 0 ? void 0 : workspace.id) {
|
|
40
|
+
studentProfileFetchNow();
|
|
41
|
+
sectionFetchNow();
|
|
42
|
+
}
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
+
}, [workspace === null || workspace === void 0 ? void 0 : workspace.id]);
|
|
28
45
|
const { enhancedComboboxElement: studentProfileIdCombo } = useEnhancedCombobox({
|
|
29
46
|
emptyText: t("formNoStudentEmpty"),
|
|
30
47
|
id: "studentProfileId",
|
|
31
48
|
info: t("formStudentInfo"),
|
|
32
49
|
label: t("formStudentLabel"),
|
|
33
50
|
onValueChange: (value) => handleChange("studentProfileId", value),
|
|
34
|
-
options: (
|
|
51
|
+
options: ((studentProfileData === null || studentProfileData === void 0 ? void 0 : studentProfileData.items) || []).map((s) => ({
|
|
35
52
|
value: s.id,
|
|
36
|
-
label: s.studentCode
|
|
53
|
+
label: s.studentCode,
|
|
37
54
|
})),
|
|
38
55
|
placeholder: t("formStudentPlaceholder"),
|
|
39
56
|
required: true,
|
|
40
|
-
searchEndpoint:
|
|
57
|
+
searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
|
|
41
58
|
searchPlaceholder: t("formSearchStudentsPlaceholder"),
|
|
42
59
|
formatSearchResult: (item) => {
|
|
43
60
|
var _a, _b;
|
|
@@ -54,7 +71,7 @@ export const EnrollmentForm = () => {
|
|
|
54
71
|
info: t("sectionInfo"),
|
|
55
72
|
label: t("section"),
|
|
56
73
|
onValueChange: (value) => handleChange("sectionId", value),
|
|
57
|
-
options: (
|
|
74
|
+
options: ((sectionData === null || sectionData === void 0 ? void 0 : sectionData.items) || []).map((s) => {
|
|
58
75
|
var _a;
|
|
59
76
|
return ({
|
|
60
77
|
value: s.id,
|
|
@@ -63,7 +80,7 @@ export const EnrollmentForm = () => {
|
|
|
63
80
|
}),
|
|
64
81
|
placeholder: t("sectionPlaceholder"),
|
|
65
82
|
required: true,
|
|
66
|
-
searchEndpoint:
|
|
83
|
+
searchEndpoint: SECTION_API_ROUTES.UNIT,
|
|
67
84
|
searchPlaceholder: t("formSearchSectionsPlaceholder"),
|
|
68
85
|
formatSearchResult: (item) => {
|
|
69
86
|
var _a, _b;
|
|
@@ -11,7 +11,7 @@ import { EnhancedInput } from "@appcorp/shadcn/components/enhanced-input";
|
|
|
11
11
|
import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
12
12
|
import { useFeeStructureModule } from "./context";
|
|
13
13
|
import { FEE_TYPE_OPTIONS, FREQUENCY_OPTIONS } from "./constants";
|
|
14
|
-
import { FEE_STRUCTURE_API_ROUTES } from "../../constants";
|
|
14
|
+
import { CLASS_API_ROUTES, FEE_STRUCTURE_API_ROUTES } from "../../constants";
|
|
15
15
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
16
16
|
import { useTranslations } from "next-intl";
|
|
17
17
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
@@ -101,7 +101,7 @@ export const FeeStructureForm = () => {
|
|
|
101
101
|
label: `${cls.name} (${cls.code})`,
|
|
102
102
|
})),
|
|
103
103
|
placeholder: t("formClassPlaceholder"),
|
|
104
|
-
searchEndpoint:
|
|
104
|
+
searchEndpoint: CLASS_API_ROUTES.UNIT,
|
|
105
105
|
searchPlaceholder: t("formSearchClassPlaceholder"),
|
|
106
106
|
formatSearchResult: (item) => {
|
|
107
107
|
var _a, _b;
|
|
@@ -12,7 +12,7 @@ import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
|
12
12
|
import { useSectionModule } from "./context";
|
|
13
13
|
import { useTranslations } from "next-intl";
|
|
14
14
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
15
|
-
import {
|
|
15
|
+
import { CLASS_API_ROUTES } from "../../constants";
|
|
16
16
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
17
17
|
import { API_METHODS } from "@react-pakistan/util-functions";
|
|
18
18
|
export const SectionForm = () => {
|
|
@@ -36,7 +36,7 @@ export const SectionForm = () => {
|
|
|
36
36
|
}))) || [],
|
|
37
37
|
placeholder: t("formClassPlaceholder"),
|
|
38
38
|
required: true,
|
|
39
|
-
searchEndpoint:
|
|
39
|
+
searchEndpoint: CLASS_API_ROUTES.UNIT,
|
|
40
40
|
searchPlaceholder: t("formSearchClassesPlaceholder"),
|
|
41
41
|
formatSearchResult: (item) => {
|
|
42
42
|
var _a, _b;
|
|
@@ -13,7 +13,7 @@ import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox
|
|
|
13
13
|
import { useMemo } from "react";
|
|
14
14
|
import { useStudentFeeModule } from "./context";
|
|
15
15
|
import { PAYMENT_STATUS_OPTIONS } from "./constants";
|
|
16
|
-
import { STUDENT_FEE_API_ROUTES, DISCOUNT_CODE_API_ROUTES, FEE_STRUCTURE_API_ROUTES, } from "../../constants";
|
|
16
|
+
import { STUDENT_FEE_API_ROUTES, DISCOUNT_CODE_API_ROUTES, FEE_STRUCTURE_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } from "../../constants";
|
|
17
17
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
18
18
|
import { API_METHODS, DATE_FORMATS, formatDate, } from "@react-pakistan/util-functions";
|
|
19
19
|
import { DISCOUNT_TYPE, } from "../../type";
|
|
@@ -71,7 +71,7 @@ export const StudentFeeForm = () => {
|
|
|
71
71
|
})),
|
|
72
72
|
placeholder: t("formStudentPlaceholder"),
|
|
73
73
|
required: true,
|
|
74
|
-
searchEndpoint:
|
|
74
|
+
searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
|
|
75
75
|
searchPlaceholder: t("formSearchStudentsPlaceholder"),
|
|
76
76
|
formatSearchResult: (item) => {
|
|
77
77
|
var _a, _b;
|
|
@@ -13,7 +13,7 @@ import { EnhancedTextarea } from "@appcorp/shadcn/components/enhanced-textarea";
|
|
|
13
13
|
import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
|
|
14
14
|
import { Shield, Eye, EyeOff } from "lucide-react";
|
|
15
15
|
import { secretKeys } from "./constants";
|
|
16
|
-
import {
|
|
16
|
+
import { PLAN_API_ROUTES } from "../../constants";
|
|
17
17
|
const SecretsEditor = ({ secrets, errors, onChange, secretPlaceholder, }) => {
|
|
18
18
|
const [visibleMap, setVisibleMap] = useState(() => Object.fromEntries(secretKeys.map((k) => [k, false])));
|
|
19
19
|
const toggle = (key) => setVisibleMap((s) => (Object.assign(Object.assign({}, s), { [key]: !s[key] })));
|
|
@@ -45,7 +45,7 @@ export const WorkspaceForm = () => {
|
|
|
45
45
|
})),
|
|
46
46
|
placeholder: t("formPlanPlaceholder"),
|
|
47
47
|
info: t("formPlanInfo"),
|
|
48
|
-
searchEndpoint:
|
|
48
|
+
searchEndpoint: PLAN_API_ROUTES.UNIT,
|
|
49
49
|
formatSearchResult: (item) => {
|
|
50
50
|
var _a, _b;
|
|
51
51
|
return ({
|
package/constants.d.ts
CHANGED
|
@@ -46,6 +46,9 @@ export declare const FEE_STRUCTURE_API_ROUTES: {
|
|
|
46
46
|
readonly BULK: "/api/v1/fee-structure/bulk";
|
|
47
47
|
readonly BULK_STATUS: (jobId: string) => string;
|
|
48
48
|
};
|
|
49
|
+
export declare const PLAN_API_ROUTES: {
|
|
50
|
+
readonly UNIT: "/api/v1/plan";
|
|
51
|
+
};
|
|
49
52
|
export declare const RBAC_API_ROUTES: Record<string, string>;
|
|
50
53
|
export declare const SCHOOL_API_ROUTES: Record<string, string>;
|
|
51
54
|
export declare const SECTION_API_ROUTES: {
|
package/constants.js
CHANGED
|
@@ -53,6 +53,9 @@ export const FEE_STRUCTURE_API_ROUTES = {
|
|
|
53
53
|
BULK: "/api/v1/fee-structure/bulk",
|
|
54
54
|
BULK_STATUS: (jobId) => `/api/v1/fee-structure/bulk/${jobId}`,
|
|
55
55
|
};
|
|
56
|
+
export const PLAN_API_ROUTES = {
|
|
57
|
+
UNIT: "/api/v1/plan",
|
|
58
|
+
};
|
|
56
59
|
export const RBAC_API_ROUTES = {
|
|
57
60
|
UNIT: "/api/v1/role",
|
|
58
61
|
PERMISSIONS_LIST: "/api/v1/permission",
|