@appcorp/fusion-storybook 0.2.88 → 0.2.90
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/admission/filter.js +3 -3
- package/base-modules/admission/form.js +1 -1
- package/base-modules/admission/more-actions.js +288 -2
- package/base-modules/admission/view.js +1 -1
- package/base-modules/attendance/form.js +3 -3
- package/base-modules/campus/form.js +2 -1
- package/base-modules/campus/validate.d.ts +13 -5
- package/base-modules/campus/validate.js +24 -19
- package/base-modules/class/form.js +2 -1
- package/base-modules/class/more-actions.js +2 -2
- package/base-modules/class/validate.d.ts +10 -5
- package/base-modules/class/validate.js +18 -16
- package/base-modules/class/view.js +2 -2
- package/base-modules/course/form.js +2 -1
- package/base-modules/course/validate.d.ts +7 -5
- package/base-modules/course/validate.js +12 -13
- package/base-modules/course/view.js +3 -3
- package/base-modules/discount-code/constants.d.ts +1 -1
- package/base-modules/discount-code/constants.js +1 -1
- package/base-modules/discount-code/form.js +2 -1
- package/base-modules/discount-code/more-actions.js +1 -1
- package/base-modules/discount-code/page.d.ts +10 -10
- package/base-modules/discount-code/page.js +31 -31
- package/base-modules/discount-code/validate.d.ts +5 -0
- package/base-modules/discount-code/validate.js +8 -3
- package/base-modules/discount-code/view.js +2 -2
- package/base-modules/enrollment/form.js +3 -2
- package/base-modules/enrollment/more-actions.js +5 -5
- package/base-modules/enrollment/page.d.ts +10 -10
- package/base-modules/enrollment/page.js +31 -31
- package/base-modules/enrollment/validate.d.ts +6 -0
- package/base-modules/enrollment/validate.js +13 -5
- package/base-modules/enrollment/view.js +2 -2
- package/base-modules/expense/filter.js +1 -1
- package/base-modules/expense/form.js +3 -3
- package/base-modules/expense/more-actions.js +6 -6
- package/base-modules/expense/page.d.ts +11 -11
- package/base-modules/expense/page.js +34 -34
- package/base-modules/expense/validate.d.ts +8 -0
- package/base-modules/expense/validate.js +13 -5
- package/base-modules/expense/view.js +2 -2
- package/base-modules/family/context.js +1 -1
- package/base-modules/family/form.js +1 -1
- package/base-modules/family/more-actions.js +2 -2
- package/base-modules/family/page.d.ts +10 -10
- package/base-modules/family/page.js +31 -31
- package/base-modules/family/validate.d.ts +4 -0
- package/base-modules/family/validate.js +8 -1
- package/base-modules/family/view.js +1 -1
- package/base-modules/family-member/context.js +1 -1
- package/base-modules/family-member/form.js +2 -1
- package/base-modules/family-member/more-actions.js +5 -5
- package/base-modules/family-member/page.d.ts +40 -13
- package/base-modules/family-member/page.js +34 -34
- package/base-modules/family-member/validate.d.ts +8 -0
- package/base-modules/family-member/validate.js +20 -5
- package/base-modules/family-member/view.js +3 -3
- package/base-modules/fee-structure/form.js +5 -4
- package/base-modules/fee-structure/more-actions.js +2 -2
- package/base-modules/fee-structure/page.d.ts +11 -11
- package/base-modules/fee-structure/page.js +34 -34
- package/base-modules/fee-structure/validate.d.ts +6 -0
- package/base-modules/fee-structure/validate.js +12 -3
- package/base-modules/fee-structure/view.js +3 -3
- package/base-modules/rbac/assign-permissions.js +9 -5
- package/base-modules/rbac/filter.js +5 -3
- package/base-modules/rbac/form.js +2 -1
- package/base-modules/rbac/more-actions.d.ts +0 -5
- package/base-modules/rbac/more-actions.js +3 -1
- package/base-modules/rbac/validate.d.ts +3 -0
- package/base-modules/rbac/validate.js +7 -1
- package/base-modules/rbac/view.js +7 -5
- package/base-modules/school/drawer.js +3 -1
- package/base-modules/school/form.js +2 -1
- package/base-modules/school/validate.d.ts +8 -0
- package/base-modules/school/validate.js +17 -6
- package/base-modules/school/view.js +2 -2
- package/base-modules/section/filter.js +1 -1
- package/base-modules/section/form.js +3 -2
- package/base-modules/section/page.d.ts +8 -8
- package/base-modules/section/page.js +25 -25
- package/base-modules/section/validate.d.ts +7 -0
- package/base-modules/section/validate.js +15 -5
- package/base-modules/section/view.js +3 -3
- package/base-modules/student-fee/filter.js +1 -1
- package/base-modules/student-fee/form.js +3 -2
- package/base-modules/student-fee/page.d.ts +13 -13
- package/base-modules/student-fee/page.js +40 -40
- package/base-modules/student-fee/validate.d.ts +11 -3
- package/base-modules/student-fee/validate.js +20 -12
- package/base-modules/student-fee/view.js +4 -4
- package/base-modules/student-profile/context/use-student-profile-module.js +2 -2
- package/base-modules/student-profile/filter.js +2 -2
- package/base-modules/student-profile/form.js +6 -5
- package/base-modules/student-profile/page.d.ts +10 -10
- package/base-modules/student-profile/page.js +31 -31
- package/base-modules/student-profile/validate.d.ts +8 -2
- package/base-modules/student-profile/validate.js +13 -10
- package/base-modules/student-profile/view.js +2 -2
- package/base-modules/subject/filter.js +1 -1
- package/base-modules/subject/form.js +2 -1
- package/base-modules/subject/more-actions.js +3 -3
- package/base-modules/subject/page.d.ts +9 -9
- package/base-modules/subject/page.js +28 -28
- package/base-modules/subject/validate.d.ts +12 -1
- package/base-modules/subject/validate.js +24 -10
- package/base-modules/subject/view.js +3 -3
- package/base-modules/teacher/context.js +3 -3
- package/base-modules/teacher/filter.js +1 -1
- package/base-modules/teacher/form.js +9 -32
- package/base-modules/teacher/more-actions.js +2 -2
- package/base-modules/teacher/page.d.ts +10 -10
- package/base-modules/teacher/page.js +31 -31
- package/base-modules/teacher/validate.d.ts +5 -1
- package/base-modules/teacher/validate.js +10 -25
- package/base-modules/teacher/view.js +3 -3
- package/base-modules/user/filter.js +1 -1
- package/base-modules/user/form.js +3 -2
- package/base-modules/user/page.d.ts +9 -9
- package/base-modules/user/page.js +28 -28
- package/base-modules/user/validate.d.ts +8 -1
- package/base-modules/user/validate.js +16 -6
- package/base-modules/user/view.js +1 -1
- package/base-modules/workspace/context.js +3 -3
- package/base-modules/workspace/drawer.js +1 -1
- package/base-modules/workspace/filter.js +1 -1
- package/base-modules/workspace/form.js +6 -1
- package/base-modules/workspace/more-actions.js +1 -1
- package/base-modules/workspace/page.d.ts +1 -1
- package/base-modules/workspace/page.js +2 -2
- package/base-modules/workspace/validate.d.ts +4 -0
- package/base-modules/workspace/validate.js +6 -2
- package/base-modules/workspace/view.js +2 -2
- package/base-modules/workspace-user/context.js +6 -6
- package/base-modules/workspace-user/form.js +2 -1
- package/base-modules/workspace-user/page.d.ts +9 -9
- package/base-modules/workspace-user/page.js +28 -28
- package/base-modules/workspace-user/validate.d.ts +4 -5
- package/base-modules/workspace-user/validate.js +6 -10
- package/base-modules/workspace-user/view.js +1 -1
- package/constants.d.ts +5 -1
- package/constants.js +2 -0
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/get-translated-error.d.ts +5 -0
- package/utils/get-translated-error.js +5 -0
|
@@ -121,9 +121,9 @@ export const ClassMoreActions = () => {
|
|
|
121
121
|
const msgs = [];
|
|
122
122
|
if (method === "POST") {
|
|
123
123
|
if (!((_b = row.code) === null || _b === void 0 ? void 0 : _b.trim()))
|
|
124
|
-
msgs.push(t("
|
|
124
|
+
msgs.push(t("validationClassCodeRequired"));
|
|
125
125
|
if (!((_c = row.name) === null || _c === void 0 ? void 0 : _c.trim()))
|
|
126
|
-
msgs.push(t("
|
|
126
|
+
msgs.push(t("validationClassNameRequired"));
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
129
|
if (!((_d = row.id) === null || _d === void 0 ? void 0 : _d.trim()))
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class Validation Schema
|
|
3
|
-
*
|
|
4
|
-
* Zod validation schemas for class form data with business rules.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
2
|
+
export declare const VALIDATION_KEYS: {
|
|
3
|
+
readonly nameRequired: "validationClassNameRequired";
|
|
4
|
+
readonly nameMaxLength: "validationClassNameMaxLength";
|
|
5
|
+
readonly nameFormat: "validationClassNameFormat";
|
|
6
|
+
readonly codeRequired: "validationClassCodeRequired";
|
|
7
|
+
readonly codeMaxLength: "validationClassCodeMaxLength";
|
|
8
|
+
readonly codeFormat: "validationClassCodeFormat";
|
|
9
|
+
readonly codeMinLength: "validationClassCodeMinLength";
|
|
10
|
+
readonly descriptionMaxLength: "validationClassDescriptionMaxLength";
|
|
11
|
+
};
|
|
7
12
|
export declare const classFormValidation: z.ZodObject<{
|
|
8
13
|
name: z.ZodString;
|
|
9
14
|
code: z.ZodString;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class Validation Schema
|
|
3
|
-
*
|
|
4
|
-
* Zod validation schemas for class form data with business rules.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export const VALIDATION_KEYS = {
|
|
3
|
+
nameRequired: "validationClassNameRequired",
|
|
4
|
+
nameMaxLength: "validationClassNameMaxLength",
|
|
5
|
+
nameFormat: "validationClassNameFormat",
|
|
6
|
+
codeRequired: "validationClassCodeRequired",
|
|
7
|
+
codeMaxLength: "validationClassCodeMaxLength",
|
|
8
|
+
codeFormat: "validationClassCodeFormat",
|
|
9
|
+
codeMinLength: "validationClassCodeMinLength",
|
|
10
|
+
descriptionMaxLength: "validationClassDescriptionMaxLength",
|
|
11
|
+
};
|
|
10
12
|
export const classFormValidation = z.object({
|
|
11
13
|
name: z
|
|
12
14
|
.string()
|
|
13
|
-
.min(1,
|
|
14
|
-
.max(100,
|
|
15
|
-
.regex(/^[a-zA-Z0-9\s\-_]+$/,
|
|
15
|
+
.min(1, VALIDATION_KEYS.nameRequired)
|
|
16
|
+
.max(100, VALIDATION_KEYS.nameMaxLength)
|
|
17
|
+
.regex(/^[a-zA-Z0-9\s\-_]+$/, VALIDATION_KEYS.nameFormat),
|
|
16
18
|
code: z
|
|
17
19
|
.string()
|
|
18
|
-
.min(1,
|
|
19
|
-
.max(20,
|
|
20
|
-
.regex(/^[A-Z0-9\-_]+$/,
|
|
21
|
-
.refine((code) => code.length >= 2,
|
|
20
|
+
.min(1, VALIDATION_KEYS.codeRequired)
|
|
21
|
+
.max(20, VALIDATION_KEYS.codeMaxLength)
|
|
22
|
+
.regex(/^[A-Z0-9\-_]+$/, VALIDATION_KEYS.codeFormat)
|
|
23
|
+
.refine((code) => code.length >= 2, VALIDATION_KEYS.codeMinLength),
|
|
22
24
|
description: z
|
|
23
25
|
.string()
|
|
24
|
-
.max(500,
|
|
26
|
+
.max(500, VALIDATION_KEYS.descriptionMaxLength)
|
|
25
27
|
.optional(),
|
|
26
28
|
enabled: z.boolean().optional(),
|
|
27
29
|
});
|
|
@@ -17,6 +17,6 @@ export const ClassView = () => {
|
|
|
17
17
|
const { code, description, enabled, name } = state;
|
|
18
18
|
const t = useTranslations("class");
|
|
19
19
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(GraduationCap, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: name }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [t("viewFieldCode"), ": ", code] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(GraduationCap, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionClassDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteClassInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassName") }), _jsx("p", { className: "text-base", children: formatValue(name) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldClassCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1 md:col-span-2", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldDescription") }), _jsx("p", { className: "text-base", children: formatValue(description) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
|
|
20
|
-
? t("
|
|
21
|
-
: t("
|
|
20
|
+
? t("badgeActive")
|
|
21
|
+
: t("badgeInactive") })] })] }) })] })] }));
|
|
22
22
|
};
|
|
@@ -15,6 +15,7 @@ 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";
|
|
17
17
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
18
|
+
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
18
19
|
export const CourseForm = () => {
|
|
19
20
|
const workspace = getCachedWorkspaceSync();
|
|
20
21
|
const t = useTranslations("course");
|
|
@@ -155,5 +156,5 @@ export const CourseForm = () => {
|
|
|
155
156
|
},
|
|
156
157
|
value: teacherId,
|
|
157
158
|
});
|
|
158
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors
|
|
159
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "code", t }), id: "code", info: t("formCourseCodeInfo"), label: t("formCourseCodeLabel"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("formCourseCodePlaceholder"), required: true, value: code }), classIdCombo, sectionIdCombo, subjectIdCombo, teacherIdCombo, _jsx(EnhancedCheckbox, { label: t("formActiveCourseLabel"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("formActiveCourseInfo") })] }));
|
|
159
160
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Course Validation Schema
|
|
3
|
-
*
|
|
4
|
-
* Zod validation schemas for course form data.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
2
|
+
export declare const VALIDATION_KEYS: {
|
|
3
|
+
readonly classRequired: "validationCourseClassRequired";
|
|
4
|
+
readonly codeRequired: "validationCourseCodeRequired";
|
|
5
|
+
readonly sectionRequired: "validationCourseSectionRequired";
|
|
6
|
+
readonly subjectRequired: "validationCourseSubjectRequired";
|
|
7
|
+
readonly teacherRequired: "validationCourseTeacherRequired";
|
|
8
|
+
};
|
|
7
9
|
export declare const courseFormValidation: z.ZodObject<{
|
|
8
10
|
classId: z.ZodString;
|
|
9
11
|
code: z.ZodString;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Course Validation Schema
|
|
3
|
-
*
|
|
4
|
-
* Zod validation schemas for course form data.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export const VALIDATION_KEYS = {
|
|
3
|
+
classRequired: "validationCourseClassRequired",
|
|
4
|
+
codeRequired: "validationCourseCodeRequired",
|
|
5
|
+
sectionRequired: "validationCourseSectionRequired",
|
|
6
|
+
subjectRequired: "validationCourseSubjectRequired",
|
|
7
|
+
teacherRequired: "validationCourseTeacherRequired",
|
|
8
|
+
};
|
|
10
9
|
export const courseFormValidation = z.object({
|
|
11
|
-
classId: z.string().min(1,
|
|
12
|
-
code: z.string().min(1,
|
|
13
|
-
sectionId: z.string().min(1,
|
|
14
|
-
subjectId: z.string().min(1,
|
|
15
|
-
teacherId: z.string().min(1,
|
|
10
|
+
classId: z.string().min(1, VALIDATION_KEYS.classRequired),
|
|
11
|
+
code: z.string().min(1, VALIDATION_KEYS.codeRequired),
|
|
12
|
+
sectionId: z.string().min(1, VALIDATION_KEYS.sectionRequired),
|
|
13
|
+
subjectId: z.string().min(1, VALIDATION_KEYS.subjectRequired),
|
|
14
|
+
teacherId: z.string().min(1, VALIDATION_KEYS.teacherRequired),
|
|
16
15
|
enabled: z.boolean().optional(),
|
|
17
16
|
});
|
|
@@ -40,7 +40,7 @@ export const CourseView = () => {
|
|
|
40
40
|
teacher.teacherCode ||
|
|
41
41
|
"—"
|
|
42
42
|
: "—";
|
|
43
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookMarked, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: formatValue(code) }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [className, " \u2014 ", sectionName] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookMarked, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionCourseDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCourseInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCourseCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("
|
|
44
|
-
? t("
|
|
45
|
-
: t("
|
|
43
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "flex items-center gap-6", children: [_jsx("div", { className: "bg-primary/10 flex h-24 w-24 items-center justify-center rounded-full", children: _jsx(BookMarked, { className: "text-primary h-12 w-12" }) }), _jsxs("div", { className: "flex-1", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("h2", { className: "text-2xl font-bold", children: formatValue(code) }), enabled ? (_jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" })) : (_jsx(XCircle, { className: "h-5 w-5 text-red-500" }))] }), _jsxs("p", { className: "text-muted-foreground mt-1", children: [className, " \u2014 ", sectionName] })] })] }) }) }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookMarked, { className: "text-primary h-5 w-5" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionCourseDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteCourseInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldCourseCode") }), _jsx("p", { className: "text-base", children: formatValue(code) })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("tableColumnHeaderClass") }), _jsx("p", { className: "text-base", children: className })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("formSectionLabel") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldSubject") }), _jsx("p", { className: "text-base", children: subjectName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldTeacher") }), _jsx("p", { className: "text-base", children: teacherName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-muted-foreground text-sm font-medium", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled
|
|
44
|
+
? t("badgeActive")
|
|
45
|
+
: t("badgeInactive") })] })] }) })] })] }));
|
|
46
46
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* environment-driven (via `NEXT_PUBLIC_*`) where appropriate so CI/infra
|
|
6
6
|
* can override them without code changes.
|
|
7
7
|
*/
|
|
8
|
-
import { DISCOUNT_TYPE } from "../../
|
|
8
|
+
import { DISCOUNT_TYPE } from "../../type";
|
|
9
9
|
/**
|
|
10
10
|
* Default page limit for the discount codes list. Controlled by
|
|
11
11
|
* `NEXT_PUBLIC_PAGE_LIMIT` with a safe fallback to `10`.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* can override them without code changes.
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { DISCOUNT_TYPE } from "../../
|
|
9
|
+
import { DISCOUNT_TYPE } from "../../type";
|
|
10
10
|
// ============================================================================
|
|
11
11
|
// PAGE CONFIGURATION
|
|
12
12
|
// ============================================================================
|
|
@@ -21,6 +21,7 @@ import { EnhancedCheckbox } from "@appcorp/shadcn/components/enhanced-checkbox";
|
|
|
21
21
|
import { DISCOUNT_TYPE } from "../../type";
|
|
22
22
|
import { DISCOUNT_TYPE_OPTIONS } from "./constants";
|
|
23
23
|
import { DISCOUNT_CODE_API_ROUTES } from "../../constants";
|
|
24
|
+
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
24
25
|
export const DiscountCodeForm = () => {
|
|
25
26
|
const { state, handleChange } = useDiscountCodeModule();
|
|
26
27
|
const t = useTranslations("discountCode");
|
|
@@ -50,7 +51,7 @@ export const DiscountCodeForm = () => {
|
|
|
50
51
|
},
|
|
51
52
|
value: discountType,
|
|
52
53
|
});
|
|
53
|
-
return (_jsx("div", { className: "space-y-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: errors
|
|
54
|
+
return (_jsx("div", { className: "space-y-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "code", t }), id: "code", info: t("formDiscountCodeInfo"), label: t("formDiscountCodeLabel"), onChange: (e) => handleChange("code", e.target.value.toUpperCase()), placeholder: t("formDiscountCodePlaceholder"), required: true, value: code }), _jsx(EnhancedTextarea, { error: errors.description, id: "description", info: t("formDescriptionInfo"), label: t("formDescriptionLabel"), onChange: (e) => handleChange("description", e.target.value), placeholder: t("formDescriptionPlaceholder"), rows: 3, value: description || "" }), discountTypeCombo, _jsx(EnhancedInput, { id: "discountValue", label: t("formDiscountValueLabel"), type: "number", value: (discountValue === null || discountValue === void 0 ? void 0 : discountValue.toString()) || "", onChange: (e) => handleChange("discountValue", parseFloat(e.target.value) || 0), error: getTranslatedError({ errors, key: "discountValue", t }), placeholder: discountType === DISCOUNT_TYPE.PERCENTAGE
|
|
54
55
|
? t("formDiscountValuePlaceholderPercentage")
|
|
55
56
|
: t("formDiscountValuePlaceholderFixed"), required: true, min: 0, max: discountType === DISCOUNT_TYPE.PERCENTAGE ? 100 : undefined, step: discountType === DISCOUNT_TYPE.PERCENTAGE ? 0.1 : 0.01, info: discountType === DISCOUNT_TYPE.PERCENTAGE
|
|
56
57
|
? t("formDiscountValueInfoPercentage")
|
|
@@ -9,5 +9,5 @@ import { useTranslations } from "next-intl";
|
|
|
9
9
|
*/
|
|
10
10
|
export const DiscountCodeMoreActions = () => {
|
|
11
11
|
const t = useTranslations("discountCode");
|
|
12
|
-
return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "text-sm text-muted-foreground", children: t("
|
|
12
|
+
return (_jsx("div", { className: "space-y-4", children: _jsx("div", { className: "text-sm text-muted-foreground", children: t("moreActionsInfo") }) }));
|
|
13
13
|
};
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
import { FC } from "react";
|
|
19
19
|
import { USER_ROLE } from "../../type";
|
|
20
20
|
interface Props {
|
|
21
|
-
|
|
21
|
+
drawerButtonCancel: string;
|
|
22
|
+
drawerButtonSave: string;
|
|
22
23
|
drawerFilterDescription: string;
|
|
23
24
|
drawerFilterTitle: string;
|
|
24
25
|
drawerFormDescription: string;
|
|
@@ -27,16 +28,15 @@ interface Props {
|
|
|
27
28
|
drawerMoreActionsTitle: string;
|
|
28
29
|
drawerViewDescription: string;
|
|
29
30
|
drawerViewTitle: string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
saveLabel: string;
|
|
38
|
-
searchPlaceholder: string;
|
|
31
|
+
tableColumnHeaderActions: string;
|
|
32
|
+
tableColumnHeaderCode: string;
|
|
33
|
+
tableColumnHeaderDescription: string;
|
|
34
|
+
tableColumnHeaderDiscountType: string;
|
|
35
|
+
tableColumnHeaderDiscountValue: string;
|
|
36
|
+
tableColumnHeaderEnabled: string;
|
|
37
|
+
tableColumnHeaderId: string;
|
|
39
38
|
tableDescription: string;
|
|
39
|
+
tableSearchPlaceholder: string;
|
|
40
40
|
tableTitle: string;
|
|
41
41
|
userRole: USER_ROLE;
|
|
42
42
|
}
|
|
@@ -48,20 +48,20 @@ const createComponentInstances = () => ({
|
|
|
48
48
|
moreActions: _jsx(DiscountCodeMoreActions, {}),
|
|
49
49
|
view: _jsx(DiscountCodeView, {}),
|
|
50
50
|
});
|
|
51
|
-
const createDiscountCodeConfig = ({
|
|
51
|
+
const createDiscountCodeConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderCode, tableColumnHeaderDescription, tableColumnHeaderDiscountType, tableColumnHeaderDiscountValue, tableColumnHeaderEnabled, tableColumnHeaderId, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
|
|
52
52
|
const components = createComponentInstances();
|
|
53
53
|
return {
|
|
54
54
|
moduleName: "discountCode",
|
|
55
55
|
tableColumns: [
|
|
56
|
-
{ label:
|
|
57
|
-
{ label:
|
|
58
|
-
{ label:
|
|
59
|
-
{ label:
|
|
60
|
-
{ label:
|
|
61
|
-
{ label:
|
|
62
|
-
{ label:
|
|
56
|
+
{ label: tableColumnHeaderId, width: "5%" },
|
|
57
|
+
{ label: tableColumnHeaderCode, width: "15%" },
|
|
58
|
+
{ label: tableColumnHeaderDescription, width: "25%" },
|
|
59
|
+
{ label: tableColumnHeaderDiscountType, width: "15%" },
|
|
60
|
+
{ label: tableColumnHeaderDiscountValue, width: "15%" },
|
|
61
|
+
{ label: tableColumnHeaderEnabled, width: "15%" },
|
|
62
|
+
{ label: tableColumnHeaderActions, width: "10%" },
|
|
63
63
|
],
|
|
64
|
-
cancelLabel,
|
|
64
|
+
cancelLabel: drawerButtonCancel,
|
|
65
65
|
drawerFilterDescription,
|
|
66
66
|
drawerFilterTitle,
|
|
67
67
|
drawerFormDescription,
|
|
@@ -73,8 +73,8 @@ const createDiscountCodeConfig = ({ cancelLabel, dispatch, drawerFilterDescripti
|
|
|
73
73
|
filterContent: components.filter,
|
|
74
74
|
formContent: components.form,
|
|
75
75
|
moreActionsContent: components.moreActions,
|
|
76
|
-
saveLabel,
|
|
77
|
-
searchPlaceholder,
|
|
76
|
+
saveLabel: drawerButtonSave,
|
|
77
|
+
searchPlaceholder: tableSearchPlaceholder,
|
|
78
78
|
tableDescription,
|
|
79
79
|
tableTitle,
|
|
80
80
|
viewContent: components.view,
|
|
@@ -95,7 +95,8 @@ const DiscountCodePageInner = (props) => {
|
|
|
95
95
|
// Memoize config creation - destructure props to avoid object reference changes
|
|
96
96
|
const discountCodeConfig = useMemo(() => createDiscountCodeConfig({
|
|
97
97
|
dispatch: context.dispatch,
|
|
98
|
-
|
|
98
|
+
drawerButtonCancel: props.drawerButtonCancel,
|
|
99
|
+
drawerButtonSave: props.drawerButtonSave,
|
|
99
100
|
drawerFormTitle: props.drawerFormTitle,
|
|
100
101
|
drawerFormDescription: props.drawerFormDescription,
|
|
101
102
|
drawerViewTitle: props.drawerViewTitle,
|
|
@@ -104,20 +105,20 @@ const DiscountCodePageInner = (props) => {
|
|
|
104
105
|
drawerFilterDescription: props.drawerFilterDescription,
|
|
105
106
|
drawerMoreActionsTitle: props.drawerMoreActionsTitle,
|
|
106
107
|
drawerMoreActionsDescription: props.drawerMoreActionsDescription,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
saveLabel: props.saveLabel,
|
|
115
|
-
searchPlaceholder: props.searchPlaceholder,
|
|
108
|
+
tableColumnHeaderActions: props.tableColumnHeaderActions,
|
|
109
|
+
tableColumnHeaderCode: props.tableColumnHeaderCode,
|
|
110
|
+
tableColumnHeaderDescription: props.tableColumnHeaderDescription,
|
|
111
|
+
tableColumnHeaderDiscountType: props.tableColumnHeaderDiscountType,
|
|
112
|
+
tableColumnHeaderDiscountValue: props.tableColumnHeaderDiscountValue,
|
|
113
|
+
tableColumnHeaderEnabled: props.tableColumnHeaderEnabled,
|
|
114
|
+
tableColumnHeaderId: props.tableColumnHeaderId,
|
|
116
115
|
tableDescription: props.tableDescription,
|
|
116
|
+
tableSearchPlaceholder: props.tableSearchPlaceholder,
|
|
117
117
|
tableTitle: props.tableTitle,
|
|
118
118
|
}), [
|
|
119
119
|
context.dispatch,
|
|
120
|
-
props.
|
|
120
|
+
props.drawerButtonCancel,
|
|
121
|
+
props.drawerButtonSave,
|
|
121
122
|
props.drawerFormTitle,
|
|
122
123
|
props.drawerFormDescription,
|
|
123
124
|
props.drawerViewTitle,
|
|
@@ -126,16 +127,15 @@ const DiscountCodePageInner = (props) => {
|
|
|
126
127
|
props.drawerFilterDescription,
|
|
127
128
|
props.drawerMoreActionsTitle,
|
|
128
129
|
props.drawerMoreActionsDescription,
|
|
129
|
-
props.
|
|
130
|
-
props.
|
|
131
|
-
props.
|
|
132
|
-
props.
|
|
133
|
-
props.
|
|
134
|
-
props.
|
|
135
|
-
props.
|
|
136
|
-
props.saveLabel,
|
|
137
|
-
props.searchPlaceholder,
|
|
130
|
+
props.tableColumnHeaderActions,
|
|
131
|
+
props.tableColumnHeaderCode,
|
|
132
|
+
props.tableColumnHeaderDescription,
|
|
133
|
+
props.tableColumnHeaderDiscountType,
|
|
134
|
+
props.tableColumnHeaderDiscountValue,
|
|
135
|
+
props.tableColumnHeaderEnabled,
|
|
136
|
+
props.tableColumnHeaderId,
|
|
138
137
|
props.tableDescription,
|
|
138
|
+
props.tableSearchPlaceholder,
|
|
139
139
|
props.tableTitle,
|
|
140
140
|
]);
|
|
141
141
|
const hasPermission = resolveRbacPermissions({
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { DISCOUNT_TYPE } from "../../type";
|
|
13
|
+
export declare const VALIDATION_KEYS: {
|
|
14
|
+
readonly codeRequired: "validationDiscountCodeCodeRequired";
|
|
15
|
+
readonly codeMaxLength: "validationDiscountCodeCodeMaxLength";
|
|
16
|
+
readonly discountValueInvalid: "validationDiscountCodeValueInvalid";
|
|
17
|
+
};
|
|
13
18
|
export declare const accountDiscountCodeFormValidation: z.ZodObject<{
|
|
14
19
|
code: z.ZodString;
|
|
15
20
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -13,12 +13,17 @@ import { DISCOUNT_TYPE } from "../../type";
|
|
|
13
13
|
// ============================================================================
|
|
14
14
|
// VALIDATION SCHEMA
|
|
15
15
|
// ============================================================================
|
|
16
|
+
export const VALIDATION_KEYS = {
|
|
17
|
+
codeRequired: "validationDiscountCodeCodeRequired",
|
|
18
|
+
codeMaxLength: "validationDiscountCodeCodeMaxLength",
|
|
19
|
+
discountValueInvalid: "validationDiscountCodeValueInvalid",
|
|
20
|
+
};
|
|
16
21
|
export const accountDiscountCodeFormValidation = z
|
|
17
22
|
.object({
|
|
18
23
|
code: z
|
|
19
24
|
.string()
|
|
20
|
-
.min(1,
|
|
21
|
-
.max(50,
|
|
25
|
+
.min(1, VALIDATION_KEYS.codeRequired)
|
|
26
|
+
.max(50, VALIDATION_KEYS.codeMaxLength),
|
|
22
27
|
description: z.string().optional(),
|
|
23
28
|
discountType: z.nativeEnum(DISCOUNT_TYPE),
|
|
24
29
|
discountValue: z.number(),
|
|
@@ -33,6 +38,6 @@ export const accountDiscountCodeFormValidation = z
|
|
|
33
38
|
}
|
|
34
39
|
return true;
|
|
35
40
|
}, {
|
|
36
|
-
message:
|
|
41
|
+
message: VALIDATION_KEYS.discountValueInvalid,
|
|
37
42
|
path: ["discountValue"],
|
|
38
43
|
});
|
|
@@ -21,6 +21,6 @@ export const DiscountCodeView = () => {
|
|
|
21
21
|
const t = useTranslations("discountCode");
|
|
22
22
|
const { code, description, discountType, enabled } = state;
|
|
23
23
|
return (_jsx("div", { className: "space-y-6", children: _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "flex items-center gap-2", children: t("viewSectionDiscountCode") }), _jsx(CardDescription, { children: t("viewSectionDiscountCodeDescription") })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewFieldDiscountCode") }), _jsx("p", { className: "mt-1 font-mono text-lg font-semibold", children: formatValue(code) })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewFieldStatus") }), _jsx("div", { className: "mt-1", children: _jsx(Badge, { variant: enabled ? "default" : "secondary", children: enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "mr-1 h-3 w-3" }), t("badgeEnabled")] })) : (_jsxs(_Fragment, { children: [_jsx(XCircle, { className: "mr-1 h-3 w-3" }), t("badgeDisabled")] })) }) })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewFieldDiscountType") }), _jsx("p", { className: "mt-1 font-medium text-gray-900", children: discountType === DISCOUNT_TYPE.PERCENTAGE
|
|
24
|
-
? t("
|
|
25
|
-
: t("
|
|
24
|
+
? t("formOptionPercentage")
|
|
25
|
+
: t("viewOptionDiscountTypeFixed") })] }), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewFieldDiscountValue") }), _jsx("p", { className: "text-primary mt-1 text-xl font-semibold" })] })] }), _jsx(Separator, {}), _jsxs("div", { children: [_jsx("label", { className: "text-sm font-medium text-gray-700", children: t("viewFieldDescription") }), _jsx("p", { className: "mt-1 text-gray-900", children: formatValue(description) })] })] })] }) }));
|
|
26
26
|
};
|
|
@@ -19,6 +19,7 @@ import { CLASS_API_ROUTES, SECTION_API_ROUTES, STUDENT_PROFILE_API_ROUTES, } fro
|
|
|
19
19
|
import { useTranslations } from "next-intl";
|
|
20
20
|
import { useFetch } from "@react-pakistan/util-functions/hooks/use-fetch";
|
|
21
21
|
import { useEffect } from "react";
|
|
22
|
+
import { getTranslatedError } from "../../utils/get-translated-error";
|
|
22
23
|
import { getCachedWorkspaceSync } from "../workspace/cache";
|
|
23
24
|
// ============================================================================
|
|
24
25
|
// COMPONENT
|
|
@@ -120,7 +121,7 @@ export const EnrollmentForm = () => {
|
|
|
120
121
|
},
|
|
121
122
|
value: sectionId || "",
|
|
122
123
|
});
|
|
123
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors
|
|
124
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: getTranslatedError({ errors, key: "enrollmentDate", t }), id: "enrollmentDate", info: t("formEnrollmentDateInfo"), label: t("formEnrollmentDateLabel"), onChange: (e) => handleChange("enrollmentDate", e.target.value), placeholder: t("formEnrollmentDatePlaceholder"), required: true, type: "date", value: enrollmentDate
|
|
124
125
|
? formatDate(enrollmentDate, DATE_FORMATS.YYYY_MM_DD)
|
|
125
|
-
: "" }), _jsx(Separator, {}), studentProfileIdCombo, classIdCombo, sectionIdCombo, _jsx(EnhancedCheckbox, { checked: enabled,
|
|
126
|
+
: "" }), _jsx(Separator, {}), studentProfileIdCombo, classIdCombo, sectionIdCombo, _jsx(EnhancedCheckbox, { checked: enabled, id: "enabled", info: t("formActiveEnrollmentInfo"), label: t("formActiveEnrollmentLabel"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
|
|
126
127
|
};
|
|
@@ -119,17 +119,17 @@ export const EnrollmentMoreActions = () => {
|
|
|
119
119
|
const msgs = [];
|
|
120
120
|
if (method === "POST") {
|
|
121
121
|
if (!((_b = row.studentProfileId) === null || _b === void 0 ? void 0 : _b.trim()))
|
|
122
|
-
msgs.push(t("
|
|
122
|
+
msgs.push(t("validationEnrollmentStudentProfileIdRequired"));
|
|
123
123
|
if (!((_c = row.classId) === null || _c === void 0 ? void 0 : _c.trim()))
|
|
124
|
-
msgs.push(t("
|
|
124
|
+
msgs.push(t("validationEnrollmentClassIdRequired"));
|
|
125
125
|
if (!((_d = row.sectionId) === null || _d === void 0 ? void 0 : _d.trim()))
|
|
126
|
-
msgs.push(t("
|
|
126
|
+
msgs.push(t("validationEnrollmentSectionIdRequired"));
|
|
127
127
|
if (!((_e = row.enrollmentDate) === null || _e === void 0 ? void 0 : _e.trim()))
|
|
128
|
-
msgs.push(t("
|
|
128
|
+
msgs.push(t("validationEnrollmentEnrollmentDateRequired"));
|
|
129
129
|
}
|
|
130
130
|
else {
|
|
131
131
|
if (!((_f = row.id) === null || _f === void 0 ? void 0 : _f.trim()))
|
|
132
|
-
msgs.push(t("
|
|
132
|
+
msgs.push(t("validationEnrollmentIdForUpdateRequired"));
|
|
133
133
|
}
|
|
134
134
|
if (msgs.length > 0) {
|
|
135
135
|
validationErrors.push({ row: i + 1, messages: msgs });
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
import { FC } from "react";
|
|
15
15
|
import { USER_ROLE } from "../../type";
|
|
16
16
|
interface Props {
|
|
17
|
-
|
|
17
|
+
drawerButtonCancel: string;
|
|
18
|
+
drawerButtonSave: string;
|
|
18
19
|
drawerFilterDescription: string;
|
|
19
20
|
drawerFilterTitle: string;
|
|
20
21
|
drawerFormDescription: string;
|
|
@@ -23,16 +24,15 @@ interface Props {
|
|
|
23
24
|
drawerMoreActionsTitle: string;
|
|
24
25
|
drawerViewDescription: string;
|
|
25
26
|
drawerViewTitle: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
saveLabel: string;
|
|
34
|
-
searchPlaceholder: string;
|
|
27
|
+
tableColumnHeaderActions: string;
|
|
28
|
+
tableColumnHeaderClass: string;
|
|
29
|
+
tableColumnHeaderEnabled: string;
|
|
30
|
+
tableColumnHeaderEnrollmentDate: string;
|
|
31
|
+
tableColumnHeaderId: string;
|
|
32
|
+
tableColumnHeaderSection: string;
|
|
33
|
+
tableColumnHeaderStudent: string;
|
|
35
34
|
tableDescription: string;
|
|
35
|
+
tableSearchPlaceholder: string;
|
|
36
36
|
tableTitle: string;
|
|
37
37
|
userRole: USER_ROLE;
|
|
38
38
|
}
|
|
@@ -71,20 +71,20 @@ const createComponentInstances = () => ({
|
|
|
71
71
|
moreActions: _jsx(EnrollmentMoreActions, {}),
|
|
72
72
|
view: _jsx(EnrollmentView, {}),
|
|
73
73
|
});
|
|
74
|
-
const createEnrollmentConfig = ({
|
|
74
|
+
const createEnrollmentConfig = ({ dispatch, drawerButtonCancel, drawerButtonSave, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, tableColumnHeaderActions, tableColumnHeaderClass, tableColumnHeaderEnabled, tableColumnHeaderEnrollmentDate, tableColumnHeaderId, tableColumnHeaderSection, tableColumnHeaderStudent, tableDescription, tableSearchPlaceholder, tableTitle, }) => {
|
|
75
75
|
const components = createComponentInstances();
|
|
76
76
|
return {
|
|
77
77
|
moduleName: "enrollment",
|
|
78
78
|
tableColumns: [
|
|
79
|
-
{ label:
|
|
80
|
-
{ label:
|
|
81
|
-
{ label:
|
|
82
|
-
{ label:
|
|
83
|
-
{ label:
|
|
84
|
-
{ label:
|
|
85
|
-
{ label:
|
|
79
|
+
{ label: tableColumnHeaderId, width: "5%" },
|
|
80
|
+
{ label: tableColumnHeaderStudent, width: "20%" },
|
|
81
|
+
{ label: tableColumnHeaderClass, width: "15%" },
|
|
82
|
+
{ label: tableColumnHeaderSection, width: "20%" },
|
|
83
|
+
{ label: tableColumnHeaderEnrollmentDate, width: "20%" },
|
|
84
|
+
{ label: tableColumnHeaderEnabled, width: "10%" },
|
|
85
|
+
{ label: tableColumnHeaderActions, width: "5%" },
|
|
86
86
|
],
|
|
87
|
-
cancelLabel,
|
|
87
|
+
cancelLabel: drawerButtonCancel,
|
|
88
88
|
drawerFilterDescription,
|
|
89
89
|
drawerFilterTitle,
|
|
90
90
|
drawerFormDescription,
|
|
@@ -96,8 +96,8 @@ const createEnrollmentConfig = ({ cancelLabel, dispatch, drawerFilterDescription
|
|
|
96
96
|
filterContent: components.filter,
|
|
97
97
|
formContent: components.form,
|
|
98
98
|
moreActionsContent: components.moreActions,
|
|
99
|
-
saveLabel,
|
|
100
|
-
searchPlaceholder,
|
|
99
|
+
saveLabel: drawerButtonSave,
|
|
100
|
+
searchPlaceholder: tableSearchPlaceholder,
|
|
101
101
|
tableDescription,
|
|
102
102
|
tableTitle,
|
|
103
103
|
viewContent: components.view,
|
|
@@ -114,7 +114,8 @@ const EnrollmentPageInner = (props) => {
|
|
|
114
114
|
const context = useEnrollmentModule();
|
|
115
115
|
const enrollmentConfig = useMemo(() => createEnrollmentConfig({
|
|
116
116
|
dispatch: context.dispatch,
|
|
117
|
-
|
|
117
|
+
drawerButtonCancel: props.drawerButtonCancel,
|
|
118
|
+
drawerButtonSave: props.drawerButtonSave,
|
|
118
119
|
drawerFormTitle: props.drawerFormTitle,
|
|
119
120
|
drawerFormDescription: props.drawerFormDescription,
|
|
120
121
|
drawerViewTitle: props.drawerViewTitle,
|
|
@@ -123,20 +124,20 @@ const EnrollmentPageInner = (props) => {
|
|
|
123
124
|
drawerFilterDescription: props.drawerFilterDescription,
|
|
124
125
|
drawerMoreActionsTitle: props.drawerMoreActionsTitle,
|
|
125
126
|
drawerMoreActionsDescription: props.drawerMoreActionsDescription,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
saveLabel: props.saveLabel,
|
|
134
|
-
searchPlaceholder: props.searchPlaceholder,
|
|
127
|
+
tableColumnHeaderActions: props.tableColumnHeaderActions,
|
|
128
|
+
tableColumnHeaderClass: props.tableColumnHeaderClass,
|
|
129
|
+
tableColumnHeaderEnabled: props.tableColumnHeaderEnabled,
|
|
130
|
+
tableColumnHeaderEnrollmentDate: props.tableColumnHeaderEnrollmentDate,
|
|
131
|
+
tableColumnHeaderId: props.tableColumnHeaderId,
|
|
132
|
+
tableColumnHeaderSection: props.tableColumnHeaderSection,
|
|
133
|
+
tableColumnHeaderStudent: props.tableColumnHeaderStudent,
|
|
135
134
|
tableDescription: props.tableDescription,
|
|
135
|
+
tableSearchPlaceholder: props.tableSearchPlaceholder,
|
|
136
136
|
tableTitle: props.tableTitle,
|
|
137
137
|
}), [
|
|
138
138
|
context.dispatch,
|
|
139
|
-
props.
|
|
139
|
+
props.drawerButtonCancel,
|
|
140
|
+
props.drawerButtonSave,
|
|
140
141
|
props.drawerFormTitle,
|
|
141
142
|
props.drawerFormDescription,
|
|
142
143
|
props.drawerViewTitle,
|
|
@@ -145,16 +146,15 @@ const EnrollmentPageInner = (props) => {
|
|
|
145
146
|
props.drawerFilterDescription,
|
|
146
147
|
props.drawerMoreActionsTitle,
|
|
147
148
|
props.drawerMoreActionsDescription,
|
|
148
|
-
props.
|
|
149
|
-
props.
|
|
150
|
-
props.
|
|
151
|
-
props.
|
|
152
|
-
props.
|
|
153
|
-
props.
|
|
154
|
-
props.
|
|
155
|
-
props.saveLabel,
|
|
156
|
-
props.searchPlaceholder,
|
|
149
|
+
props.tableColumnHeaderActions,
|
|
150
|
+
props.tableColumnHeaderClass,
|
|
151
|
+
props.tableColumnHeaderEnabled,
|
|
152
|
+
props.tableColumnHeaderEnrollmentDate,
|
|
153
|
+
props.tableColumnHeaderId,
|
|
154
|
+
props.tableColumnHeaderSection,
|
|
155
|
+
props.tableColumnHeaderStudent,
|
|
157
156
|
props.tableDescription,
|
|
157
|
+
props.tableSearchPlaceholder,
|
|
158
158
|
props.tableTitle,
|
|
159
159
|
]);
|
|
160
160
|
const hasPermission = resolveRbacPermissions({
|