diff --git a/apps/backoffice/src/app/features/exam/pages/ExamPage/actions.tsx b/apps/backoffice/src/app/features/exam/pages/ExamPage/actions.tsx index ba902be9d..1b62e4283 100644 --- a/apps/backoffice/src/app/features/exam/pages/ExamPage/actions.tsx +++ b/apps/backoffice/src/app/features/exam/pages/ExamPage/actions.tsx @@ -1,9 +1,18 @@ -import { ActionIcon, Group } from "@mantine/core"; -import { IconEdit, IconTrash, IconDetails } from "@tabler/icons-react"; +import { ActionIcon, Group, Menu } from "@mantine/core"; +import { IconEdit, IconTrash, IconDetails, IconToggleRight } from "@tabler/icons-react"; import type { TFunction } from "i18next"; import type { AdvancedColumn } from "@ema-platform/ui"; import { LICENSE_PERMISSIONS, RequirePermission } from "@ema-platform/auth"; -import type { Exam } from "../../types/exam"; +import type { Exam, ExamStatus } from "../../types/exam"; + +const STATUSES: ExamStatus[] = [ + "PENDING", + "ACTIVE", + "COMPLETED", + "CANCELLED", + "POSTPONED", + "PUBLISHED", +]; export function examActionsColumn( t: TFunction, @@ -11,6 +20,8 @@ export function examActionsColumn( onEdit: (exam: Exam) => void; onDelete: (exam: Exam) => void; onDetails: (exam: Exam) => void; + onChangeStatus: (exam: Exam, status: ExamStatus) => void; + changingStatusId?: string | null; }, ): AdvancedColumn { return { @@ -19,6 +30,30 @@ export function examActionsColumn( cell: ({ row }) => ( + + + + + + + + {t("exam.form.status")} + {STATUSES.map((status) => ( + handlers.onChangeStatus(row.original, status)} + > + {t(`exam.form.${status.toLowerCase()}`)} + + ))} + +