@appcorp/fusion-storybook 0.1.51 → 0.1.53
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.
|
@@ -11,12 +11,12 @@ export const AttendanceForm = () => {
|
|
|
11
11
|
const { state, handleChange } = useAttendanceModule();
|
|
12
12
|
const { date, enabled, errors, remarks, status } = state;
|
|
13
13
|
const t = useTranslations("attendance");
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.date, id: "date", info: t("dateInfo"), label: t("date"), onChange: (e) => handleChange("date", e.target.value), placeholder: t("datePlaceholder"), required: true, type: "date", value: date }), _jsx(EnhancedCombobox, { error: errors.status, id: "status", info: t("statusInfo"), label: t("status"), onValueChange: (value) => handleChange("status", value), options: ATTENDANCE_STATUS_OPTIONS.map((opt) => ({
|
|
15
|
+
label: t(`status${opt.value.charAt(0).toUpperCase() +
|
|
16
|
+
opt.value
|
|
17
|
+
.slice(1)
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace(/_([a-z])/g, (_, c) => c.toUpperCase())}`),
|
|
20
|
+
value: opt.value,
|
|
21
|
+
})), placeholder: t("statusPlaceholder"), required: true, searchPlaceholder: t("searchStatus"), emptyText: t("noStatusFound"), value: status }), _jsx(EnhancedTextarea, { error: errors.remarks, id: "remarks", info: t("remarksInfo"), label: t("remarks"), onChange: (e) => handleChange("remarks", e.target.value), placeholder: t("remarksPlaceholder"), rows: 3, value: remarks !== null && remarks !== void 0 ? remarks : "" }), _jsx(EnhancedCheckbox, { defaultChecked: enabled, label: t("activeAttendanceRecord"), onCheckedChange: (checked) => handleChange("enabled", checked) })] }));
|
|
22
22
|
};
|
|
@@ -18,19 +18,19 @@ export const CourseForm = () => {
|
|
|
18
18
|
const t = useTranslations("course");
|
|
19
19
|
const { state, handleChange } = useCourseModule();
|
|
20
20
|
const { code, enabled, errors, sectionId, subjectId, teacherId } = state;
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.code, id: "code", info: t("courseCodeInfo"), label: t("courseCode"), onChange: (e) => handleChange("code", e.target.value), placeholder: t("courseCodePlaceholder"), required: true, value: code }), _jsx(EnhancedCombobox, { emptyText: t("noSectionFound"), error: errors.sectionId, id: "sectionId", info: t("sectionInfo"), label: t("section"), onValueChange: (value) => handleChange("sectionId", value), options: getCachedSectionsSync().items.map((s) => {
|
|
22
|
+
var _a;
|
|
23
|
+
return ({
|
|
24
|
+
label: ((_a = s.class) === null || _a === void 0 ? void 0 : _a.code) ? `${s.class.code}-${s.name}` : s.name,
|
|
25
|
+
value: s.id,
|
|
26
|
+
});
|
|
27
|
+
}), placeholder: t("sectionPlaceholder"), required: true, searchPlaceholder: t("searchSections"), value: sectionId }), _jsx(EnhancedCombobox, { emptyText: t("noSubjectFound"), error: errors.subjectId, id: "subjectId", info: t("subjectInfo"), label: t("subject"), onValueChange: (value) => handleChange("subjectId", value), options: getCachedSubjectsSync().items.map((s) => ({
|
|
28
|
+
label: s.name,
|
|
29
|
+
value: s.id,
|
|
30
|
+
})), placeholder: t("subjectPlaceholder"), required: true, searchPlaceholder: t("searchSubjects"), value: subjectId }), _jsx(EnhancedCombobox, { emptyText: t("noTeacherFound"), error: errors.teacherId, id: "teacherId", info: t("teacherInfo"), label: t("teacher"), onValueChange: (value) => handleChange("teacherId", value), options: getCachedTeachersSync().items.map((t) => ({
|
|
31
|
+
label: `${t.firstName || ""} ${t.lastName || ""}`.trim() ||
|
|
32
|
+
t.teacherCode ||
|
|
33
|
+
t.id,
|
|
34
|
+
value: t.id,
|
|
35
|
+
})), placeholder: t("teacherPlaceholder"), required: true, searchPlaceholder: t("searchTeachers"), value: teacherId }), _jsx(EnhancedCheckbox, { label: t("activeCourse"), defaultChecked: enabled, onCheckedChange: (checked) => handleChange("enabled", checked), info: t("toggleToEnableOrDisableCourse") })] }));
|
|
36
36
|
};
|
|
@@ -25,7 +25,7 @@ import { useTranslations } from "next-intl";
|
|
|
25
25
|
export const EnrollmentForm = () => {
|
|
26
26
|
const { state: { courseId, enabled, enrollmentDate, errors, sectionId, studentProfileId, }, handleChange, } = useEnrollmentModule();
|
|
27
27
|
const t = useTranslations("enrollment");
|
|
28
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsx(
|
|
28
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.enrollmentDate, id: "enrollmentDate", info: t("enrollmentDateInfo"), label: t("enrollmentDate"), onChange: (e) => handleChange("enrollmentDate", e.target.value), placeholder: t("enrollmentDatePlaceholder"), required: true, type: "date", value: enrollmentDate
|
|
29
29
|
? formatDate(enrollmentDate, DATE_FORMATS.YYYY_MM_DD)
|
|
30
30
|
: "" }), _jsx(Separator, {}), _jsx(EnhancedCombobox, { emptyText: t("noStudentFound"), error: errors.studentProfileId, id: "studentProfileId", info: t("studentInfo"), label: t("student"), onValueChange: (value) => handleChange("studentProfileId", value), options: (getCachedStudentProfilesSync().items || []).map((s) => ({
|
|
31
31
|
label: s.studentCode || s.id,
|
|
@@ -15,7 +15,7 @@ import { useMemo } from "react";
|
|
|
15
15
|
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
16
16
|
import { createGenericModulePage, } from "@react-pakistan/util-functions/factory/generic-component-factory";
|
|
17
17
|
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
18
|
-
import { useEnrollmentModule, EnrollmentProvider,
|
|
18
|
+
import { useEnrollmentModule, EnrollmentProvider, ENROLLMENT_ACTION_TYPES, } from "./context";
|
|
19
19
|
import { EnrollmentFilter } from "./filter";
|
|
20
20
|
import { EnrollmentForm } from "./form";
|
|
21
21
|
import { EnrollmentMoreActions } from "./more-actions";
|
|
@@ -67,7 +67,7 @@ const createComponentInstances = () => ({
|
|
|
67
67
|
moreActions: _jsx(EnrollmentMoreActions, {}),
|
|
68
68
|
view: _jsx(EnrollmentView, {}),
|
|
69
69
|
});
|
|
70
|
-
const createEnrollmentConfig = ({ cancelLabel, dispatch,
|
|
70
|
+
const createEnrollmentConfig = ({ cancelLabel, dispatch, drawerTitle, labelActions, labelCourse, labelEnabled, labelEnrollmentDate, labelId, labelSection, labelStatus, labelStudent, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
|
|
71
71
|
const components = createComponentInstances();
|
|
72
72
|
return {
|
|
73
73
|
moduleName: "enrollment",
|
|
@@ -91,7 +91,6 @@ const createEnrollmentConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, la
|
|
|
91
91
|
tableDescription,
|
|
92
92
|
tableTitle,
|
|
93
93
|
viewContent: components.view,
|
|
94
|
-
size: drawer === ENROLLMENT_DRAWER.FORM_DRAWER ? "full" : "small",
|
|
95
94
|
onClearFilters: () => {
|
|
96
95
|
dispatch({ type: ENROLLMENT_ACTION_TYPES.RESET_FORM });
|
|
97
96
|
},
|