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

chore(inao): Make inao applications share code #16473

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import {
APPLICANTASMEMBER,
ACTORASCARETAKER,
ACTORLONEBOARDMEMBER,
} from '../../utils/constants'

} from '@island.is/application/templates/inao/shared'
import { getBoardmembersAndCaretakers } from '../../utils/helpers'
import { CaretakerRepeaterItem } from './CemeteryCaretakerRepeaterItem'
import { BoardMember } from '../../types/types'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import { useLocale } from '@island.is/localization'
import { FieldBaseProps } from '@island.is/application/types'
import { InputController } from '@island.is/shared/form-fields'
import { m } from '../../lib/messages'
import { Total } from '../KeyNumbers'
import { getErrorViaPath, getValueViaPath } from '@island.is/application/core'
import {
CAPITALNUMBERS,
CEMETERYEQUITIESANDLIABILITIESIDS,
INPUTCHANGEINTERVAL,
OPERATINGCOST,
VALIDATOR,
} from '../../utils/constants'
Total,
getTotal,
} from '@island.is/application/templates/inao/shared'
import { CEMETERYEQUITIESANDLIABILITIESIDS } from '../../utils/constants'
import { useTotals } from '../../hooks/useTotals'
import { getTotal } from '../../utils/helpers'

export const CemeteryEquities = ({
application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import { RecordObject } from '@island.is/application/types'
import debounce from 'lodash/debounce'
import { useFormContext } from 'react-hook-form'
import { m } from '../../lib/messages'

import { FinancialStatementsInaoTaxInfo } from '@island.is/api/schema'
import {
CEMETERYOPERATIONIDS,
INPUTCHANGEINTERVAL,
} from '../../utils/constants'
import { CEMETERYOPERATIONIDS } from '../../utils/constants'
import { INPUTCHANGEINTERVAL } from '@island.is/application/templates/inao/shared'
type Props = {
data?: {
financialStatementsInaoTaxInfo: FinancialStatementsInaoTaxInfo[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import { useFormContext } from 'react-hook-form'
import { getErrorViaPath, getValueViaPath } from '@island.is/application/core'
import { m } from '../../lib/messages'
import { FinancialStatementsInaoTaxInfo } from '@island.is/api/schema'
import {
CEMETERYOPERATIONIDS,
INPUTCHANGEINTERVAL,
TaxInfoTypes,
} from '../../utils/constants'
import { CEMETERYOPERATIONIDS, TaxInfoTypes } from '../../utils/constants'
import { INPUTCHANGEINTERVAL } from '@island.is/application/templates/inao/shared'

type Props = {
data?: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ import {
import { Application } from '@island.is/application/types'
import { useLocale } from '@island.is/localization'
import { m } from '../../lib/messages'
import { Total } from '../KeyNumbers'
import { CemetryIncome } from './CemeteryIncome'
import { CemeteryExpenses } from './CemeteryExpenses'
import { CemeteryIncomeLimit } from '../CemeteryIncomeLimit/index'
import { useQuery } from '@apollo/client'
import { getValueViaPath } from '@island.is/application/core'
import { taxInfoQuery } from '../../graphql'
import { CEMETERYOPERATIONIDS, OPERATINGCOST } from '../../utils/constants'
import { CEMETERYOPERATIONIDS } from '../../utils/constants'
import { useTotals } from '../../hooks/useTotals'
import {
Total,
OPERATINGCOST,
} from '@island.is/application/templates/inao/shared'

export const CemeteryOperation = ({
application,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ import { format as formatNationalId } from 'kennitala'
import { useSubmitApplication } from '../../hooks/useSubmitApplication'
import { m } from '../../lib/messages'
import { FinancialStatementCemetery } from '../../lib/dataSchema'
import { currencyStringToNumber, formatCurrency } from '../../utils/helpers'
import { AboutOverview } from './AboutOverview'
import { ValueLine } from './ValueLine'
import { CapitalNumberOverview } from './CapitalNumbersOverview'
import { BOARDMEMEBER } from '../../utils/constants'
import { FileValueLine } from './FileValueLine'
import BottomBar from './BottomBar'
import {
columnStyle,
sectionColumn,
starterColumnStyle,
} from './overviewStyles.css'
import {
AboutOverview,
CapitalNumberOverview,
ValueLine,
BottomBar,
FileValueLine,
formatCurrency,
currencyStringToNumber,
} from '@island.is/application/templates/inao/shared'

export const CemeteryOverview = ({
application,
Expand Down Expand Up @@ -86,7 +89,15 @@ export const CemeteryOverview = ({
<Box marginBottom={2}>
<Divider />
<Box paddingY={3}>
<AboutOverview answers={answers} />
<AboutOverview
about={answers.about}
fullName={m.fullName}
nationalId={m.nationalId}
powerOfAttorneyName={m.powerOfAttorneyName}
powerOfAttorneyNationalId={m.powerOfAttorneyNationalId}
email={m.email}
phoneNumber={m.phoneNumber}
/>
</Box>
<Divider />
<Box paddingY={3}>
Expand Down Expand Up @@ -175,7 +186,15 @@ export const CemeteryOverview = ({
<Divider />

<Box paddingY={3}>
<CapitalNumberOverview answers={answers} />
<CapitalNumberOverview
capitalNumbersMessage={m.capitalNumbers}
capitalIncomeMessage={m.capitalIncome}
capitalIncome={answers.capitalNumbers.capitalIncome}
capitalCostMessage={m.capitalCost}
capitalCost={answers.capitalNumbers.capitalCost}
totalCapitalMessage={m.totalCapital}
total={answers.capitalNumbers.total}
/>
</Box>
<Divider />
<Box paddingY={3}>
Expand Down Expand Up @@ -309,7 +328,10 @@ export const CemeteryOverview = ({
) : null}
{fileName ? (
<>
<FileValueLine label={answers.attachments?.file?.[0]?.name} />
<FileValueLine
label={answers.attachments?.file?.[0]?.name}
files={m.files}
Comment on lines +332 to +333
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeRabbit has some valid concerns here, for example this; shouldn't it be the other way around?
Also other things Coderabbit mentioned

/>
Comment on lines +331 to +334
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Possible mismatch in props for <FileValueLine> component

The label prop is set to answers.attachments?.file?.[0]?.name, which is likely a string, while the files prop is set to m.files, which appears to be a message object. Ensure that files prop receives the correct file data array and that m.files is the intended value.

Apply this diff if files should be the array of files:

<FileValueLine
  label={answers.attachments?.file?.[0]?.name}
- files={m.files}
+ files={answers.attachments?.file}

Committable suggestion was skipped due to low confidence.

<Divider />
</>
) : null}
Expand Down Expand Up @@ -372,6 +394,8 @@ export const CemeteryOverview = ({
loading={loading}
onSendButtonClick={onSendButtonClick}
onBackButtonClick={onBackButtonClick}
goBack={m.goBack}
send={m.send}
/>
</Box>
)
Expand Down
Loading
Loading