Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(driving-license): adding back JurisdictionApi check #15938

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export {
UserProfileApi,
CurrentLicenseApi,
DrivingAssessmentApi,
JurisdictionApi,
QualityPhotoApi,
ExistingApplicationApi,
} from '@island.is/application/types'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -32,6 +33,7 @@ export const draft: Form = buildForm({
subSectionOtherCountry,
subSectionOtherCountryDirections,
subSectionQualityPhoto,
subSectionDelivery,
subSectionHealthDeclaration,
subSectionSummary,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -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}`,
}))
},
}),
],
}),
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
UserProfileApi,
CurrentLicenseApi,
DrivingAssessmentApi,
JurisdictionApi,
QualityPhotoApi,
ExistingApplicationApi,
} from '@island.is/application/types'
Expand Down Expand Up @@ -56,6 +57,10 @@ export const sectionExternalData = buildSubSection({
provider: DrivingAssessmentApi,
title: '',
}),
buildDataProviderItem({
provider: JurisdictionApi,
title: '',
}),
buildDataProviderItem({
provider: SyslumadurPaymentCatalogApi,
title: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ApplicationStateSchema,
DefaultEvents,
defineTemplateApi,
JurisdictionApi,
CurrentLicenseApi,
DrivingAssessmentApi,
NationalRegistryUserApi,
Expand Down Expand Up @@ -128,6 +129,7 @@ const template: ApplicationTemplate<
UserProfileApi,
SyslumadurPaymentCatalogApi,
GlassesCheckApi,
JurisdictionApi,
CurrentLicenseApi.configure({
params: {
useLegacyVersion: true,
Expand Down
10 changes: 10 additions & 0 deletions libs/application/templates/driving-license/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -599,6 +604,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:
Expand Down