Skip to content

Commit

Permalink
Merge branch 'master' into 803-update-to-node-20-lts-with-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekVigas authored Jul 18, 2024
2 parents 88cecfe + ea6710f commit 901bb86
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 99 deletions.
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
NEXT_PUBLIC_isLive=false
NEXT_PUBLIC_isLive=true
NEXT_PUBLIC_isPostponeLive=true
NEXT_PUBLIC_navodyBaseUrl=https://staging.navody.digital
NEXT_PUBLIC_priznanieStepUrl=/zivotne-situacie/elektronicke-podanie-danoveho-priznania-2022/krok/prihlasit-sa-na-financnu-spravu
NEXT_PUBLIC_odkladStepUrl=/zivotne-situacie/odklad-danoveho-priznania/krok/registrovat-sa-na-financnej-sprave
NEXT_PUBLIC_odkladStepUrl=/zivotne-situacie/odklad-danoveho-priznania-2023/krok/podat-odklad
RANDOM_TEST_LENGTH=20
42 changes: 35 additions & 7 deletions public/form/form.572.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/components/PartnerBonusFormSteps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
<>
Expand Down Expand Up @@ -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)
}}
/>

Expand Down
85 changes: 3 additions & 82 deletions src/components/UrokyBonusFormSteps.tsx
Original file line number Diff line number Diff line change
@@ -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 }) => (
<>
Expand Down Expand Up @@ -196,46 +195,6 @@ export const PrijemQuestion = ({ disabled, values: { uroky_dalsi_dlznik, uroky_r
)
}

export const ConditionsQuestion = ({ disabled }) => (
<div className="govuk-form-group">
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 className="govuk-fieldset__heading">
Spĺňa vaša manželka / manžel aspoň jednu z podmienok?
</h1>
</legend>
<Checkbox
name="partner_podmienky.1"
label="Staral/a sa o dieťa do 3 rokov"
disabled={disabled}
/>
<Checkbox
name="partner_podmienky.2"
label="Staral/a sa o dieťa do 6 rokov s nepriaznivým zdravotným stavom"
disabled={disabled}
/>
<Checkbox
name="partner_podmienky.3"
label="Poberá príspevok na opatrovanie ťažko zdravotne postihnutého"
disabled={disabled}
/>
<Checkbox
name="partner_podmienky.4"
label="Poberal/a príspevok na opatrovanie ťažko zdravotne postihnutého"
disabled={disabled}
/>
<Checkbox
name="partner_podmienky.5"
label="Bol/a evidovaný/á ako uchádzač o zamestnanie"
disabled={disabled}
/>
<Checkbox
name="partner_podmienky.6"
label="Považuje sa za občana so zdravotným postihnutím alebo s ťažkým zdravotným postihnutím"
disabled={disabled}
/>
</div>
)

export const NotEligible = () => (
<div data-test="ineligible-message">
<h1 className="govuk-heading-l govuk-!-margin-top-3">
Expand All @@ -245,44 +204,6 @@ export const NotEligible = () => (
</div>
)

export const EligiblePartnerForm = ({
values,
setFieldValue,
}: PartnerBonusFormProps) => (
<>
<h1 className="govuk-heading-l govuk-!-margin-top-3">
Vybrané údaje o manželke / manželovi
</h1>
<Input
name="r031_priezvisko_a_meno"
type="text"
label="Meno a priezvisko manželky / manžela"
/>
<Input
name="r031_rodne_cislo"
type="text"
label="Rodné číslo"
maxLength={13}
onChange={async (event) => {
const pscValue = formatRodneCislo(
event.currentTarget.value,
values.r031_rodne_cislo,
)
setFieldValue('r031_rodne_cislo', pscValue)
}}
/>

<Input
name="r032_partner_pocet_mesiacov"
type="number"
min={1}
max={12}
label="Počet mesiacov, v ktorých manželka / manžel spĺňal/a podmienky?"
hint="Pozor! Ak sú splnené uvedené podmienky iba jeden alebo niekoľko kalendárnych mesiacov v zdaňovacom období, môže si daňovník znížiť základ dane o nezdaniteľnú časť základu dane na manželku zodpovedajúcu 1/12 sumy nezdaniteľnej časti za každý kalendárny mesiac, na začiatku ktorého boli splnené podmienky na uplatnenie tejto nezdaniteľnej časti základu dane."
/>
</>
)

export const PreviousButton = ({ onClick }) => (
<button
className="govuk-button btn-secondary"
Expand Down
3 changes: 3 additions & 0 deletions src/lib/calculation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const VRCHNA_SADZBA_PRE_PREDDAVKY = new Decimal(16600)
const POCET_KVARTALOV = 4
const POCET_MESIACOV = 12

export const RODNE_CISLO_DLZKA = 13

// 63,4-násobok platného životného minima
const ZVYHODNENIE_NA_PARTNERA = new Decimal(14862.23)
export const TAX_YEAR = 2023
Expand Down Expand Up @@ -1076,3 +1078,4 @@ export const monthKeyValues = (months: string[]): optionWithValue[] => {
export const donateOnly3Percent = (form: TaxForm): boolean => {
return form.canDonateTwoPercentOfTax && (form.suma_2_percenta.toNumber() < MIN_2_PERCENT_CALCULATED_DONATION)
}

13 changes: 8 additions & 5 deletions src/pages/deti.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
calculate,
CHILD_RATE_EIGHTEEN_AND_OLDER,
CHILD_RATE_EIGHTEEN_AND_YOUNGER,
RODNE_CISLO_DLZKA,
MAX_CHILD_AGE_BONUS,
monthKeyValues,
monthToKeyValue,
Expand Down Expand Up @@ -217,13 +218,14 @@ const Deti: Page<ChildrenUserInput> = ({
name="r034_rodne_cislo"
type="text"
label="Rodné číslo"
maxLength={13}
maxLength={RODNE_CISLO_DLZKA}
onChange={async (event) => {
const rodneCislo = formatRodneCislo(
event.currentTarget.value,
values.r034_rodne_cislo,
)
setFieldValue('r034_rodne_cislo', rodneCislo)
const shouldValidate = rodneCislo.length >= RODNE_CISLO_DLZKA
setFieldValue('r034_rodne_cislo', rodneCislo, shouldValidate)
}}
/>

Expand Down Expand Up @@ -318,7 +320,7 @@ const getIncomeHint = (value: string): string => {
interface ChildFormProps {
index: number
savedValues: ChildInput
setFieldValue: (name: string, value: string | boolean) => void
setFieldValue: (name: string, value: string | boolean, shouldValidate?: boolean) => void
}
const ChildForm = ({ savedValues: { rodneCislo, wholeYear }, index, setFieldValue }: ChildFormProps) => {
const monthNamesFrom = monthNames.filter(month => minChildAgeBonusMonth(rodneCislo, month))
Expand Down Expand Up @@ -355,14 +357,15 @@ const ChildForm = ({ savedValues: { rodneCislo, wholeYear }, index, setFieldValu
name={`children[${index}].rodneCislo` as any}
type="text"
label="Rodné číslo"
maxLength={13}
maxLength={RODNE_CISLO_DLZKA}
width={10}
onChange={async (event) => {
const rodneCisloValue = formatRodneCislo(
event.currentTarget.value,
rodneCislo,
)
setFieldValue(`children[${index}].rodneCislo`, rodneCisloValue)
const shouldValidate = rodneCisloValue.length >= RODNE_CISLO_DLZKA
setFieldValue(`children[${index}].rodneCislo`, rodneCisloValue, shouldValidate)
}}
/>
<h3 className="govuk-heading-s">
Expand Down

0 comments on commit 901bb86

Please sign in to comment.