From 5db9deea1c03f7d3a9b795f070e8b184691408e8 Mon Sep 17 00:00:00 2001 From: albina Date: Tue, 10 Sep 2024 15:49:51 +0000 Subject: [PATCH 1/5] fix(driving-license): 65 renewal updates --- .../draft/subSectionHealthDeclaration.ts | 48 ++----------------- .../src/forms/draft/subSectionQualityPhoto.ts | 1 - .../src/lib/drivingLicenseTemplate.ts | 5 ++ .../src/lib/utils/formUtils.ts | 15 ++++++ 4 files changed, 24 insertions(+), 45 deletions(-) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts index d55ada083818..119ca14e9b37 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts @@ -3,16 +3,14 @@ import { buildCustomField, buildSubSection, buildAlertMessageField, - hasYes, buildDescriptionField, YES, } from '@island.is/application/core' -import { NationalRegistryUser } from '@island.is/api/schema' -import { info } from 'kennitala' import { m } from '../../lib/messages' import { hasNoDrivingLicenseInOtherCountry } from '../../lib/utils' import { hasHealthRemarks, + isYoungerThan65, needsHealthCertificateCondition, } from '../../lib/utils/formUtils' import { BE } from '../../lib/constants' @@ -20,26 +18,15 @@ import { BE } from '../../lib/constants' export const subSectionHealthDeclaration = buildSubSection({ id: 'healthDeclaration', title: m.healthDeclarationSectionTitle, - condition: hasNoDrivingLicenseInOtherCountry, + condition: (answers, externalData) => + hasNoDrivingLicenseInOtherCountry(answers) && + isYoungerThan65(answers, externalData), children: [ buildMultiField({ id: 'overview', title: m.healthDeclarationMultiFieldTitle, description: m.healthDeclarationSubTitle, space: 2, - condition: (answers, externalData) => { - if ((answers.fakeData as any).age) { - return (answers.fakeData as any).age < 65 - } - - return ( - !hasYes(answers?.drivingLicenseInOtherCountry) && - info( - (externalData.nationalRegistry.data as NationalRegistryUser) - .nationalId, - ).age < 65 - ) - }, children: [ buildCustomField({ id: 'remarks', @@ -173,32 +160,5 @@ export const subSectionHealthDeclaration = buildSubSection({ }), ], }), - /* Different set of the Health Declaration screen for people over the age of 65 */ - buildMultiField({ - id: 'healthDeclarationAge65', - title: m.healthDeclarationMultiFieldTitle, - description: m.healthDeclarationAge65MultiFieldSubTitle, - space: 1, - condition: (answers, externalData) => { - if ((answers.fakeData as any).age) { - return (answers.fakeData as any).age >= 65 - } - - return ( - !hasYes(answers?.drivingLicenseInOtherCountry) && - info( - (externalData.nationalRegistry.data as NationalRegistryUser) - .nationalId, - ).age >= 65 - ) - }, - children: [ - buildDescriptionField({ - id: 'healthDeclarationAge65Description', - title: '', - description: 'Þetta view er í vinnslu', - }), - ], - }), ], }) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionQualityPhoto.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionQualityPhoto.ts index 214f3d8ecc0f..0b598d74a8e9 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionQualityPhoto.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionQualityPhoto.ts @@ -5,7 +5,6 @@ import { buildRadioField, buildSubSection, getValueViaPath, - hasYes, buildDescriptionField, } from '@island.is/application/core' import { m } from '../../lib/messages' diff --git a/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts b/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts index 5f773c52b519..1f13dbff725b 100644 --- a/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts +++ b/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts @@ -31,6 +31,7 @@ import { BE, B_TEMP, B_FULL, + B_FULL_RENEWAL_65, ApiActions, } from './constants' import { dataSchema } from './dataSchema' @@ -83,6 +84,10 @@ const template: ApplicationTemplate< ? m.applicationForDrivingLicense.defaultMessage + ' - ' + m.applicationForFullLicenseTitle.defaultMessage + : application.answers.applicationFor === B_FULL_RENEWAL_65 + ? m.applicationForDrivingLicense.defaultMessage + + ' - ' + + m.applicationForRenewalLicenseTitle.defaultMessage : m.applicationForDrivingLicense.defaultMessage, institution: m.nationalCommissionerOfPolice, dataSchema, diff --git a/libs/application/templates/driving-license/src/lib/utils/formUtils.ts b/libs/application/templates/driving-license/src/lib/utils/formUtils.ts index 792e143e011c..5eb6d03e5ab2 100644 --- a/libs/application/templates/driving-license/src/lib/utils/formUtils.ts +++ b/libs/application/templates/driving-license/src/lib/utils/formUtils.ts @@ -10,9 +10,12 @@ import { B_FULL, B_TEMP, DrivingLicenseApplicationFor, + DrivingLicenseFakeData, NO, YES, } from '../constants' +import { NationalRegistryUser } from '@island.is/api/schema' +import { info } from 'kennitala' export const allowFakeCondition = (result = YES) => @@ -50,6 +53,18 @@ export const hasNoDrivingLicenseInOtherCountry = (answers: FormValue) => getValueViaPath(answers, 'otherCountry.drivingLicenseInOtherCountry') === NO || true +export const isYoungerThan65 = ( + answers: FormValue, + externalData: ExternalData, +) => { + const fakeData = getValueViaPath(answers, 'fakeData') + const age = info( + (externalData.nationalRegistry.data as NationalRegistryUser).nationalId, + )?.age + + return fakeData && fakeData.age ? fakeData.age < 65 : age < 65 +} + export const chooseDistrictCommissionerDescription = ({ answers, }: { From 3763043cf1373081a39be15d1d8cceb3ccb4ce64 Mon Sep 17 00:00:00 2001 From: albina Date: Wed, 11 Sep 2024 14:22:06 +0000 Subject: [PATCH 2/5] adding home delivery - 65+ --- .../src/forms/draft/subSectionDelivery.ts | 49 ++++++++++++++++--- .../src/forms/draft/subSectionSummary.ts | 12 ++++- .../driving-license/src/lib/constants.ts | 5 ++ .../driving-license/src/lib/messages.ts | 19 ++++++- 4 files changed, 76 insertions(+), 9 deletions(-) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts index a6295a5344c5..522e93db21d5 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts @@ -1,6 +1,8 @@ import { buildDescriptionField, + buildHiddenInputWithWatchedValue, buildMultiField, + buildRadioField, buildSelectField, buildSubSection, } from '@island.is/application/core' @@ -11,6 +13,7 @@ import { } from '../../lib/utils' import { Jurisdiction } from '@island.is/clients/driving-license' +import { B_FULL_RENEWAL_65, Pickup } from '../../lib/constants' export const subSectionDelivery = buildSubSection({ id: 'user', @@ -20,19 +23,53 @@ export const subSectionDelivery = buildSubSection({ buildMultiField({ id: 'info', title: m.pickupLocationTitle, - space: 1, children: [ buildDescriptionField({ - id: 'afhending', - title: m.districtCommisionerTitle, + id: 'pickupHeader', + title: '', + description: m.pickupLocationHeader, titleVariant: 'h4', + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + }), + buildRadioField({ + id: 'pickup', + title: '', + defaultValue: Pickup.POST, + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + options: [ + { value: Pickup.POST, label: m.overviewPickupPost }, + { value: Pickup.DISTRICT, label: m.overviewPickupDistrict }, + ], + }), + buildDescriptionField({ + id: 'PickupSpace', + title: '', + space: 'gutter', + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + }), + buildHiddenInputWithWatchedValue({ + id: 'pickupWatched', + watchValue: 'pickup', + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + }), + buildDescriptionField({ + id: 'jurisdictionHeader', + title: '', description: chooseDistrictCommissionerDescription, + condition: (answers) => + answers.applicationFor === B_FULL_RENEWAL_65 + ? answers.pickupWatched === Pickup.DISTRICT + : true, }), buildSelectField({ id: 'jurisdiction', - title: m.districtCommisionerPickup, - disabled: false, - required: true, + title: m.districtCommissionerPickup, + condition: (answers) => + answers.applicationFor === B_FULL_RENEWAL_65 + ? answers.pickupWatched === Pickup.DISTRICT + : true, + // Kópavogur is the default jurisdiction + defaultValue: '37', options: ({ externalData: { jurisdictions: { data }, diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts index 845d00cde105..e876c2d90df6 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts @@ -13,7 +13,7 @@ import { NationalRegistryUser, TeacherV4 } from '../../types/schema' import { m } from '../../lib/messages' import { format as formatKennitala } from 'kennitala' import { StudentAssessment } from '@island.is/api/schema' -import { B_TEMP, BE, YES } from '../../lib/constants' +import { B_TEMP, BE, Pickup, YES } from '../../lib/constants' import { hasNoDrivingLicenseInOtherCountry, isApplicationForCondition, @@ -145,6 +145,16 @@ export const subSectionSummary = buildSubSection({ condition: needsHealthCertificateCondition(YES), }), buildDividerField({}), + buildKeyValueField({ + label: m.pickupLocationTitle, + value: ({ answers }) => { + return answers.pickup === Pickup.POST + ? m.overviewPickupPost + : m.overviewPickupDistrict + }, + width: 'full', + }), + buildDividerField({}), buildKeyValueField({ label: m.overviewPaymentCharge, value: ({ externalData, answers }) => { diff --git a/libs/application/templates/driving-license/src/lib/constants.ts b/libs/application/templates/driving-license/src/lib/constants.ts index 9e10791fd19d..9bab845f6746 100644 --- a/libs/application/templates/driving-license/src/lib/constants.ts +++ b/libs/application/templates/driving-license/src/lib/constants.ts @@ -10,6 +10,11 @@ export const B_TEMP = 'B-temp' export const B_FULL_RENEWAL_65 = 'B-full-renewal-65' export const BE = 'BE' +export enum Pickup { + 'POST' = 'post', + 'DISTRICT' = 'district', +} + export const otherLicenseCategories = ['C', 'C1', 'CE', 'D', 'D1', 'DE'] export const codesRequiringHealthCertificate = ['400', '01.06'] diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index d487aa4eb58d..9ee06285c9f7 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -106,10 +106,15 @@ export const m = defineMessages({ description: 'Information', }, pickupLocationTitle: { - id: 'dl.application:pickuplocation', + id: 'dl.application:pickupLocationTitle', defaultMessage: 'Afhendingarstaður', description: 'location for pickup', }, + pickupLocationHeader: { + id: 'dl.application:pickupLocationHeader', + defaultMessage: 'Hvar viltu sækja/fá ökuskírteinið?', + description: 'Where do you want to pick up your driving license?', + }, informationApplicant: { id: 'dl.application:information.applicant', defaultMessage: 'Umsækjandi', @@ -346,6 +351,16 @@ export const m = defineMessages({ defaultMessage: 'Ég kem með vottorð frá lækni meðferðis', description: `I'll bring a certificate from a doctor`, }, + overviewPickupPost: { + id: 'dl.application:overview.pickupPost', + defaultMessage: 'Sent heim í pósti', + description: 'By mail', + }, + overviewPickupDistrict: { + id: 'dl.application:overview.pickupDistrict', + defaultMessage: 'Sækja á afhendingarstað', + description: 'Pickup location', + }, applicationDone: { id: 'dl.application:overview.done', defaultMessage: 'Umsókn móttekin', @@ -604,7 +619,7 @@ export const m = defineMessages({ defaultMessage: 'Sýslumannsembætti', description: 'Title for district commissioner', }, - districtCommisionerPickup: { + districtCommissionerPickup: { id: 'dl.application:districtCommisionerPickup', defaultMessage: 'Afhending', description: 'Pickup for district commissioner', From c27c5bef38dd3488248660cb9ee837e9bd29bae4 Mon Sep 17 00:00:00 2001 From: albina Date: Wed, 11 Sep 2024 15:26:21 +0000 Subject: [PATCH 3/5] tweaks --- .../draft/subSectionHealthDeclaration.ts | 27 ++++++++++++++----- .../src/forms/draft/subSectionSummary.ts | 6 +++-- .../driving-license/src/lib/messages.ts | 5 ++++ .../src/lib/utils/formUtils.ts | 15 ----------- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts index 119ca14e9b37..99725895fe2f 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts @@ -10,24 +10,27 @@ import { m } from '../../lib/messages' import { hasNoDrivingLicenseInOtherCountry } from '../../lib/utils' import { hasHealthRemarks, - isYoungerThan65, needsHealthCertificateCondition, } from '../../lib/utils/formUtils' -import { BE } from '../../lib/constants' +import { BE, B_FULL_RENEWAL_65 } from '../../lib/constants' export const subSectionHealthDeclaration = buildSubSection({ id: 'healthDeclaration', title: m.healthDeclarationSectionTitle, - condition: (answers, externalData) => - hasNoDrivingLicenseInOtherCountry(answers) && - isYoungerThan65(answers, externalData), + condition: (answers) => hasNoDrivingLicenseInOtherCountry(answers), children: [ buildMultiField({ id: 'overview', title: m.healthDeclarationMultiFieldTitle, - description: m.healthDeclarationSubTitle, + condition: (answers) => answers.applicationFor !== B_FULL_RENEWAL_65, space: 2, children: [ + buildDescriptionField({ + id: 'healthDeclarationDescription', + title: '', + description: m.healthDeclarationSubTitle, + marginBottom: 2, + }), buildCustomField({ id: 'remarks', title: '', @@ -160,5 +163,17 @@ export const subSectionHealthDeclaration = buildSubSection({ }), ], }), + buildMultiField({ + id: 'healthDeclaration', + title: m.healthDeclarationMultiFieldTitle, + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + children: [ + buildDescriptionField({ + id: 'healthDeclarationDescription65', + title: '', + description: m.healthDeclarationMultiField65Description, + }), + ], + }), ], }) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts index e876c2d90df6..8f6485980beb 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts @@ -13,7 +13,7 @@ import { NationalRegistryUser, TeacherV4 } from '../../types/schema' import { m } from '../../lib/messages' import { format as formatKennitala } from 'kennitala' import { StudentAssessment } from '@island.is/api/schema' -import { B_TEMP, BE, Pickup, YES } from '../../lib/constants' +import { B_FULL_RENEWAL_65, B_TEMP, BE, Pickup, YES } from '../../lib/constants' import { hasNoDrivingLicenseInOtherCountry, isApplicationForCondition, @@ -23,7 +23,7 @@ import { formatPhoneNumber } from '@island.is/application/ui-components' export const subSectionSummary = buildSubSection({ id: 'overview', - title: m.overviewSectionTitle, + title: m.overviewMultiFieldTitle, condition: hasNoDrivingLicenseInOtherCountry, children: [ buildMultiField({ @@ -52,6 +52,8 @@ export const subSectionSummary = buildSubSection({ ? m.applicationForTempLicenseTitle : applicationFor === BE ? m.applicationForBELicenseTitle + : applicationFor === B_FULL_RENEWAL_65 + ? m.applicationForRenewalLicenseTitle : m.applicationForFullLicenseTitle, }), buildDividerField({}), diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index 9ee06285c9f7..863997bb7bd0 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -130,6 +130,11 @@ export const m = defineMessages({ defaultMessage: 'Heilbrigðisyfirlýsing', description: 'Health declaration', }, + healthDeclarationMultiField65Description: { + id: 'dl.application:healthDeclarationMultiField65Description#markdown', + defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam auctor, nunc nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc. Nullam auctor, nunc nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc.', + description: 'Health declaration', + }, healthDeclarationMultiFieldSubTitle: { id: 'dl.application:healthDeclarationMultiField.subTitle', defaultMessage: 'Yfirlýsing um líkamlegt og andlegt heilbrigði', diff --git a/libs/application/templates/driving-license/src/lib/utils/formUtils.ts b/libs/application/templates/driving-license/src/lib/utils/formUtils.ts index 5eb6d03e5ab2..792e143e011c 100644 --- a/libs/application/templates/driving-license/src/lib/utils/formUtils.ts +++ b/libs/application/templates/driving-license/src/lib/utils/formUtils.ts @@ -10,12 +10,9 @@ import { B_FULL, B_TEMP, DrivingLicenseApplicationFor, - DrivingLicenseFakeData, NO, YES, } from '../constants' -import { NationalRegistryUser } from '@island.is/api/schema' -import { info } from 'kennitala' export const allowFakeCondition = (result = YES) => @@ -53,18 +50,6 @@ export const hasNoDrivingLicenseInOtherCountry = (answers: FormValue) => getValueViaPath(answers, 'otherCountry.drivingLicenseInOtherCountry') === NO || true -export const isYoungerThan65 = ( - answers: FormValue, - externalData: ExternalData, -) => { - const fakeData = getValueViaPath(answers, 'fakeData') - const age = info( - (externalData.nationalRegistry.data as NationalRegistryUser).nationalId, - )?.age - - return fakeData && fakeData.age ? fakeData.age < 65 : age < 65 -} - export const chooseDistrictCommissionerDescription = ({ answers, }: { From 43f6153ba3dd61437ffe05c27826f065d1672f1a Mon Sep 17 00:00:00 2001 From: albina Date: Wed, 11 Sep 2024 15:27:47 +0000 Subject: [PATCH 4/5] cleanup --- .../src/forms/draft/subSectionHealthDeclaration.ts | 4 ++-- .../application/templates/driving-license/src/lib/messages.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts index 99725895fe2f..b6c27eee3e1c 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts @@ -17,7 +17,7 @@ import { BE, B_FULL_RENEWAL_65 } from '../../lib/constants' export const subSectionHealthDeclaration = buildSubSection({ id: 'healthDeclaration', title: m.healthDeclarationSectionTitle, - condition: (answers) => hasNoDrivingLicenseInOtherCountry(answers), + condition: hasNoDrivingLicenseInOtherCountry, children: [ buildMultiField({ id: 'overview', @@ -164,7 +164,7 @@ export const subSectionHealthDeclaration = buildSubSection({ ], }), buildMultiField({ - id: 'healthDeclaration', + id: 'healthDeclarationAge65', title: m.healthDeclarationMultiFieldTitle, condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, children: [ diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index 863997bb7bd0..6ac7b5b1fd13 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -132,7 +132,8 @@ export const m = defineMessages({ }, healthDeclarationMultiField65Description: { id: 'dl.application:healthDeclarationMultiField65Description#markdown', - defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam auctor, nunc nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc. Nullam auctor, nunc nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc.', + defaultMessage: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam auctor, nunc nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc. Nullam auctor, nunc nec ultricies ultricies, nunc nisl ultricies nunc, nec ultricies nunc nisl nec nunc.', description: 'Health declaration', }, healthDeclarationMultiFieldSubTitle: { From 926f4e9f532c43aebe592bebf497185e62680a48 Mon Sep 17 00:00:00 2001 From: albina Date: Wed, 11 Sep 2024 15:51:03 +0000 Subject: [PATCH 5/5] cleanup --- .../src/forms/draft/subSectionDelivery.ts | 58 +++++++------------ .../driving-license/src/lib/messages.ts | 5 ++ 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts index 522e93db21d5..0e78b42f4298 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts @@ -24,52 +24,16 @@ export const subSectionDelivery = buildSubSection({ id: 'info', title: m.pickupLocationTitle, children: [ - buildDescriptionField({ - id: 'pickupHeader', - title: '', - description: m.pickupLocationHeader, - titleVariant: 'h4', - condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, - }), - buildRadioField({ - id: 'pickup', - title: '', - defaultValue: Pickup.POST, - condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, - options: [ - { value: Pickup.POST, label: m.overviewPickupPost }, - { value: Pickup.DISTRICT, label: m.overviewPickupDistrict }, - ], - }), - buildDescriptionField({ - id: 'PickupSpace', - title: '', - space: 'gutter', - condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, - }), - buildHiddenInputWithWatchedValue({ - id: 'pickupWatched', - watchValue: 'pickup', - condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, - }), buildDescriptionField({ id: 'jurisdictionHeader', title: '', description: chooseDistrictCommissionerDescription, - condition: (answers) => - answers.applicationFor === B_FULL_RENEWAL_65 - ? answers.pickupWatched === Pickup.DISTRICT - : true, }), buildSelectField({ id: 'jurisdiction', title: m.districtCommissionerPickup, - condition: (answers) => - answers.applicationFor === B_FULL_RENEWAL_65 - ? answers.pickupWatched === Pickup.DISTRICT - : true, - // Kópavogur is the default jurisdiction - defaultValue: '37', + required: true, + placeholder: m.districtCommissionerPickupPlaceholder, options: ({ externalData: { jurisdictions: { data }, @@ -82,6 +46,24 @@ export const subSectionDelivery = buildSubSection({ })) }, }), + buildDescriptionField({ + id: 'pickupHeader', + title: '', + description: m.pickupLocationHeader, + titleVariant: 'h4', + space: 'containerGutter', + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + }), + buildRadioField({ + id: 'pickup', + title: '', + defaultValue: Pickup.POST, + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, + options: [ + { value: Pickup.POST, label: m.overviewPickupPost }, + { value: Pickup.DISTRICT, label: m.overviewPickupDistrict }, + ], + }), ], }), ], diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index 6ac7b5b1fd13..41f59615efb6 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -630,6 +630,11 @@ export const m = defineMessages({ defaultMessage: 'Afhending', description: 'Pickup for district commissioner', }, + districtCommissionerPickupPlaceholder: { + id: 'dl.application:districtCommisionerPickupPlaceholder', + defaultMessage: 'Veldu sýslumannsembætti', + description: 'Choose district commissioner', + }, chooseDistrictCommisionerForFullLicense: { id: 'dl.application:chooseDistrictCommisionerForFullLicense', defaultMessage: