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..0e78b42f4298 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,17 @@ export const subSectionDelivery = buildSubSection({ buildMultiField({ id: 'info', title: m.pickupLocationTitle, - space: 1, children: [ buildDescriptionField({ - id: 'afhending', - title: m.districtCommisionerTitle, - titleVariant: 'h4', + id: 'jurisdictionHeader', + title: '', description: chooseDistrictCommissionerDescription, }), buildSelectField({ id: 'jurisdiction', - title: m.districtCommisionerPickup, - disabled: false, + title: m.districtCommissionerPickup, required: true, + placeholder: m.districtCommissionerPickupPlaceholder, options: ({ externalData: { jurisdictions: { data }, @@ -45,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/forms/draft/subSectionHealthDeclaration.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts index d55ada083818..b6c27eee3e1c 100644 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionHealthDeclaration.ts @@ -3,19 +3,16 @@ 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, 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', @@ -25,22 +22,15 @@ export const subSectionHealthDeclaration = buildSubSection({ buildMultiField({ id: 'overview', title: m.healthDeclarationMultiFieldTitle, - description: m.healthDeclarationSubTitle, + condition: (answers) => answers.applicationFor !== B_FULL_RENEWAL_65, 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: [ + buildDescriptionField({ + id: 'healthDeclarationDescription', + title: '', + description: m.healthDeclarationSubTitle, + marginBottom: 2, + }), buildCustomField({ id: 'remarks', title: '', @@ -173,30 +163,15 @@ 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 - ) - }, + condition: (answers) => answers.applicationFor === B_FULL_RENEWAL_65, children: [ buildDescriptionField({ - id: 'healthDeclarationAge65Description', + id: 'healthDeclarationDescription65', title: '', - description: 'Þetta view er í vinnslu', + description: m.healthDeclarationMultiField65Description, }), ], }), 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/forms/draft/subSectionSummary.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionSummary.ts index 845d00cde105..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, 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({}), @@ -145,6 +147,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/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/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index d487aa4eb58d..41f59615efb6 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', @@ -125,6 +130,12 @@ 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', @@ -346,6 +357,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,11 +625,16 @@ 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', }, + districtCommissionerPickupPlaceholder: { + id: 'dl.application:districtCommisionerPickupPlaceholder', + defaultMessage: 'Veldu sýslumannsembætti', + description: 'Choose district commissioner', + }, chooseDistrictCommisionerForFullLicense: { id: 'dl.application:chooseDistrictCommisionerForFullLicense', defaultMessage: