From b27dc471d5c5ad777e4863e6fff3a58ebb7f9e6b Mon Sep 17 00:00:00 2001 From: albinagu <47886428+albinagu@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:45:31 +0000 Subject: [PATCH] fix(inheritance-report): inheritance report updates (#16672) * fix(admin): already signed message & create collection available (#16537) * fix(admin): already signed message & create collection available * tweak allowedToProcess --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(admin): compare lists always visible (#16528) * fix(admin): Signatures - display address (#16641) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(inheritance-report): text adjustments (#16649) * fix(inheritance-report): text adjustments * chore: nx format:write update dirty files --------- Co-authored-by: andes-it Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * fix(inheritance-report): done screen and minor cleanup (#16667) * fix(inheritance-report): done screen and minor cleanup * unused * provider --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: andes-it --- .../dataProviders/MaritalStatusProvider.ts | 5 ----- .../src/dataProviders/index.ts | 6 ++++- .../EstateAndVehiclesRepeater/index.tsx | 2 +- .../fields/HeirsRepeater/AdditionalHeir.tsx | 14 ++++++++++-- .../src/fields/HeirsRepeater/index.tsx | 7 +++++- .../inheritance-report/src/forms/done.ts | 4 ++++ .../sections/prepaidInheritance/heirs.ts | 16 ++++++-------- .../prepaidInheritance/inheritance.ts | 1 - .../inheritance-report/src/lib/dataSchema.ts | 5 ----- .../inheritance-report/src/lib/messages.ts | 22 +++++++++++++++++-- .../src/lib/utils/helpers.ts | 2 +- .../formConclusionSection.ts | 4 ++-- 12 files changed, 58 insertions(+), 30 deletions(-) delete mode 100644 libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts diff --git a/libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts b/libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts deleted file mode 100644 index 53b367a2b985..000000000000 --- a/libs/application/templates/inheritance-report/src/dataProviders/MaritalStatusProvider.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { defineTemplateApi } from '@island.is/application/types' - -export const MaritalStatusApi = defineTemplateApi({ - action: 'maritalStatus', -}) diff --git a/libs/application/templates/inheritance-report/src/dataProviders/index.ts b/libs/application/templates/inheritance-report/src/dataProviders/index.ts index 6163d36af574..4cc55ef034e9 100644 --- a/libs/application/templates/inheritance-report/src/dataProviders/index.ts +++ b/libs/application/templates/inheritance-report/src/dataProviders/index.ts @@ -1,7 +1,11 @@ import { defineTemplateApi } from '@island.is/application/types' -export { MaritalStatusApi } from './MaritalStatusProvider' export const EstateOnEntryApi = defineTemplateApi({ action: 'syslumennOnEntry', shouldPersistToExternalData: true, }) + +export const MaritalStatusApi = defineTemplateApi({ + action: 'maritalStatus', + shouldPersistToExternalData: true, +}) diff --git a/libs/application/templates/inheritance-report/src/fields/EstateAndVehiclesRepeater/index.tsx b/libs/application/templates/inheritance-report/src/fields/EstateAndVehiclesRepeater/index.tsx index 96787278d888..cb578d72d99b 100644 --- a/libs/application/templates/inheritance-report/src/fields/EstateAndVehiclesRepeater/index.tsx +++ b/libs/application/templates/inheritance-report/src/fields/EstateAndVehiclesRepeater/index.tsx @@ -1,7 +1,7 @@ import { FC, useState, useEffect, useCallback } from 'react' import { useFieldArray, useFormContext } from 'react-hook-form' import { FieldBaseProps } from '@island.is/application/types' -import { Box, GridRow, Button, Input, Text } from '@island.is/island-ui/core' +import { Box, GridRow, Button, Input } from '@island.is/island-ui/core' import { Answers } from '../../types' import { getErrorViaPath, getValueViaPath } from '@island.is/application/core' import { formatCurrency } from '@island.is/application/ui-components' diff --git a/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/AdditionalHeir.tsx b/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/AdditionalHeir.tsx index ecee1cf537ff..0c6b564c280d 100644 --- a/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/AdditionalHeir.tsx +++ b/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/AdditionalHeir.tsx @@ -40,6 +40,7 @@ export const AdditionalHeir = ({ fieldName, relationOptions, error, + isPrepaid, }: { customFields: HeirsRepeaterProps['field']['props']['customFields'] field: GenericFormField @@ -49,6 +50,7 @@ export const AdditionalHeir = ({ fieldName: string relationOptions: { value: string; label: string }[] error: Record + isPrepaid: boolean }) => { const { formatMessage } = useLocale() const fieldIndex = `${fieldName}[${index}]` @@ -340,7 +342,11 @@ export const AdditionalHeir = ({ - {formatMessage(m.inheritanceAdvocateLabel)} + {formatMessage( + isPrepaid + ? m.inheritanceAdvocateLabelPrePaid + : m.inheritanceAdvocateLabel, + )} @@ -391,7 +397,11 @@ export const AdditionalHeir = ({ - {formatMessage(m.inheritanceAdvocateLabel)} + {formatMessage( + isPrepaid + ? m.inheritanceAdvocateLabelPrePaid + : m.inheritanceAdvocateLabel, + )} diff --git a/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx b/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx index 72d982430c49..639878598c91 100644 --- a/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx +++ b/libs/application/templates/inheritance-report/src/fields/HeirsRepeater/index.tsx @@ -500,7 +500,11 @@ export const HeirsRepeater: FC< variant="h4" color={member.enabled ? 'dark400' : 'dark300'} > - {formatMessage(m.inheritanceAdvocateLabel)} + {formatMessage( + isPrePaidApplication + ? m.inheritanceAdvocateLabelPrePaid + : m.inheritanceAdvocateLabel, + )} @@ -585,6 +589,7 @@ export const HeirsRepeater: FC< updateValues={updateValues} remove={remove} error={error[index] ?? null} + isPrepaid={isPrePaidApplication} /> ) diff --git a/libs/application/templates/inheritance-report/src/forms/done.ts b/libs/application/templates/inheritance-report/src/forms/done.ts index 53181716609a..68154a679be2 100644 --- a/libs/application/templates/inheritance-report/src/forms/done.ts +++ b/libs/application/templates/inheritance-report/src/forms/done.ts @@ -29,6 +29,10 @@ export const done: Form = buildForm({ answers.applicationFor === PREPAID_INHERITANCE ? m.doneDescriptionPrepaidEFS : m.doneDescriptionEFS, + bottomButtonMessage: ({ answers }) => + answers.applicationFor === PREPAID_INHERITANCE + ? m.bottomButtonMessagePrepaidEFS + : m.bottomButtonMessageEFS, }), ], }) diff --git a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts index dbbd7f88cd94..af810a90beb5 100644 --- a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts +++ b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/heirs.ts @@ -86,12 +86,6 @@ export const prePaidHeirs = buildSection({ title: m.heirAdditionalInfo, description: m.heirAdditionalInfoDescription, children: [ - buildDescriptionField({ - id: 'heirsAdditionalInfoFiles', - title: m.info, - titleVariant: 'h5', - marginBottom: 'smallGutter', - }), buildTextField({ id: 'heirsAdditionalInfo', title: '', @@ -103,10 +97,14 @@ export const prePaidHeirs = buildSection({ buildDescriptionField({ id: 'heirsAdditionalInfoFilesOtherDocumentsTitle', title: m.fileUploadOtherDocumentsPrePaid, - description: m.fileUploadOtherDocumentsPrePaidUserGuidelines, - titleVariant: 'h5', + titleVariant: 'h4', space: 'containerGutter', - marginBottom: 'smallGutter', + marginBottom: 2, + }), + buildDescriptionField({ + id: 'heirsAdditionalInfoFilesOtherDocumentsDescription', + title: '', + description: m.fileUploadOtherDocumentsPrePaidUserGuidelines, }), buildFileUploadField({ id: 'heirsAdditionalInfoFilesOtherDocuments', diff --git a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts index 2bc0316aca5b..1d640c9789c6 100644 --- a/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts +++ b/libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritance.ts @@ -1,5 +1,4 @@ import { - YES, buildCheckboxField, buildMultiField, buildSection, diff --git a/libs/application/templates/inheritance-report/src/lib/dataSchema.ts b/libs/application/templates/inheritance-report/src/lib/dataSchema.ts index 6f6c355b68ee..70b60e815a72 100644 --- a/libs/application/templates/inheritance-report/src/lib/dataSchema.ts +++ b/libs/application/templates/inheritance-report/src/lib/dataSchema.ts @@ -45,11 +45,6 @@ const validateAssetNumber = (assetNumber: string) => { return assetNumberPattern.test(assetNumber) } -const validateDebtBankAccount = (assetNumber: string) => { - const assetNumberPattern = /^\d{4}-\d{2}-\d{6}|\d{12}$/ - return assetNumberPattern.test(assetNumber) -} - const assetSchema = ({ withShare }: { withShare?: boolean } = {}) => z .object({ diff --git a/libs/application/templates/inheritance-report/src/lib/messages.ts b/libs/application/templates/inheritance-report/src/lib/messages.ts index 9c0d900d2423..6b6c1afb7a60 100644 --- a/libs/application/templates/inheritance-report/src/lib/messages.ts +++ b/libs/application/templates/inheritance-report/src/lib/messages.ts @@ -1349,8 +1349,9 @@ export const m = defineMessages({ description: '', }, heirsDescriptionPrePaid: { - id: 'ir.application:heirsDescriptionPrePaid', - defaultMessage: 'Lorem ipsum lorem ipsum', + id: 'ir.application:heirsDescriptionPrePaid#markdown', + defaultMessage: + 'Vinsamlegast skráðu upplýsingar um þá erfingja sem eiga að taka við fyrirframgreiddum arfi.', description: '', }, heirsAndPartition: { @@ -1474,6 +1475,11 @@ export const m = defineMessages({ defaultMessage: 'Forsjáraðili/málsvari/sérstakur lögráðamaður', description: 'Custody label', }, + inheritanceAdvocateLabelPrePaid: { + id: 'ir.application:inheritanceAdvocateLabelPrePaid', + defaultMessage: 'Forsjáraðili/málsvari/sérstakur lögráðamaður', + description: 'Custody label', + }, errorSpouseCount: { id: 'ir.application:errorSpouseCount', defaultMessage: 'Aðeins er hægt að hafa einn erfingja sem maka', @@ -1736,6 +1742,18 @@ export const m = defineMessages({ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sit amet urna nec nunc ultricies ultricies.', description: '', }, + bottomButtonMessagePrepaidEFS: { + id: 'ir.application:bottomButtonMessagePrepaidEFS', + defaultMessage: + 'Inni á Mínum síðum og í Ísland.is appinu hefur þú aðgang að þínum upplýsingum og Stafrænu pósthólfi.', + description: '', + }, + bottomButtonMessageEFS: { + id: 'ir.application:bottomButtonMessageEFS', + defaultMessage: + 'Inni á Mínum síðum og í Ísland.is appinu hefur þú aðgang að þínum upplýsingum og Stafrænu pósthólfi.', + description: '', + }, errorRelation: { id: 'ir.application:error.errorRelation', defaultMessage: 'Tengsl virðast ekki vera rétt', diff --git a/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts b/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts index 838e3bd6aedb..fcd171f01573 100644 --- a/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts +++ b/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts @@ -10,7 +10,7 @@ import { parsePhoneNumberFromString } from 'libphonenumber-js' import { MessageDescriptor } from 'react-intl' import { ZodTypeAny } from 'zod' import { Answers } from '../../types' -import { ESTATE_INHERITANCE, PrePaidInheritanceOptions } from '../constants' +import { PrePaidInheritanceOptions } from '../constants' import { InheritanceReport } from '../dataSchema' export const currencyStringToNumber = (str: string) => { diff --git a/libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts b/libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts index c479c4e0a9dd..28f3428b7347 100644 --- a/libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts +++ b/libs/application/ui-forms/src/lib/formConclusionSection/formConclusionSection.ts @@ -7,7 +7,7 @@ import { buildSection, coreMessages, } from '@island.is/application/core' -import { Application, FormText, StaticText } from '@island.is/application/types' +import { FormText, StaticText } from '@island.is/application/types' import { conclusion } from './messages' type Props = Partial<{ @@ -27,7 +27,7 @@ type Props = Partial<{ sectionTitle: StaticText bottomButtonLink: string bottomButtonLabel: StaticText - bottomButtonMessage: StaticText + bottomButtonMessage: FormText }> /**