Skip to content

Commit

Permalink
fix(application-driving-license): Fix license requirements (#14784)
Browse files Browse the repository at this point in the history
* fix(application-driving-license): Fix license requirements

* fix(application-driving-license): Fix license requirements

* fix(application-driving-license): Fix license requirements

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
kksteini and kodiakhq[bot] authored May 14, 2024
1 parent ee61ab5 commit 2ec575c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export const sectionApplicationFor = (allowBELicense = false) =>
'currentLicense.data',
) ?? { currentLicense: null }

const { categories } = getValueViaPath<DrivingLicense>(
app.externalData,
'currentLicense.data',
) ?? { categories: null }

const fakeData = getValueViaPath<DrivingLicenseFakeData>(
app.answers,
'fakeData',
Expand All @@ -50,7 +55,7 @@ export const sectionApplicationFor = (allowBELicense = false) =>
subLabel:
m.applicationForFullLicenseDescription.defaultMessage,
value: B_FULL,
disabled: currentLicense !== 'temp',
disabled: !currentLicense,
},
]

Expand All @@ -59,7 +64,9 @@ export const sectionApplicationFor = (allowBELicense = false) =>
label: m.applicationForBELicenseTitle,
subLabel: m.applicationForBELicenseDescription.defaultMessage,
value: BE,
disabled: currentLicense !== 'full',
disabled:
!currentLicense ||
!categories?.some((c) => c.nr.toUpperCase() === 'B'),
})
}

Expand Down
5 changes: 5 additions & 0 deletions libs/application/templates/driving-license/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ export type HasQualityPhotoData = {

export type ConditionFn = (answer: FormValue) => boolean

export type DrivingLicenseCategory = {
nr: string
}

export type DrivingLicense = {
currentLicense: string | null
remarks?: string[]
categories: DrivingLicenseCategory[]
}

0 comments on commit 2ec575c

Please sign in to comment.