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(inheritance-report): EFS fixes 4.06 #15097

Merged
merged 16 commits into from
Jun 5, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const expandAnswers = (
caseNumber: string
} => {
return {
applicationFor: answers.applicationFor ?? '',
applicant: answers.applicant,
executors: {
executor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import {
ErrorValue,
PREPAID_INHERITANCE,
PrePaidHeirsRelationTypes,

Check warning on line 27 in libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/AdditionalHeir.tsx

View workflow job for this annotation

GitHub Actions / linting (application-system-form,application-template-api-modules,application-template-loader,app...

'PrePaidHeirsRelationTypes' is defined but never used. Allowed unused vars must match /^_[a-zA-Z0-9]*$/u
} from '../../lib/constants'
import { LookupPerson } from '../LookupPerson'
import { HeirsAndPartitionRepeaterProps } from './types'
Expand Down Expand Up @@ -284,8 +284,7 @@
/>
</GridColumn>
) : customField.id === 'taxFreeInheritance' &&
currentHeir?.relation !==
PrePaidHeirsRelationTypes.SPOUSE ? null : (
currentHeir?.relation !== 'Maki' ? null : (
albinagu marked this conversation as resolved.
Show resolved Hide resolved
<GridColumn span={['1/2']} paddingBottom={2}>
<InputController
id={`${fieldIndex}.${customField.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
const relations =
answers.applicationFor === PREPAID_INHERITANCE
? PrePaidHeirsRelations.map((relation) => ({
value: relation.value,
value: formatMessage(relation.label),
label: formatMessage(relation.label),
}))
: externalData?.relationOptions?.map((relation) => ({
Expand Down Expand Up @@ -195,20 +195,15 @@

// currently we can only check if heir is spouse by relation string value...
const spouse = (heirs ?? []).filter(
(heir) =>
heir.enabled &&
(heir.relation === 'Maki' ||
heir.relation.toLowerCase() === 'spouse'),
(heir) => heir.enabled && heir.relation === 'Maki',
)

let isSpouse = false

// it is not possible to select more than one spouse but for now we will check for it anyway
if (spouse.length > 0) {
if (isPrePaid) {
isSpouse =
currentHeir?.relation === 'Maki' ||
currentHeir?.relation.toLowerCase() === 'spouse'
isSpouse = currentHeir?.relation === 'Maki'
} else {
spouse.forEach((currentSpouse) => {
isSpouse =
Expand Down Expand Up @@ -253,7 +248,7 @@

calculateTotal()
},
[answers, calculateTotal, getValues, inheritanceTaxFreeLimit, setValue],

Check warning on line 251 in libs/application/templates/inheritance-report/src/fields/HeirsAndPartitionRepeater/index.tsx

View workflow job for this annotation

GitHub Actions / linting (application-system-form,application-template-api-modules,application-template-loader,app...

React Hook useCallback has a missing dependency: 'application'. Either include it or remove the dependency array
)

const initialLoad = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FieldBaseProps } from '@island.is/application/types'
import { InheritanceReport } from '../../lib/dataSchema'
import { m } from '../../lib/messages'
import { formatCurrency } from '@island.is/application/ui-components'
import { format as formatNationalId } from 'kennitala'

export const HeirsOverview: FC<React.PropsWithChildren<FieldBaseProps>> = ({
application,
Expand All @@ -25,7 +26,7 @@ export const HeirsOverview: FC<React.PropsWithChildren<FieldBaseProps>> = ({
<Box display="flex" marginBottom={2}>
<Box width="half">
<Text variant="h4">{formatMessage(m.nationalId)}</Text>
<Text>{heir.nationalId}</Text>
<Text>{formatNationalId(heir.nationalId ?? '')}</Text>
</Box>
<Box width="half">
<Text variant="h4">{formatMessage(m.name)}</Text>
Expand Down Expand Up @@ -55,16 +56,16 @@ export const HeirsOverview: FC<React.PropsWithChildren<FieldBaseProps>> = ({
</Box>
</Box>
<Box display={'flex'} marginBottom={2}>
<Box width="half">
<Text variant="h4">{formatMessage(m.inheritanceAmount)}</Text>
<Text>{formatCurrency(String(heir.inheritance || '0'))}</Text>
</Box>
<Box width="half">
<Text variant="h4">{formatMessage(m.taxFreeInheritance)}</Text>
<Text>
{formatCurrency(String(heir.taxFreeInheritance || '0'))}
</Text>
</Box>
<Box width="half">
<Text variant="h4">{formatMessage(m.inheritanceAmount)}</Text>
<Text>{formatCurrency(String(heir.inheritance || '0'))}</Text>
</Box>
</Box>
<Box display={'flex'} marginBottom={2}>
<Box width="half">
Expand All @@ -90,7 +91,7 @@ export const HeirsOverview: FC<React.PropsWithChildren<FieldBaseProps>> = ({
<Text variant="h4">
{formatMessage(m.advocateNationalId)}
</Text>
<Text>{heir.advocate.nationalId}</Text>
<Text>{formatNationalId(heir.advocate.nationalId)}</Text>
</Box>
<Box width="half">
<Text variant="h4">{formatMessage(m.advocateName)}</Text>
Expand Down
14 changes: 2 additions & 12 deletions libs/application/templates/inheritance-report/src/forms/form.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import {
YES,
buildCheckboxField,
buildForm,
buildMultiField,
buildSection,
buildSubmitField,
} from '@island.is/application/core'
import { m } from '../lib/messages'
import { DefaultEvents, Form, FormModes } from '@island.is/application/types'
import { buildForm } from '@island.is/application/core'
import { Form, FormModes } from '@island.is/application/types'
import { assets } from './sections/assets'
import { debtsAndFuneralCost } from './sections/debtsAndFuneralCost'
import { heirs } from './sections/heirs'
Expand All @@ -19,7 +11,6 @@ import { preSelection } from './sections/applicationTypeSelection'
import { prePaidHeirs } from './sections/prepaidInheritance/heirs'
import { inheritanceExecutor } from './sections/prepaidInheritance/inheritanceExecutor'
import { inheritance } from './sections/prepaidInheritance/inheritance'
import { prepaidOverview } from './sections/prepaidInheritance/overview'
import { finalStep } from './sections/finalStep'
import { prePaidApplicant } from './sections/prepaidInheritance/applicant'

Expand All @@ -35,7 +26,6 @@ export const prepaidInheritanceForm: Form = buildForm({
inheritance,
assets,
prePaidHeirs,
prepaidOverview,
finalStep,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ export const getForm = (): Form =>
children: [
buildMultiField({
title: m.preDataCollectionApplicationFor,
description: m.preDataCollectionApplicationFoDescription,
albinagu marked this conversation as resolved.
Show resolved Hide resolved
children: [
buildRadioField({
id: 'applicationFor',
title: '',
largeButtons: true,
backgroundColor: 'blue',
required: true,
options: [
{
value: ESTATE_INHERITANCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export const assets = buildSection({
description: (application) =>
application.answers.applicationFor === PREPAID_INHERITANCE
? m.propertiesDescriptionPrePaid
: m.propertiesDescription + ' ' + m.continueWithoutAssets,
: m.propertiesDescription.defaultMessage +
' ' +
m.continueWithoutAssets.defaultMessage,
children: [
buildDescriptionField({
id: 'realEstateTitle',
Expand Down Expand Up @@ -175,7 +177,9 @@ export const assets = buildSection({
id: 'vehicles',
title: m.propertiesTitle,
description:
m.propertiesDescription + ' ' + m.continueWithoutVehicles,
m.propertiesDescription.defaultMessage +
' ' +
m.continueWithoutVehicles.defaultMessage,
children: [
buildDescriptionField({
id: 'vehiclesTitle',
Expand Down Expand Up @@ -310,7 +314,9 @@ export const assets = buildSection({
id: 'estateBankInfo',
title: m.propertiesTitle,
description:
m.propertiesDescription + ' ' + m.continueWithoutBankAccounts,
m.propertiesDescription.defaultMessage +
' ' +
m.continueWithoutBankAccounts.defaultMessage,
children: [
buildDescriptionField({
id: 'estateBankInfoTitle',
Expand Down Expand Up @@ -463,7 +469,9 @@ export const assets = buildSection({
description: (application) =>
application.answers.applicationFor === PREPAID_INHERITANCE
? m.propertiesDescriptionPrePaid
: m.propertiesDescription + ' ' + m.continueWithoutBankAccounts,
: m.propertiesDescription.defaultMessage +
' ' +
m.continueWithoutBankAccounts.defaultMessage,
children: [
buildDescriptionField({
id: 'stocksTitle',
Expand Down Expand Up @@ -549,7 +557,9 @@ export const assets = buildSection({
description: (application) =>
application.answers.applicationFor === PREPAID_INHERITANCE
? m.propertiesDescriptionPrePaid
: m.propertiesDescription + ' ' + m.continueWithoutBankAccounts,
: m.propertiesDescription.defaultMessage +
' ' +
m.continueWithoutBankAccounts.defaultMessage,
children: [
buildDescriptionField({
id: 'moneyTitle',
Expand Down Expand Up @@ -630,7 +640,9 @@ export const assets = buildSection({
description: (application) =>
application.answers.applicationFor === PREPAID_INHERITANCE
? m.propertiesDescriptionPrePaid
: m.propertiesDescription + ' ' + m.continueWithoutBankAccounts,
: m.propertiesDescription.defaultMessage +
' ' +
m.continueWithoutBankAccounts.defaultMessage,
children: [
buildDescriptionField({
id: 'otherAssetsTitle',
Expand Down Expand Up @@ -676,7 +688,6 @@ export const assets = buildSection({
buildSubSection({
id: 'assetOverview',
title: m.assetOverview,
condition: (answers) => answers.applicationFor !== PREPAID_INHERITANCE,
children: [
buildCustomField({
title: m.assetOverview,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
buildTextField,
} from '@island.is/application/core'
import { m } from '../../../lib/messages'
import { prepaidOverview } from './overview'

export const prePaidHeirs = buildSection({
id: 'heirs',
Expand Down Expand Up @@ -117,5 +118,6 @@ export const prePaidHeirs = buildSection({
}),
],
}),
prepaidOverview,
],
})
Loading
Loading