Skip to content

Commit

Permalink
fix(driving-license): 65 renewal updates (#15946)
Browse files Browse the repository at this point in the history
* fix(driving-license): 65 renewal updates

* adding home delivery - 65+

* tweaks

* cleanup

* cleanup

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
albinagu and kodiakhq[bot] authored Sep 11, 2024
1 parent 72fc394 commit f885cca
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
buildDescriptionField,
buildHiddenInputWithWatchedValue,
buildMultiField,
buildRadioField,
buildSelectField,
buildSubSection,
} from '@island.is/application/core'
Expand All @@ -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',
Expand All @@ -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 },
Expand All @@ -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 },
],
}),
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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: '',
Expand Down Expand Up @@ -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,
}),
],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
buildRadioField,
buildSubSection,
getValueViaPath,
hasYes,
buildDescriptionField,
} from '@island.is/application/core'
import { m } from '../../lib/messages'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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({
Expand Down Expand Up @@ -52,6 +52,8 @@ export const subSectionSummary = buildSubSection({
? m.applicationForTempLicenseTitle
: applicationFor === BE
? m.applicationForBELicenseTitle
: applicationFor === B_FULL_RENEWAL_65
? m.applicationForRenewalLicenseTitle
: m.applicationForFullLicenseTitle,
}),
buildDividerField({}),
Expand Down Expand Up @@ -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 }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
BE,
B_TEMP,
B_FULL,
B_FULL_RENEWAL_65,
ApiActions,
} from './constants'
import { dataSchema } from './dataSchema'
Expand Down Expand Up @@ -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,
Expand Down
30 changes: 28 additions & 2 deletions libs/application/templates/driving-license/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f885cca

Please sign in to comment.