Enhance exam selection by displaying certification rank in options and remove admission number input from scheduling modal

This commit is contained in:
Nati
2026-08-22 06:11:02 +00:00
parent c3977897b7
commit e82714ba1f
2 changed files with 17 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ import {
import { notify, useErrorHandler, AdvancedTable, useServerTable, ModalFooter, AmharicDatePicker } from "@ema-platform/ui";
import { LICENSE_PERMISSIONS, RequirePermission } from "@ema-platform/auth";
import { useGetCertificationsQuery } from "../../../certification/api/certification-api";
import { RANK_KEY_OPTIONS } from "../../../certification/types/certification";
import {
useGetExamsQuery,
useCreateExamMutation,
@@ -383,9 +384,18 @@ export function ExamPage() {
const [statusOpened, { open: openStatus, close: closeStatus }] =
useDisclosure(false);
// Rank in the label: an exam inherits its STCW rank from the certification
// it is created under (Certification.rankKey), so the officer sees which
// rank a sitting will serve at the moment they pick the subject.
const certOptions = certifications
.filter((c) => c.isActive)
.map((c) => ({ value: c.id, label: c.name[locale] }));
.map((c) => {
const rank = RANK_KEY_OPTIONS.find((r) => r.value === c.rankKey)?.label;
return {
value: c.id,
label: rank ? `${c.name[locale]}${rank}` : c.name[locale],
};
});
const getCertName = (id: string) =>
certifications.find((c) => c.id === id)?.name?.[locale] ?? "-";