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(aod): UI updates in announcement-of-death application #15827

Merged
merged 5 commits into from
Aug 30, 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 @@ -12,7 +12,7 @@ import {
} from '@island.is/clients/syslumenn'
import {
Answers as aodAnswers,
OtherPropertiesEnum,
PropertiesEnum,
} from '@island.is/application/templates/announcement-of-death/types'
import { NationalRegistry, RoleConfirmationEnum, PickRole } from './types'
import {
Expand Down Expand Up @@ -75,18 +75,10 @@ export class AnnouncementOfDeathService extends BaseTemplateApiService {
}

for (const estate in estates) {
estates[estate].assets = estates[estate].assets.map(baseMapper)
estates[estate].vehicles = [
...estates[estate].vehicles,
...estates[estate].ships,
...estates[estate].flyers,
].map(baseMapper)
estates[estate].estateMembers =
estates[estate].estateMembers.map(baseMapper)
// TODO: remove once empty array diff problem is resolved
// in the application system (property dropped before deepmerge)
estates[estate].assets.unshift(dummyAsset as EstateAsset)
estates[estate].vehicles.unshift(dummyAsset as EstateAsset)
estates[estate].estateMembers.unshift(dummyMember as EstateMember)
estates[estate].guns.unshift(dummyAsset as EstateAsset)
}
Expand Down Expand Up @@ -230,32 +222,30 @@ export class AnnouncementOfDeathService extends BaseTemplateApiService {
estateMembers: JSON.stringify(
answers.estateMembers.members.filter((member) => !member?.dummy),
),
assets: JSON.stringify(
answers.assets.assets.filter((asset) => !asset?.dummy),
),
vehicles: JSON.stringify(
answers.vehicles.vehicles.filter((vehicle) => !vehicle?.dummy),
),
hadFirearms: answers.hadFirearms,
firearm: JSON.stringify(answers.firearmApplicant),
bankcodeSecuritiesOrShares: otherProperties.includes(
OtherPropertiesEnum.ACCOUNTS,
PropertiesEnum.ACCOUNTS,
)
? 'true'
: 'false',
selfOperatedCompany: otherProperties.includes(
OtherPropertiesEnum.OWN_BUSINESS,
PropertiesEnum.OWN_BUSINESS,
)
? 'true'
: 'false',
occupationRightViaCondominium: otherProperties.includes(
OtherPropertiesEnum.RESIDENCE,
PropertiesEnum.RESIDENCE,
)
? 'true'
: 'false',
assetsAbroad: otherProperties.includes(
OtherPropertiesEnum.ASSETS_ABROAD,
)
assetsAbroad: otherProperties.includes(PropertiesEnum.ASSETS_ABROAD)
? 'true'
: 'false',
realEstate: otherProperties.includes(PropertiesEnum.REAL_ESTATE)
? 'true'
: 'false',
vehicles: otherProperties.includes(PropertiesEnum.VEHICLES)
? 'true'
: 'false',
districtCommissionerHasWill:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { Form, FormModes } from '@island.is/application/types'
import CoatOfArms from '../assets/CoatOfArms'
import { m } from '../lib/messages'
import {
extraInfo,
files,
firearmApplicant,
inheritance,
Expand Down Expand Up @@ -66,7 +65,6 @@ export const done: Form = buildForm({
...inheritance,
...properties,
...files,
...extraInfo,
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export const draft: Form = buildForm({
children: [
subSectionInfo,
subSectionWillAndTrade,
subSectionFirearms,
subSectionInheritance,
subSectionProperties,
subSectionFirearms,
subSectionFiles,
],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import { DefaultEvents } from '@island.is/application/types'
import { m } from '../../lib/messages'
import {
additionalInfo,
extraInfo,
properties,
files,
firearmApplicant,
inheritance,
properties,
testament,
theAnnouncer,
theDeceased,
Expand All @@ -30,11 +29,10 @@ export const sectionOverview = buildSection({
...theDeceased,
...theAnnouncer,
...testament,
...firearmApplicant,
...inheritance,
...properties,
...firearmApplicant,
...files,
...extraInfo,
...additionalInfo,
buildSubmitField({
id: 'submit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '@island.is/application/core'
import { m } from '../../lib/messages'
import { Application } from '../../types/schema'
import { removeCountryCode } from '@island.is/application/ui-components'

export const subSectionInfo = buildSubSection({
id: 'infoStep',
Expand Down Expand Up @@ -33,9 +34,16 @@ export const subSectionInfo = buildSubSection({
format: '###-####',
placeholder: '',
width: 'half',
defaultValue: (application: Application) =>
application.externalData?.userProfile?.data?.mobilePhoneNumber ??
'',
defaultValue: (application: Application) => {
const phone =
(
application.externalData.userProfile?.data as {
mobilePhoneNumber?: string
}
)?.mobilePhoneNumber ?? ''

return removeCountryCode(phone)
},
albinagu marked this conversation as resolved.
Show resolved Hide resolved
}),
buildTextField({
id: 'applicantEmail',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
buildMultiField,
buildSubSection,
buildCustomField,
buildCheckboxField,
YES,
} from '@island.is/application/core'
import { m } from '../../lib/messages'

Expand All @@ -28,6 +30,19 @@ export const subSectionInheritance = buildSubSection({
component: 'EstateMemberRepeater',
childInputIds: ['estateMembers.encountered', 'estateMembers.members'],
}),
buildDescriptionField({
id: 'inheritanceConfirmationDescription',
title: '',
description: m.inheritanceConfirmationDescription,
space: 'containerGutter',
}),
buildCheckboxField({
id: 'estateMembers.confirmation',
title: '',
large: false,
backgroundColor: 'white',
options: [{ value: YES, label: m.inheritanceConfirmation }],
}),
],
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
buildCheckboxField,
} from '@island.is/application/core'
import { m } from '../../lib/messages'
import { OtherPropertiesEnum } from '../../types'
import { PropertiesEnum } from '../../types'

export const subSectionProperties = buildSubSection({
id: 'propertiesStep',
Expand All @@ -18,37 +18,6 @@ export const subSectionProperties = buildSubSection({
description: m.propertiesDescription,
space: 2,
children: [
buildDescriptionField({
id: 'realEstatesTitle',
title: m.realEstatesTitle,
titleVariant: 'h3',
description: m.realEstatesDescription,
}),
buildCustomField({
title: 'realEstateRepeater',
id: 'assets',
component: 'RealEstateRepeater',
}),
buildDescriptionField({
id: 'vehiclesTitle',
title: m.vehiclesTitle,
description: m.vehiclesDescription,
space: 5,
titleVariant: 'h3',
}),
buildCustomField({
title: 'Vehicles!',
id: 'vehicles',
component: 'VehiclesRepeater',
childInputIds: ['vehicles.vehicles', 'vehicles.encountered'],
}),
buildDescriptionField({
id: 'otherPropertiesTitle',
title: m.otherPropertiesTitle,
titleVariant: 'h3',
description: m.otherPropertiesDescription,
space: 5,
}),
buildCheckboxField({
id: 'otherProperties',
title: '',
Expand All @@ -57,21 +26,29 @@ export const subSectionProperties = buildSubSection({
doesNotRequireAnswer: true,
defaultValue: '',
options: [
{
label: m.propertiesRealEstate,
value: PropertiesEnum.REAL_ESTATE,
},
{
label: m.propertiesVehicles,
value: PropertiesEnum.VEHICLES,
},
{
label: m.otherPropertiesAccounts,
value: OtherPropertiesEnum.ACCOUNTS,
value: PropertiesEnum.ACCOUNTS,
},
{
label: m.otherPropertiesOwnBusiness,
value: OtherPropertiesEnum.OWN_BUSINESS,
value: PropertiesEnum.OWN_BUSINESS,
},
{
label: m.otherPropertiesResidence,
value: OtherPropertiesEnum.RESIDENCE,
value: PropertiesEnum.RESIDENCE,
},
{
label: m.otherPropertiesAssetsAbroad,
value: OtherPropertiesEnum.ASSETS_ABROAD,
value: PropertiesEnum.ASSETS_ABROAD,
},
],
}),
Expand Down
Loading
Loading