Skip to content

Commit

Permalink
Merge branch 'master' into iban-simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekVigas authored Apr 27, 2024
2 parents 90fe2f3 + eb923da commit 3704c18
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 8,329 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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
"iban": "0.0.14",
"js-file-download": "0.4.12",
"lodash.clonedeep": "4.5.0",
"navody-digital-frontend": "^0.1.9",
"next": "^13.5.0",
"nookies": "2.5.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rodnecislo": "1.6.0",
"sass": "^1.75.0",
"webpack": "^5.76.0",
"xml-js": "1.6.11",
"yup": "0.32.11"
Expand Down
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 @@ -1077,3 +1079,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)
}

2 changes: 1 addition & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import App, { AppProps } from 'next/app'

/* eslint-disable import/no-unassigned-import */
import '../styles/global.css'
import '../styles/navody-digital-0.1.8.min.css'
import 'navody-digital-frontend/govuk/all.scss'
import '../styles/libs.css'
/* eslint-enable import/no-unassigned-import */

Expand Down
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
11 changes: 7 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const TaxFormSection = ({ nextRoute, isDebug, isLive }) => {
<ExternalLink href="https://kros.sk/danove-priznania/">
Pre nami nepodporované scenáre, odporúčame použiť aplikáciu KROS
</ExternalLink>
</li>
</li>
</ul>
</>
</Warning>
Expand All @@ -133,6 +133,9 @@ const TaxFormSection = ({ nextRoute, isDebug, isLive }) => {
className="govuk-button govuk-button--large govuk-button--start govuk-!-margin-bottom-3"
>
Súhlasím a chcem pripraviť daňové priznanie
<svg className="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
</svg>
</button>
</Link>
)}
Expand All @@ -159,7 +162,7 @@ const PostponeSection = ({ nextPostponeRoute, now, isPostponeLive, isDebug }) =>
<h2 className="govuk-heading-m govuk-!-margin-top-3">
{`Odklad daňového priznania za rok ${TAX_YEAR}`}
</h2>
<PostponeText now={now}/>
<PostponeText now={now} />
<ul className="govuk-list govuk-list--bullet">
<li>{`do 30.6.${TAX_YEAR + 1} ak ste mali príjmy len zo Slovenska, alebo`}</li>
<li>{`do 30.9.${TAX_YEAR + 1} ak ste mali príjmy aj zo zahraničia`}</li>
Expand All @@ -180,9 +183,9 @@ const PostponeSection = ({ nextPostponeRoute, now, isPostponeLive, isDebug }) =>
</>
)

const PostponeText = ({ now }: { now: Date}) => (
const PostponeText = ({ now }: { now: Date }) => (
<>
{((now.getMonth() > 2) && (now.getFullYear() == TAX_YEAR+1)) && (
{((now.getMonth() > 2) && (now.getFullYear() == TAX_YEAR + 1)) && (
<>
<p>
{`Riadny termín pre podanie daňového priznania a zaplatenie dane bol do
Expand Down
Loading

0 comments on commit 3704c18

Please sign in to comment.