mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-26 19:12:50 +00:00
feat: update applicant name handling for license types without company name
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user