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 finalizing changes #14867

Merged
merged 19 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 16 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 @@ -483,22 +483,6 @@ export const CalculateShare: FC<React.PropsWithChildren<FieldBaseProps>> = ({
title={m.netProperty}
value={roundedValueToNumber(netTotal)}
/>
{deceasedHadAssets && shareTotal > 0 && (
<TitleRow title={m.share} value={roundedValueToNumber(shareTotal)} />
)}
<Box marginLeft={[0, 4]}>
<GridRow rowGap={1}>
<ShareItemRow item={shareValues.bankAccounts} />
<ShareItemRow item={shareValues.claims} />
<ShareItemRow item={shareValues.guns} />
<ShareItemRow item={shareValues.inventory} />
<ShareItemRow item={shareValues.money} />
<ShareItemRow item={shareValues.otherAssets} />
<ShareItemRow item={shareValues.realEstate} />
<ShareItemRow item={shareValues.stocks} />
<ShareItemRow item={shareValues.vehicles} />
</GridRow>
</Box>
<Box marginY={4}>
{deceasedWasInCohabitation && (
<TitleRow
Expand All @@ -511,6 +495,9 @@ export const CalculateShare: FC<React.PropsWithChildren<FieldBaseProps>> = ({
value={roundedValueToNumber(estateTotal)}
/>
</Box>
{deceasedHadAssets && shareTotal > 0 && (
<TitleRow title={m.share} value={roundedValueToNumber(shareTotal)} />
)}
<Divider />
<Box paddingTop={4}>
<TitleRow
Expand All @@ -525,49 +512,6 @@ export const CalculateShare: FC<React.PropsWithChildren<FieldBaseProps>> = ({

export default CalculateShare

const ShareItemRow = ({ item }: { item: ShareItem }) => {
const { formatMessage } = useLocale()

const total = item.items.reduce((acc, item) => acc + item.value, 0)
const shareTotal = item.items.reduce(
(acc, item) => acc + item.deceasedShareValue,
0,
)

return (
<GridColumn span={['1/1']}>
<GridRow rowGap={0}>
<GridColumn span={['1/1', '1/2']}>
{item.title && (
<Text variant="small">{formatMessage(item.title)}</Text>
)}
</GridColumn>
<GridColumn span={['1/1', '1/2']}>
<Box textAlign={['left', 'right']}>
<Text variant="small">
{formatCurrency(String(roundedValueToNumber(total)))}
</Text>
</Box>
</GridColumn>
{shareTotal > 0 && (
<>
<GridColumn span={['1/1', '1/2']}>
<Text variant="small">{formatMessage(m.share)}</Text>
</GridColumn>
<GridColumn span={['1/1', '1/2']}>
<Box textAlign={['left', 'right']}>
<Text variant="small">
{formatCurrency(String(roundedValueToNumber(shareTotal)))}
</Text>
</Box>
</GridColumn>
</>
)}
</GridRow>
</GridColumn>
)
}

const TitleRow = ({
title,
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ export const CalculateTotalDebts: FC<
const publicCharges = valueToNumber(
getValueViaPath<number>(answers, 'debts.publicCharges'),
)
const funeralCost = valueToNumber(
getValueViaPath<number>(answers, 'funeralCost.total'),
)

const [total] = useState(domesticAndForeignDebts + publicCharges)
const [total] = useState(
domesticAndForeignDebts + publicCharges + funeralCost,
)
albinagu marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
setValue('debts.debtsTotal', total)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export const HeirsAndPartitionRepeater: FC<
label: relation,
})) || []

const error = (errors as any)?.heirs?.data ?? {}
const error =
((errors as any)?.heirs?.data || (errors as any)?.heirs?.total) ?? []
console.log(error)

const handleAddMember = () =>
append({
Expand Down Expand Up @@ -617,7 +619,7 @@ export const HeirsAndPartitionRepeater: FC<
readOnly
hasError={
(props.sumField === 'heirsPercentage' &&
error &&
!!error.length &&
total !== 100) ??
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import {
import { m } from '../lib/messages'
import { DefaultEvents, Form, FormModes } from '@island.is/application/types'
import { assets } from './sections/assets'
import { debts } from './sections/debts'
import { debtsAndFuneralCost } from './sections/debtsAndFuneralCost'
import { heirs } from './sections/heirs'
import { funeralCost } from './sections/funeralCost'
import { applicant } from './sections/applicant'
import { dataCollection } from './sections/dataCollection'
import { deceased } from './sections/deceased'
Expand All @@ -26,13 +25,12 @@ export const form: Form = buildForm({
renderLastScreenButton: true,
children: [
preSelection,
deceased,
dataCollection,
deceased,
applicationInfo,
applicant,
assets,
funeralCost,
debts,
debtsAndFuneralCost,
heirs,
buildSection({
id: 'finalStep',
Expand Down

This file was deleted.

Loading
Loading