diff --git a/src/components/PartnerBonusFormSteps.tsx b/src/components/PartnerBonusFormSteps.tsx index d38018df..aa4bca10 100644 --- a/src/components/PartnerBonusFormSteps.tsx +++ b/src/components/PartnerBonusFormSteps.tsx @@ -3,7 +3,7 @@ import { BooleanRadio, Checkbox, Input } from './FormComponents' import { formatRodneCislo } from '../lib/utils' import { PartnerBonusFormProps } from './PartnerBonusForm' import { Details } from './Details' -import { TAX_YEAR } from '../lib/calculation' +import { RODNE_CISLO_DLZKA, TAX_YEAR } from '../lib/calculation' export const ApplyForBonusQuestion = ({ disabled }) => ( <> @@ -167,11 +167,12 @@ export const EligiblePartnerForm = ({ label="Rodné číslo" maxLength={13} onChange={async (event) => { - const pscValue = formatRodneCislo( + const rodneCislo = formatRodneCislo( event.currentTarget.value, values.r031_rodne_cislo, ) - setFieldValue('r031_rodne_cislo', pscValue) + const shouldValidate = RODNE_CISLO_DLZKA <= rodneCislo.length + setFieldValue('r031_rodne_cislo', rodneCislo, shouldValidate) }} /> diff --git a/src/components/UrokyBonusFormSteps.tsx b/src/components/UrokyBonusFormSteps.tsx index db2bfb0e..bffa24c1 100644 --- a/src/components/UrokyBonusFormSteps.tsx +++ b/src/components/UrokyBonusFormSteps.tsx @@ -1,15 +1,14 @@ import React from 'react' -import { BooleanRadio, Checkbox, Input } from './FormComponents' -import { formatCurrency, formatRodneCislo } from '../lib/utils' -import { PartnerBonusFormProps } from './PartnerBonusForm' +import { BooleanRadio, Input } from './FormComponents' +import { formatCurrency } from '../lib/utils' import { Details } from './Details' -import { TAX_YEAR } from '../lib/calculation' import Fieldset from './fieldset/Fieldset' import RadioGroup from './radio/RadioGroup' import Radio from './radio/Radio' import RadioConditional from './radio/RadioConditional' import Decimal from 'decimal.js' import { Warning } from './Warning' +import { TAX_YEAR } from '../lib/calculation' export const ApplyForBonusQuestion = ({ disabled }) => ( <> @@ -196,46 +195,6 @@ export const PrijemQuestion = ({ disabled, values: { uroky_dalsi_dlznik, uroky_r ) } -export const ConditionsQuestion = ({ disabled }) => ( -
- -

- Spĺňa vaša manželka / manžel aspoň jednu z podmienok? -

-
- - - - - - -
-) - export const NotEligible = () => (

@@ -245,44 +204,6 @@ export const NotEligible = () => (

) -export const EligiblePartnerForm = ({ - values, - setFieldValue, -}: PartnerBonusFormProps) => ( - <> -

- Vybrané údaje o manželke / manželovi -

- - { - const pscValue = formatRodneCislo( - event.currentTarget.value, - values.r031_rodne_cislo, - ) - setFieldValue('r031_rodne_cislo', pscValue) - }} - /> - - - -) - export const PreviousButton = ({ onClick }) => (