diff --git a/frontend/src/lib/components/textfield/TextField.svelte b/frontend/src/lib/components/textfield/TextField.svelte index 86d21cc..cca1313 100644 --- a/frontend/src/lib/components/textfield/TextField.svelte +++ b/frontend/src/lib/components/textfield/TextField.svelte @@ -24,7 +24,8 @@ content: helperText, placement: 'top', showOnCreate: false, - delay: tooltipDelay + delay: tooltipDelay, + allowHTML: true, }} > { if ($form.candidate.citizenship !== 'Česká republika') return true; if (!_val) return false; - if (isPersonalIdMatchingBirthdate( - data.whoami.personalIdNumber, - _val - )) { + if (isPersonalIdMatchingBirthdate(data.whoami.personalIdNumber, _val)) { return true; } else { - pushErrorText("Datum narození a rodné číslo se neshodují.") + pushErrorText('Datum narození a rodné číslo se neshodují.'); return false; } }), @@ -151,6 +148,7 @@ .matches(/^[0-9]+(\/[0-9]+)?$/), city: yup.string().required(), zip: yup.string().required(), + letterAddress: yup.string(), citizenship: yup.string().required(), personalIdNumber: yup.string(), schoolName: yup.string().required(), @@ -346,7 +344,8 @@ $typedErrors['candidate']['city'] || $typedErrors['candidate']['street'] || $typedErrors['candidate']['houseNumber'] || - $typedErrors['candidate']['zip'] + $typedErrors['candidate']['zip'] || + $typedErrors['candidate']['letterAddress'] ) { return true; } @@ -410,24 +409,6 @@ return '+' + telephone.match(/[0-9]{1,3}/g)!.join(' '); }; - let lastCitizenshipSelected = $form.candidate.citizenship; - $: if ($form.candidate.citizenship !== lastCitizenshipSelected) { - lastCitizenshipSelected = $form.candidate.citizenship; - $form.candidate.birthdate = ''; - $form.candidate.sex = ''; - - if ($form.candidate.citizenship === 'Česká republika') { - let [birthdate, sex] = parseBirthdateSexFromPersonalId(data.whoami.personalIdNumber); - $form.candidate.birthdate = birthdate; - $form.candidate.sex = sex; - if (pageIndex === 4) { - pushSuccessText( - `Datum narození a pohlaví bylo vyplněno automaticky podle Vašeho rodného čísla (${data.whoami.personalIdNumber}).` - ); - } - } - } - if (details !== undefined) { details.candidate.birthdate = details.candidate.birthdate.split('-').reverse().join('.'); @@ -468,6 +449,25 @@ pageIndex = editModePageIndex; // skip gdpr page pageTexts[2] = $LL.candidate.register.fourth.titleEdit(); } + + let lastCitizenshipSelected = $form.candidate.citizenship; + $: if ($form.candidate.citizenship !== lastCitizenshipSelected) { + console.log('citizenship changed'); + lastCitizenshipSelected = $form.candidate.citizenship; + $form.candidate.birthdate = ''; + $form.candidate.sex = ''; + + if ($form.candidate.citizenship === 'Česká republika') { + let [birthdate, sex] = parseBirthdateSexFromPersonalId(data.whoami.personalIdNumber); + $form.candidate.birthdate = birthdate; + $form.candidate.sex = sex; + if (pageIndex === 4) { + pushSuccessText( + `Datum narození a pohlaví bylo vyplněno automaticky podle Vašeho rodného čísla (${data.whoami.personalIdNumber}).` + ); + } + } + } @@ -485,9 +485,11 @@ {/if}
-
- -
+ {#if pageIndex !== 3} +
+ +
+ {/if}
+
+ + + +
{:else if pageIndex === 4}