feat: implement applicant name fallback logic in licensing helpers and update MyApplicationsPage

This commit is contained in:
estifanos
2026-08-12 07:18:43 +00:00
parent 829dfed999
commit 0633ecc165
3 changed files with 28 additions and 23 deletions

View File

@@ -33,8 +33,10 @@ import {
import { notifications } from "@mantine/notifications";
import { useTranslation } from "react-i18next";
import {
APPLICANT_NAME_TYPE_KEYS,
STATUS_COLORS,
STATUS_LABELS,
applicantOrCompanyName,
extractErrorMessage,
useClaimApplicationMutation,
useGetAllApplicationsQuery,
@@ -89,27 +91,6 @@ const ALL_STATUSES: LicenseStatus[] = [
"REJECTED",
];
/** Licence types with no `companyName` — the queue's "company" column falls
* back to the applicant name captured in the form instead. */
const APPLICANT_NAME_TYPE_KEYS = [
"SEAFARER_REGISTRATION",
"CERTIFICATE_OF_COMPETENCY",
"CERTIFICATE_OF_PROFICIENCY",
"VESSEL_REGISTRATION",
"VESSEL_OWNERSHIP_TRANSFER",
"ENDORSEMENT_COC",
"ENDORSEMENT_GOC",
];
function applicantOrCompanyName(app: LicenseApplication): string | undefined {
if (!app.licenseType?.key || !APPLICANT_NAME_TYPE_KEYS.includes(app.licenseType.key)) {
return app.companyName ?? undefined;
}
const applicantName = (app.formData?.account as Record<string, unknown> | undefined)
?.applicantName;
return typeof applicantName === "string" && applicantName ? applicantName : undefined;
}
/**
* The officer work pool.
*