Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export type CourseUnitEnrollment = {
id: number,
date: string,
user_nmec: string,
user_name: string,
admin_state: string,
accepted: boolean,
schedule: Array<ClassDescriptor>,
Expand All @@ -199,6 +200,7 @@ export type CourseUnitEnrollmentOption = {
course: Major,
enrolling: boolean,
class_user_goes_to: ClassInfo,
id: number,
}

export enum AdminRequestType {
Expand Down
35 changes: 18 additions & 17 deletions src/components/admin/requests/cards/StudentEnrollmentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export const StudentEnrollmentCard = ({
</div>
{!open && <>
<Person
key={"enrollment-person-" + enrollment.user_nmec}
name={enrollment.user_nmec}
key={"enrollment-person-" + enrollment.user_name}
name={enrollment.user_name}
nmec={enrollment.user_nmec}
/>
</>}
Expand All @@ -71,23 +71,24 @@ export const StudentEnrollmentCard = ({
{open && (
<div className="flex flex-col gap-y-8" key={crypto.randomUUID()}>
<div className="flex flex-row justify-between">
<Person name={enrollment.user_nmec} nmec={enrollment.user_nmec} />
<Person name={enrollment.user_name} nmec={enrollment.user_nmec} />
<div className="flex flex-row gap-x-2">
{enrollment.options.map((option) => (
<div
key={crypto.randomUUID()}
>
<div
className="flex flex-row gap-x-2 items-center border-gray-200 border-2 rounded-md p-2 px-4"
>
<h2 className="font-bold">{option.course_unit.acronym}</h2>
{option.enrolling
? <Check className="text-green-400" />
: <X className="text-red-400" />
}
{[...enrollment.options]
.sort((a, b) => a.course_unit.id - b.course_unit.id)
.map((option) => (
<div key={option.id}>
<div className="flex flex-row gap-x-2 items-center border-gray-200 border-2 rounded-md p-2 px-4">
<h2 className="font-bold">
{option.course_unit.acronym}
</h2>
{option.enrolling ? (
<Check className="text-green-400" />
) : (
<X className="text-red-400" />
)}
</div>
</div>
</div>
))}
))}
</div>
<div>
<AdminPreviewSchedule
Expand Down