diff --git a/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx b/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx index a19609d51..cefdac499 100644 --- a/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx +++ b/apps/portal/src/app/features/licensing/pages/LicenseApplicationPage.tsx @@ -49,7 +49,7 @@ import { type FieldErrors, type ValidationIssue, } from '@ema-platform/api'; -import { ModalFooter } from '@ema-platform/ui'; +import { getCountryCode, ModalFooter } from '@ema-platform/ui'; import { useCurrentProfile } from '@ema-platform/auth'; import { ConfigDrivenSection } from '../components/ConfigDrivenSection'; import { DocumentSlots } from '../components/DocumentSlots'; @@ -124,11 +124,15 @@ export function LicenseApplicationPage() { const section = config.licenseType.formSchema.sections.find((s) => s.fields.some((f) => f.key === 'nationality'), ); - if (!section) return; + const field = section?.fields.find((f) => f.key === 'nationality'); + if (!section || !field) return; + // Profile stores the full country name; a SELECT field's options follow the + // CountrySelect convention of alpha-2 codes, so translate for that case. + const value = field.type === 'SELECT' ? (getCountryCode(nationality) ?? nationality) : nationality; setDraft((prev) => prev[section.key]?.nationality ? prev - : { ...prev, [section.key]: { ...prev[section.key], nationality } }, + : { ...prev, [section.key]: { ...prev[section.key], nationality: value } }, ); }, [profile?.address?.nationality, config]);