feat: update applicant name handling for license types without company name

This commit is contained in:
estifanos
2026-08-11 08:42:32 +00:00
parent 5c2d4e6b9e
commit 6b946f0149

View File

@@ -89,13 +89,20 @@ const ALL_STATUSES: LicenseStatus[] = [
"REJECTED",
];
/**
* Seafarer registrations are person-centric — there is no `companyName`, so
* the queue's "company" column falls back to the applicant name captured in
* the registration form.
*/
/** 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",
];
function applicantOrCompanyName(app: LicenseApplication): string | undefined {
if (app.licenseType?.key !== "SEAFARER_REGISTRATION") return app.companyName ?? 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;
@@ -396,7 +403,7 @@ export function LicenseQueuePage() {
},
{
header: sortableHeader(
typeCode === "SEAFARER_REGISTRATION"
typeCode && APPLICANT_NAME_TYPE_KEYS.includes(typeCode)
? t("queue.applicant", "Applicant")
: t("queue.company", "Company"),
"companyName",