From 7f0e31d9f217ff79a0ff000a4169e3db9879efdd Mon Sep 17 00:00:00 2001 From: albinagu <47886428+albinagu@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:46:19 +0000 Subject: [PATCH 1/2] fix(driving-license): digital license, no pickup (#15881) * fix(driving-license): digital license, no pickup * chore: nx format:write update dirty files --------- Co-authored-by: andes-it Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/dataProviders/index.ts | 1 - .../driving-license/src/forms/draft/draft.ts | 2 - .../src/forms/draft/subSectionDelivery.ts | 51 ------------------- .../src/forms/prerequisites/getForm.ts | 4 +- .../sectionDigitalLicenseInfo.ts | 30 +++++++++++ .../prerequisites/sectionExternalData.ts | 5 -- .../src/lib/drivingLicenseTemplate.ts | 2 - .../driving-license/src/lib/messages.ts | 37 ++++++++++---- 8 files changed, 60 insertions(+), 72 deletions(-) delete mode 100644 libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts create mode 100644 libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts diff --git a/libs/application/templates/driving-license/src/dataProviders/index.ts b/libs/application/templates/driving-license/src/dataProviders/index.ts index c6d5f3243fa1..fe90c3829b53 100644 --- a/libs/application/templates/driving-license/src/dataProviders/index.ts +++ b/libs/application/templates/driving-license/src/dataProviders/index.ts @@ -9,7 +9,6 @@ export { UserProfileApi, CurrentLicenseApi, DrivingAssessmentApi, - JurisdictionApi, QualityPhotoApi, ExistingApplicationApi, } from '@island.is/application/types' diff --git a/libs/application/templates/driving-license/src/forms/draft/draft.ts b/libs/application/templates/driving-license/src/forms/draft/draft.ts index d120dd2231c3..3757e636945a 100644 --- a/libs/application/templates/driving-license/src/forms/draft/draft.ts +++ b/libs/application/templates/driving-license/src/forms/draft/draft.ts @@ -6,7 +6,6 @@ import { subSectionTempInfo } from './subSectionTempInfo' import { subSectionOtherCountry } from './subSectionOtherCountry' import { subSectionOtherCountryDirections } from './subSectionOtherCountryDirections' import { subSectionQualityPhoto } from './subSectionQualityPhoto' -import { subSectionDelivery } from './subSectionDelivery' import { subSectionHealthDeclaration } from './subSectionHealthDeclaration' import { subSectionSummary } from './subSectionSummary' import { subSectionPhone } from './subSectionPhone' @@ -33,7 +32,6 @@ export const draft: Form = buildForm({ subSectionOtherCountry, subSectionOtherCountryDirections, subSectionQualityPhoto, - subSectionDelivery, subSectionHealthDeclaration, subSectionSummary, ], diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts deleted file mode 100644 index a6295a5344c5..000000000000 --- a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { - buildDescriptionField, - buildMultiField, - buildSelectField, - buildSubSection, -} from '@island.is/application/core' -import { m } from '../../lib/messages' -import { - chooseDistrictCommissionerDescription, - hasNoDrivingLicenseInOtherCountry, -} from '../../lib/utils' - -import { Jurisdiction } from '@island.is/clients/driving-license' - -export const subSectionDelivery = buildSubSection({ - id: 'user', - title: m.informationSectionTitle, - condition: hasNoDrivingLicenseInOtherCountry, - children: [ - buildMultiField({ - id: 'info', - title: m.pickupLocationTitle, - space: 1, - children: [ - buildDescriptionField({ - id: 'afhending', - title: m.districtCommisionerTitle, - titleVariant: 'h4', - description: chooseDistrictCommissionerDescription, - }), - buildSelectField({ - id: 'jurisdiction', - title: m.districtCommisionerPickup, - disabled: false, - required: true, - options: ({ - externalData: { - jurisdictions: { data }, - }, - }) => { - return (data as Jurisdiction[]).map(({ id, name, zip }) => ({ - value: `${id}`, - label: name, - tooltip: `Póstnúmer ${zip}`, - })) - }, - }), - ], - }), - ], -}) diff --git a/libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts b/libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts index a003e2366867..404cabe3d5fe 100644 --- a/libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts +++ b/libs/application/templates/driving-license/src/forms/prerequisites/getForm.ts @@ -7,6 +7,7 @@ import { sectionExternalData } from './sectionExternalData' import { sectionApplicationFor } from './sectionApplicationFor' import { sectionRequirements } from './sectionRequirements' import { sectionExistingApplication } from './sectionExistingApplication' +import { sectionDigitalLicenseInfo } from './sectionDigitalLicenseInfo' export const getForm = ({ allowFakeData = false, @@ -29,6 +30,7 @@ export const getForm = ({ sectionExternalData, sectionExistingApplication, ...(allowPickLicense ? [sectionApplicationFor(allowBELicense)] : []), + sectionDigitalLicenseInfo, sectionRequirements, ], }), @@ -43,7 +45,7 @@ export const getForm = ({ children: [], }), buildSection({ - id: 'confim', + id: 'confirm', title: m.applicationDone, children: [], }), diff --git a/libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts b/libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts new file mode 100644 index 000000000000..279e17edd222 --- /dev/null +++ b/libs/application/templates/driving-license/src/forms/prerequisites/sectionDigitalLicenseInfo.ts @@ -0,0 +1,30 @@ +import { + buildAlertMessageField, + buildMultiField, + buildSubSection, +} from '@island.is/application/core' +import { m } from '../../lib/messages' +import { B_TEMP } from '../../lib/constants' + +export const sectionDigitalLicenseInfo = buildSubSection({ + id: 'digitalLicenseInfo', + title: m.digitalLicenseInfoTitle, + children: [ + buildMultiField({ + id: 'info', + title: m.digitalLicenseInfoTitle, + description: m.digitalLicenseInfoDescription, + children: [ + buildAlertMessageField({ + id: 'digitalLicenseInfo', + title: m.digitalLicenseInfoAlertTitle, + message: ({ answers }) => + answers.applicationFor === B_TEMP + ? m.digitalLicenseInfoAlertMessageBTemp + : m.digitalLicenseInfoAlertMessageBFull, + alertType: 'info', + }), + ], + }), + ], +}) diff --git a/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts b/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts index b920cf6deeca..5a8c4a131fdf 100644 --- a/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts +++ b/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts @@ -10,7 +10,6 @@ import { UserProfileApi, CurrentLicenseApi, DrivingAssessmentApi, - JurisdictionApi, QualityPhotoApi, ExistingApplicationApi, } from '@island.is/application/types' @@ -57,10 +56,6 @@ export const sectionExternalData = buildSubSection({ provider: DrivingAssessmentApi, title: '', }), - buildDataProviderItem({ - provider: JurisdictionApi, - title: '', - }), buildDataProviderItem({ provider: SyslumadurPaymentCatalogApi, title: '', diff --git a/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts b/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts index 210c180849c8..43d724e7f327 100644 --- a/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts +++ b/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts @@ -11,7 +11,6 @@ import { ApplicationStateSchema, DefaultEvents, defineTemplateApi, - JurisdictionApi, CurrentLicenseApi, DrivingAssessmentApi, NationalRegistryUserApi, @@ -133,7 +132,6 @@ const template: ApplicationTemplate< }, }), DrivingAssessmentApi, - JurisdictionApi, QualityPhotoApi, ExistingApplicationApi.configure({ params: { diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index 9ae2238b273b..8aabdf363f80 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -105,11 +105,6 @@ export const m = defineMessages({ defaultMessage: 'Sýslumannsembætti', description: 'Information', }, - pickupLocationTitle: { - id: 'dl.application:pickuplocation', - defaultMessage: 'Afhendingarstaður', - description: 'location for pickup', - }, informationApplicant: { id: 'dl.application:information.applicant', defaultMessage: 'Umsækjandi', @@ -432,6 +427,33 @@ export const m = defineMessages({ description: 'Your application for a full driving license has been received. Before a full driving license can be applied for, you must bring the following to the district commissioner.', }, + digitalLicenseInfoTitle: { + id: 'dl.application:digitalLicenseInfoTitle', + defaultMessage: 'Stafrænt ökuskírteini', + description: 'Digital driving license', + }, + digitalLicenseInfoDescription: { + id: 'dl.application:digitalLicenseInfoDescription', + defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', + description: 'Digital driving license', + }, + digitalLicenseInfoAlertTitle: { + id: 'dl.application:digitalLicenseInfoAlertTitle', + defaultMessage: 'Athugið', + description: 'Digital driving license', + }, + digitalLicenseInfoAlertMessageBTemp: { + id: 'dl.application:digitalLicenseInfoAlertMessageBTemp#markdown', + defaultMessage: + 'Þú ert að sækja um bráðabirgðaökuskírteini. Ökuskírteini þitt verður einungis gefið út sem stafrænt ökuskírteini og verður aðgengilegt fyrir þig um leið og öll skilyrði fyrir bráðabirgðaökuskírteini eru uppfyllt.', + description: 'Digital driving license', + }, + digitalLicenseInfoAlertMessageBFull: { + id: 'dl.application:digitalLicenseInfoAlertMessageBFull#markdown', + defaultMessage: + 'Þú ert að sækja um fullnaðarökuskírteini. Ökuskírteini þitt verður núna einungis gefið út sem stafrænt ökuskírteini og verður aðgengilegt fyrir þig þegar þú hefur lokið þessari pöntun um fullnaðarökuskírteini. Fullnaðarökuskírteini þitt verður framleitt í plasti í byrjun febrúar 2025 og sent til þín með Póstinum, á skráð lögheimili þitt um leið og plastökuskírteinið er tilbúið.', + description: 'Digital driving license', + }, congratulationsTempHelpText: { id: 'dl.application:congratulationsTempHelpText', defaultMessage: @@ -559,11 +581,6 @@ export const m = defineMessages({ defaultMessage: 'Sýslumannsembætti', description: 'Title for district commissioner', }, - districtCommisionerPickup: { - id: 'dl.application:districtCommisionerPickup', - defaultMessage: 'Afhending', - description: 'Pickup for district commissioner', - }, chooseDistrictCommisionerForFullLicense: { id: 'dl.application:chooseDistrictCommisionerForFullLicense', defaultMessage: From 8814f41e688e32fe4d322ffef7ec61b3d1be6466 Mon Sep 17 00:00:00 2001 From: albinagu <47886428+albinagu@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:26:44 +0000 Subject: [PATCH 2/2] fix(driving-license): adding back JurisdictionApi check (#15938) * fix(driving-license): adding back JurisdictionApi check * chore: nx format:write update dirty files --------- Co-authored-by: andes-it --- .../src/dataProviders/index.ts | 1 + .../driving-license/src/forms/draft/draft.ts | 2 + .../src/forms/draft/subSectionDelivery.ts | 51 +++++++++++++++++++ .../prerequisites/sectionExternalData.ts | 5 ++ .../src/lib/drivingLicenseTemplate.ts | 2 + .../driving-license/src/lib/messages.ts | 10 ++++ 6 files changed, 71 insertions(+) create mode 100644 libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts diff --git a/libs/application/templates/driving-license/src/dataProviders/index.ts b/libs/application/templates/driving-license/src/dataProviders/index.ts index fe90c3829b53..c6d5f3243fa1 100644 --- a/libs/application/templates/driving-license/src/dataProviders/index.ts +++ b/libs/application/templates/driving-license/src/dataProviders/index.ts @@ -9,6 +9,7 @@ export { UserProfileApi, CurrentLicenseApi, DrivingAssessmentApi, + JurisdictionApi, QualityPhotoApi, ExistingApplicationApi, } from '@island.is/application/types' diff --git a/libs/application/templates/driving-license/src/forms/draft/draft.ts b/libs/application/templates/driving-license/src/forms/draft/draft.ts index 3757e636945a..d120dd2231c3 100644 --- a/libs/application/templates/driving-license/src/forms/draft/draft.ts +++ b/libs/application/templates/driving-license/src/forms/draft/draft.ts @@ -6,6 +6,7 @@ import { subSectionTempInfo } from './subSectionTempInfo' import { subSectionOtherCountry } from './subSectionOtherCountry' import { subSectionOtherCountryDirections } from './subSectionOtherCountryDirections' import { subSectionQualityPhoto } from './subSectionQualityPhoto' +import { subSectionDelivery } from './subSectionDelivery' import { subSectionHealthDeclaration } from './subSectionHealthDeclaration' import { subSectionSummary } from './subSectionSummary' import { subSectionPhone } from './subSectionPhone' @@ -32,6 +33,7 @@ export const draft: Form = buildForm({ subSectionOtherCountry, subSectionOtherCountryDirections, subSectionQualityPhoto, + subSectionDelivery, subSectionHealthDeclaration, subSectionSummary, ], diff --git a/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts new file mode 100644 index 000000000000..a6295a5344c5 --- /dev/null +++ b/libs/application/templates/driving-license/src/forms/draft/subSectionDelivery.ts @@ -0,0 +1,51 @@ +import { + buildDescriptionField, + buildMultiField, + buildSelectField, + buildSubSection, +} from '@island.is/application/core' +import { m } from '../../lib/messages' +import { + chooseDistrictCommissionerDescription, + hasNoDrivingLicenseInOtherCountry, +} from '../../lib/utils' + +import { Jurisdiction } from '@island.is/clients/driving-license' + +export const subSectionDelivery = buildSubSection({ + id: 'user', + title: m.informationSectionTitle, + condition: hasNoDrivingLicenseInOtherCountry, + children: [ + buildMultiField({ + id: 'info', + title: m.pickupLocationTitle, + space: 1, + children: [ + buildDescriptionField({ + id: 'afhending', + title: m.districtCommisionerTitle, + titleVariant: 'h4', + description: chooseDistrictCommissionerDescription, + }), + buildSelectField({ + id: 'jurisdiction', + title: m.districtCommisionerPickup, + disabled: false, + required: true, + options: ({ + externalData: { + jurisdictions: { data }, + }, + }) => { + return (data as Jurisdiction[]).map(({ id, name, zip }) => ({ + value: `${id}`, + label: name, + tooltip: `Póstnúmer ${zip}`, + })) + }, + }), + ], + }), + ], +}) diff --git a/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts b/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts index 5a8c4a131fdf..b920cf6deeca 100644 --- a/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts +++ b/libs/application/templates/driving-license/src/forms/prerequisites/sectionExternalData.ts @@ -10,6 +10,7 @@ import { UserProfileApi, CurrentLicenseApi, DrivingAssessmentApi, + JurisdictionApi, QualityPhotoApi, ExistingApplicationApi, } from '@island.is/application/types' @@ -56,6 +57,10 @@ export const sectionExternalData = buildSubSection({ provider: DrivingAssessmentApi, title: '', }), + buildDataProviderItem({ + provider: JurisdictionApi, + title: '', + }), buildDataProviderItem({ provider: SyslumadurPaymentCatalogApi, title: '', diff --git a/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts b/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts index 43d724e7f327..403230d3c6b1 100644 --- a/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts +++ b/libs/application/templates/driving-license/src/lib/drivingLicenseTemplate.ts @@ -11,6 +11,7 @@ import { ApplicationStateSchema, DefaultEvents, defineTemplateApi, + JurisdictionApi, CurrentLicenseApi, DrivingAssessmentApi, NationalRegistryUserApi, @@ -126,6 +127,7 @@ const template: ApplicationTemplate< UserProfileApi, SyslumadurPaymentCatalogApi, GlassesCheckApi, + JurisdictionApi, CurrentLicenseApi.configure({ params: { useLegacyVersion: true, diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index 8aabdf363f80..f376e0f5045b 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -105,6 +105,11 @@ export const m = defineMessages({ defaultMessage: 'Sýslumannsembætti', description: 'Information', }, + pickupLocationTitle: { + id: 'dl.application:pickuplocation', + defaultMessage: 'Afhendingarstaður', + description: 'location for pickup', + }, informationApplicant: { id: 'dl.application:information.applicant', defaultMessage: 'Umsækjandi', @@ -581,6 +586,11 @@ export const m = defineMessages({ defaultMessage: 'Sýslumannsembætti', description: 'Title for district commissioner', }, + districtCommisionerPickup: { + id: 'dl.application:districtCommisionerPickup', + defaultMessage: 'Afhending', + description: 'Pickup for district commissioner', + }, chooseDistrictCommisionerForFullLicense: { id: 'dl.application:chooseDistrictCommisionerForFullLicense', defaultMessage: