@appcorp/fusion-storybook 0.2.14 → 0.2.15
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 +7 -2
- package/base-modules/enrollment/context.d.ts +1 -13
- package/base-modules/enrollment/context.js +0 -3
- package/base-modules/enrollment/form.js +2 -6
- package/base-modules/enrollment/page.d.ts +0 -1
- package/base-modules/enrollment/page.js +5 -13
- package/base-modules/enrollment/validate.d.ts +0 -1
- package/base-modules/enrollment/validate.js +0 -1
- package/base-modules/enrollment/view.js +4 -7
- package/base-modules/student-profile/constants.js +7 -3
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/academics.d.ts +2 -4
|
@@ -10,15 +10,20 @@ import { useMemo, useState } from "react";
|
|
|
10
10
|
export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labelCourseInfo, labelCoursePlaceholder, labelNoCourseFound, labelRemarks, labelRemarksInfo, labelRemarksPlaceholder, labelSearchCourses, labelStatusAbsent, labelStatusExcused, labelStatusHalfDay, labelStatusLate, labelStatusPresent, }) => {
|
|
11
11
|
const enrollment = getCachedEnrollmentsSync().items;
|
|
12
12
|
const studentProfiles = getCachedStudentProfilesSync().items;
|
|
13
|
+
const courses = getCachedCoursesSync().items;
|
|
13
14
|
const [courseId, setCourseId] = useState("");
|
|
14
15
|
const [remarks, setRemarks] = useState({});
|
|
15
16
|
const [attendance, setAttendance] = useState({});
|
|
16
17
|
const [errors] = useState({});
|
|
18
|
+
// Find the section for the selected course, then get students enrolled in that section
|
|
17
19
|
const studentsInCourse = useMemo(() => {
|
|
20
|
+
const courseObj = courses.find((c) => c.id === courseId);
|
|
21
|
+
if (!courseObj)
|
|
22
|
+
return [];
|
|
18
23
|
return enrollment
|
|
19
|
-
.filter((e) => e.
|
|
24
|
+
.filter((e) => e.sectionId === courseObj.sectionId)
|
|
20
25
|
.map((e) => e.studentProfileId);
|
|
21
|
-
}, [enrollment, courseId]);
|
|
26
|
+
}, [enrollment, courseId, courses]);
|
|
22
27
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedCombobox, { emptyText: labelNoCourseFound, error: errors.courseId, id: "courseId", info: labelCourseInfo, label: labelCourse, onValueChange: (value) => setCourseId(value), options: getCachedCoursesSync().items.map((c) => ({
|
|
23
28
|
label: c.code.trim(),
|
|
24
29
|
value: c.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RowAction, type TableRow } from "@appcorp/shadcn/components/enhanced-table";
|
|
2
|
-
import {
|
|
2
|
+
import { EnrollmentBE, SectionBE, StudentProfileBE } from "../../type";
|
|
3
3
|
export declare const ENROLLMENT_DRAWER: {
|
|
4
4
|
readonly FILTER_DRAWER: string;
|
|
5
5
|
readonly FORM_DRAWER: string;
|
|
@@ -26,7 +26,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
26
26
|
searchQuery: string;
|
|
27
27
|
disableSaveButton: boolean;
|
|
28
28
|
drawer: string | null;
|
|
29
|
-
courseId: string;
|
|
30
29
|
enabled: boolean;
|
|
31
30
|
enrollmentDate: string;
|
|
32
31
|
errors: Record<string, string>;
|
|
@@ -34,7 +33,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
34
33
|
id: string;
|
|
35
34
|
sectionId: string;
|
|
36
35
|
studentProfileId: string;
|
|
37
|
-
course: CourseBE | undefined;
|
|
38
36
|
section: SectionBE | undefined;
|
|
39
37
|
studentProfile: StudentProfileBE | undefined;
|
|
40
38
|
}>, initialEnrollmentState: {
|
|
@@ -45,7 +43,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
45
43
|
searchQuery: string;
|
|
46
44
|
disableSaveButton: boolean;
|
|
47
45
|
drawer: string | null;
|
|
48
|
-
courseId: string;
|
|
49
46
|
enabled: boolean;
|
|
50
47
|
enrollmentDate: string;
|
|
51
48
|
errors: Record<string, string>;
|
|
@@ -53,7 +50,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
53
50
|
id: string;
|
|
54
51
|
sectionId: string;
|
|
55
52
|
studentProfileId: string;
|
|
56
|
-
course: CourseBE | undefined;
|
|
57
53
|
section: SectionBE | undefined;
|
|
58
54
|
studentProfile: StudentProfileBE | undefined;
|
|
59
55
|
}, EnrollmentProvider: import("react").FC<{
|
|
@@ -66,7 +62,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
66
62
|
searchQuery: string;
|
|
67
63
|
disableSaveButton: boolean;
|
|
68
64
|
drawer: string | null;
|
|
69
|
-
courseId: string;
|
|
70
65
|
enabled: boolean;
|
|
71
66
|
enrollmentDate: string;
|
|
72
67
|
errors: Record<string, string>;
|
|
@@ -74,7 +69,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
74
69
|
id: string;
|
|
75
70
|
sectionId: string;
|
|
76
71
|
studentProfileId: string;
|
|
77
|
-
course: CourseBE | undefined;
|
|
78
72
|
section: SectionBE | undefined;
|
|
79
73
|
studentProfile: StudentProfileBE | undefined;
|
|
80
74
|
}, action: any) => {
|
|
@@ -85,7 +79,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
85
79
|
searchQuery: string;
|
|
86
80
|
disableSaveButton: boolean;
|
|
87
81
|
drawer: string | null;
|
|
88
|
-
courseId: string;
|
|
89
82
|
enabled: boolean;
|
|
90
83
|
enrollmentDate: string;
|
|
91
84
|
errors: Record<string, string>;
|
|
@@ -93,7 +86,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
93
86
|
id: string;
|
|
94
87
|
sectionId: string;
|
|
95
88
|
studentProfileId: string;
|
|
96
|
-
course: CourseBE | undefined;
|
|
97
89
|
section: SectionBE | undefined;
|
|
98
90
|
studentProfile: StudentProfileBE | undefined;
|
|
99
91
|
}, useEnrollmentContext: () => import("@react-pakistan/util-functions/factory/generic-module-factory").GenericModuleContext<{
|
|
@@ -104,7 +96,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
104
96
|
searchQuery: string;
|
|
105
97
|
disableSaveButton: boolean;
|
|
106
98
|
drawer: string | null;
|
|
107
|
-
courseId: string;
|
|
108
99
|
enabled: boolean;
|
|
109
100
|
enrollmentDate: string;
|
|
110
101
|
errors: Record<string, string>;
|
|
@@ -112,7 +103,6 @@ export declare const ENROLLMENT_ACTION_TYPES: {
|
|
|
112
103
|
id: string;
|
|
113
104
|
sectionId: string;
|
|
114
105
|
studentProfileId: string;
|
|
115
|
-
course: CourseBE | undefined;
|
|
116
106
|
section: SectionBE | undefined;
|
|
117
107
|
studentProfile: StudentProfileBE | undefined;
|
|
118
108
|
}>;
|
|
@@ -152,7 +142,6 @@ export declare const useEnrollmentModule: () => {
|
|
|
152
142
|
searchQuery: string;
|
|
153
143
|
disableSaveButton: boolean;
|
|
154
144
|
drawer: string | null;
|
|
155
|
-
courseId: string;
|
|
156
145
|
enabled: boolean;
|
|
157
146
|
enrollmentDate: string;
|
|
158
147
|
errors: Record<string, string>;
|
|
@@ -160,7 +149,6 @@ export declare const useEnrollmentModule: () => {
|
|
|
160
149
|
id: string;
|
|
161
150
|
sectionId: string;
|
|
162
151
|
studentProfileId: string;
|
|
163
|
-
course: CourseBE | undefined;
|
|
164
152
|
section: SectionBE | undefined;
|
|
165
153
|
studentProfile: StudentProfileBE | undefined;
|
|
166
154
|
};
|
|
@@ -54,7 +54,6 @@ const enrollmentConfig = {
|
|
|
54
54
|
disableSaveButton: false,
|
|
55
55
|
drawer: null,
|
|
56
56
|
// Form State
|
|
57
|
-
courseId: "",
|
|
58
57
|
enabled: true,
|
|
59
58
|
enrollmentDate: new Date().toISOString().split("T")[0],
|
|
60
59
|
errors: {},
|
|
@@ -63,7 +62,6 @@ const enrollmentConfig = {
|
|
|
63
62
|
sectionId: "",
|
|
64
63
|
studentProfileId: "",
|
|
65
64
|
// Relations (populated from byId fetch)
|
|
66
|
-
course: undefined,
|
|
67
65
|
section: undefined,
|
|
68
66
|
studentProfile: undefined,
|
|
69
67
|
},
|
|
@@ -102,7 +100,6 @@ export const useEnrollmentModule = () => {
|
|
|
102
100
|
debouncedQuery,
|
|
103
101
|
]);
|
|
104
102
|
const updateParams = useMemo(() => ({
|
|
105
|
-
courseId: state.courseId,
|
|
106
103
|
enabled: state.enabled,
|
|
107
104
|
enrollmentDate: state.enrollmentDate,
|
|
108
105
|
id: state.id,
|
|
@@ -16,24 +16,20 @@ import { Separator } from "@appcorp/shadcn/components/ui/separator";
|
|
|
16
16
|
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
17
17
|
import { useEnrollmentModule } from "./context";
|
|
18
18
|
import { getCachedStudentProfilesSync } from "../student-profile/cache";
|
|
19
|
-
import { getCachedCoursesSync } from "../course/cache";
|
|
20
19
|
import { getCachedSectionsSync } from "../section/cache";
|
|
21
20
|
import { useTranslations } from "next-intl";
|
|
22
21
|
// ============================================================================
|
|
23
22
|
// COMPONENT
|
|
24
23
|
// ============================================================================
|
|
25
24
|
export const EnrollmentForm = () => {
|
|
26
|
-
const { state: {
|
|
25
|
+
const { state: { enabled, enrollmentDate, errors, sectionId, studentProfileId, }, handleChange, } = useEnrollmentModule();
|
|
27
26
|
const t = useTranslations("enrollment");
|
|
28
27
|
return (_jsxs("div", { className: "space-y-4", children: [_jsx(EnhancedInput, { error: errors.enrollmentDate, id: "enrollmentDate", info: t("formEnrollmentDateInfo"), label: t("formEnrollmentDateLabel"), onChange: (e) => handleChange("enrollmentDate", e.target.value), placeholder: t("formEnrollmentDatePlaceholder"), required: true, type: "date", value: enrollmentDate
|
|
29
28
|
? formatDate(enrollmentDate, DATE_FORMATS.YYYY_MM_DD)
|
|
30
29
|
: "" }), _jsx(Separator, {}), _jsx(EnhancedCombobox, { emptyText: t("formNoStudentEmpty"), error: errors.studentProfileId, id: "studentProfileId", info: t("formStudentInfo"), label: t("formStudentLabel"), onValueChange: (value) => handleChange("studentProfileId", value), options: (getCachedStudentProfilesSync().items || []).map((s) => ({
|
|
31
30
|
label: s.studentCode || s.id,
|
|
32
31
|
value: s.id,
|
|
33
|
-
})), placeholder: t("formStudentPlaceholder"), required: true, searchPlaceholder: t("formSearchStudentsPlaceholder"), value: studentProfileId || "" }), _jsx(EnhancedCombobox, { emptyText: t("
|
|
34
|
-
label: c.code || c.id,
|
|
35
|
-
value: c.id,
|
|
36
|
-
})), placeholder: t("formCoursePlaceholder"), required: true, searchPlaceholder: t("formSearchCoursesPlaceholder"), value: courseId || "" }), _jsx(EnhancedCombobox, { emptyText: t("formNoSectionEmpty"), error: errors.sectionId, id: "sectionId", info: t("sectionInfo"), label: t("section"), onValueChange: (value) => handleChange("sectionId", value), options: (getCachedSectionsSync().items || []).map((s) => {
|
|
32
|
+
})), placeholder: t("formStudentPlaceholder"), required: true, searchPlaceholder: t("formSearchStudentsPlaceholder"), value: studentProfileId || "" }), _jsx(EnhancedCombobox, { emptyText: t("formNoSectionEmpty"), error: errors.sectionId, id: "sectionId", info: t("sectionInfo"), label: t("section"), onValueChange: (value) => handleChange("sectionId", value), options: (getCachedSectionsSync().items || []).map((s) => {
|
|
37
33
|
var _a;
|
|
38
34
|
return ({
|
|
39
35
|
label: ((_a = s.class) === null || _a === void 0 ? void 0 : _a.code) ? `${s.class.code}-${s.name}` : s.name,
|
|
@@ -34,11 +34,6 @@ const tableBodyCols = [
|
|
|
34
34
|
key: "studentProfile",
|
|
35
35
|
textFormatter: (_, row) => { var _a, _b; return (_b = (_a = row.studentProfile) === null || _a === void 0 ? void 0 : _a.studentCode) !== null && _b !== void 0 ? _b : "N/A"; },
|
|
36
36
|
},
|
|
37
|
-
{
|
|
38
|
-
componentType: COMPONENT_TYPE.TEXT,
|
|
39
|
-
key: "course",
|
|
40
|
-
textFormatter: (_, row) => { var _a, _b; return (_b = (_a = row.course) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : "N/A"; },
|
|
41
|
-
},
|
|
42
37
|
{
|
|
43
38
|
componentType: COMPONENT_TYPE.TEXT,
|
|
44
39
|
key: "section",
|
|
@@ -69,17 +64,16 @@ const createComponentInstances = () => ({
|
|
|
69
64
|
moreActions: _jsx(EnrollmentMoreActions, {}),
|
|
70
65
|
view: _jsx(EnrollmentView, {}),
|
|
71
66
|
});
|
|
72
|
-
const createEnrollmentConfig = ({ cancelLabel, dispatch, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, labelActions,
|
|
67
|
+
const createEnrollmentConfig = ({ cancelLabel, dispatch, drawerFilterDescription, drawerFilterTitle, drawerFormDescription, drawerFormTitle, drawerMoreActionsDescription, drawerMoreActionsTitle, drawerViewDescription, drawerViewTitle, labelActions, labelEnabled, labelEnrollmentDate, labelId, labelSection, labelStudent, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
|
|
73
68
|
const components = createComponentInstances();
|
|
74
69
|
return {
|
|
75
70
|
moduleName: "enrollment",
|
|
76
71
|
tableColumns: [
|
|
77
72
|
{ label: labelId, width: "5%" },
|
|
78
|
-
{ label: labelStudent, width: "
|
|
79
|
-
{ label:
|
|
80
|
-
{ label:
|
|
81
|
-
{ label:
|
|
82
|
-
{ label: labelEnabled, width: "10%" },
|
|
73
|
+
{ label: labelStudent, width: "25%" },
|
|
74
|
+
{ label: labelSection, width: "25%" },
|
|
75
|
+
{ label: labelEnrollmentDate, width: "20%" },
|
|
76
|
+
{ label: labelEnabled, width: "15%" },
|
|
83
77
|
{ label: labelActions, width: "5%" },
|
|
84
78
|
],
|
|
85
79
|
cancelLabel,
|
|
@@ -122,7 +116,6 @@ const EnrollmentPageInner = (props) => {
|
|
|
122
116
|
drawerMoreActionsTitle: props.drawerMoreActionsTitle,
|
|
123
117
|
drawerMoreActionsDescription: props.drawerMoreActionsDescription,
|
|
124
118
|
labelActions: props.labelActions,
|
|
125
|
-
labelCourse: props.labelCourse,
|
|
126
119
|
labelEnabled: props.labelEnabled,
|
|
127
120
|
labelEnrollmentDate: props.labelEnrollmentDate,
|
|
128
121
|
labelId: props.labelId,
|
|
@@ -144,7 +137,6 @@ const EnrollmentPageInner = (props) => {
|
|
|
144
137
|
props.drawerMoreActionsTitle,
|
|
145
138
|
props.drawerMoreActionsDescription,
|
|
146
139
|
props.labelActions,
|
|
147
|
-
props.labelCourse,
|
|
148
140
|
props.labelEnabled,
|
|
149
141
|
props.labelEnrollmentDate,
|
|
150
142
|
props.labelId,
|
|
@@ -9,7 +9,6 @@ import { z } from "zod";
|
|
|
9
9
|
// ============================================================================
|
|
10
10
|
export const enrollmentFormValidation = z.object({
|
|
11
11
|
studentProfileId: z.string().min(1, "Student is required"),
|
|
12
|
-
courseId: z.string().min(1, "Course is required"),
|
|
13
12
|
sectionId: z.string().min(1, "Section is required"),
|
|
14
13
|
enrollmentDate: z
|
|
15
14
|
.string()
|
|
@@ -17,27 +17,24 @@ import { BookOpen, CheckCircle2, XCircle } from "lucide-react";
|
|
|
17
17
|
import { DATE_FORMATS, formatDate } from "@react-pakistan/util-functions";
|
|
18
18
|
import { useEnrollmentModule } from "./context";
|
|
19
19
|
import { getCachedStudentProfilesSync } from "../student-profile/cache";
|
|
20
|
-
import { getCachedCoursesSync } from "../course/cache";
|
|
21
20
|
import { getCachedSectionsSync } from "../section/cache";
|
|
22
21
|
import { useTranslations } from "next-intl";
|
|
23
22
|
// ============================================================================
|
|
24
23
|
// COMPONENT
|
|
25
24
|
// ============================================================================
|
|
26
25
|
export const EnrollmentView = memo(() => {
|
|
27
|
-
var _a, _b, _c
|
|
28
|
-
const { state: {
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
const { state: { enrollmentDate, enabled, sectionId, studentProfileId }, } = useEnrollmentModule();
|
|
29
28
|
const t = useTranslations("enrollment");
|
|
30
29
|
const studentProfile = getCachedStudentProfilesSync().items.find((s) => s.id === studentProfileId);
|
|
31
30
|
const studentName = (_b = (_a = studentProfile === null || studentProfile === void 0 ? void 0 : studentProfile.studentCode) !== null && _a !== void 0 ? _a : studentProfileId) !== null && _b !== void 0 ? _b : "—";
|
|
32
|
-
const course = getCachedCoursesSync().items.find((c) => c.id === courseId);
|
|
33
|
-
const courseName = (_d = (_c = course === null || course === void 0 ? void 0 : course.code) !== null && _c !== void 0 ? _c : courseId) !== null && _d !== void 0 ? _d : "—";
|
|
34
31
|
const section = getCachedSectionsSync().items.find((s) => s.id === sectionId);
|
|
35
32
|
const sectionName = section
|
|
36
|
-
? ((
|
|
33
|
+
? ((_c = section.class) === null || _c === void 0 ? void 0 : _c.code)
|
|
37
34
|
? `${section.class.code}-${section.name}`
|
|
38
35
|
: section.name
|
|
39
36
|
: (sectionId !== null && sectionId !== void 0 ? sectionId : "—");
|
|
40
|
-
return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionEnrollmentDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteEnrollmentInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStudent") }), _jsx("p", { className: "text-base", children: studentName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("
|
|
37
|
+
return (_jsxs("div", { className: "space-y-4", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewSectionEnrollmentDetails") })] }), _jsx(CardDescription, { children: t("viewSectionCompleteEnrollmentInformation") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsxs("div", { className: "grid grid-cols-1 gap-6", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStudent") }), _jsx("p", { className: "text-base", children: studentName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("section") }), _jsx("p", { className: "text-base", children: sectionName })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldEnrollmentDate") }), _jsx("p", { className: "text-base", children: enrollmentDate
|
|
41
38
|
? formatDate(enrollmentDate, DATE_FORMATS.LOCALE_DATE)
|
|
42
39
|
: "—" })] })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "pb-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(BookOpen, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { className: "text-lg", children: t("viewFieldStatus") })] }), _jsx(CardDescription, { children: t("viewFieldEnrollmentAvailability") })] }), _jsx(Separator, {}), _jsx(CardContent, { className: "pt-6", children: _jsx("div", { className: "grid grid-cols-1 gap-6", children: _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium text-muted-foreground", children: t("viewFieldStatus") }), _jsx(Badge, { variant: enabled ? "default" : "destructive", className: "gap-1", children: enabled ? (_jsxs(_Fragment, { children: [_jsx(CheckCircle2, { className: "h-3 w-3" }), " ", t("viewFieldStatusActive")] })) : (_jsxs(_Fragment, { children: [_jsx(XCircle, { className: "h-3 w-3" }), " ", t("viewFieldStatusInactive")] })) })] }) }) })] })] }));
|
|
43
40
|
});
|
|
@@ -59,14 +59,18 @@ export const tableBodyCols = [
|
|
|
59
59
|
componentType: COMPONENT_TYPE.TEXT,
|
|
60
60
|
key: "enrollments",
|
|
61
61
|
textFormatter: (value) => {
|
|
62
|
-
var _a;
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
63
|
const enrollments = value;
|
|
64
64
|
if (!enrollments || enrollments.length === 0)
|
|
65
65
|
return "No enrollments";
|
|
66
66
|
if (enrollments.length === 1) {
|
|
67
|
-
|
|
67
|
+
const section = enrollments[0].section;
|
|
68
|
+
const courseCount = (_b = (_a = section === null || section === void 0 ? void 0 : section.courses) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
69
|
+
return courseCount > 0
|
|
70
|
+
? `${(_c = section === null || section === void 0 ? void 0 : section.name) !== null && _c !== void 0 ? _c : "Section"} (${courseCount} subjects)`
|
|
71
|
+
: (_d = section === null || section === void 0 ? void 0 : section.name) !== null && _d !== void 0 ? _d : "Enrolled";
|
|
68
72
|
}
|
|
69
|
-
return `${enrollments.length}
|
|
73
|
+
return `${enrollments.length} sections`;
|
|
70
74
|
},
|
|
71
75
|
},
|
|
72
76
|
{
|