diff --git a/frontend/src/lib/components/textfield/AddressField.svelte b/frontend/src/lib/components/textfield/AddressField.svelte new file mode 100644 index 0000000..555ac30 --- /dev/null +++ b/frontend/src/lib/components/textfield/AddressField.svelte @@ -0,0 +1,46 @@ + + + + + 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(), @@ -307,7 +305,7 @@ } catch (e) { values = oldValues; $form = oldValues; - console.error('error while submitting data: ' + e); + pushErrorText('Neznámá chyba při odesílání dat.'); } } }; @@ -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('.'); @@ -436,6 +417,8 @@ (x) => (x.telephone = x.telephone != '' ? formatTelephone(x.telephone) : '') ); + const addressArray = details.candidate.address.split(','); + const streetHouseNumber = addressArray[0].split(' '); form.set({ gdpr: true, linkOk: true, @@ -444,8 +427,8 @@ personalIdErr: false, candidate: { ...details.candidate, - street: details.candidate.address.split(',')[0].split(' ')[0], - houseNumber: details.candidate.address.split(',')[0].split(' ')[1], + street: streetHouseNumber.slice(0, streetHouseNumber.length - 1).join(' ').trim(), + houseNumber: streetHouseNumber[streetHouseNumber.length - 1], city: details.candidate.address.split(',')[1], zip: details.candidate.address.split(',')[2], // @ts-ignore @@ -468,6 +451,24 @@ pageIndex = editModePageIndex; // skip gdpr page pageTexts[2] = $LL.candidate.register.fourth.titleEdit(); } + + 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}).` + ); + } + } + } @@ -485,9 +486,11 @@ {/if}
-
- -
+ {#if pageIndex !== 3} +
+ +
+ {/if}
- @@ -595,6 +598,17 @@ />
+
+ + + +
{:else if pageIndex === 4} diff --git a/frontend/src/translations/cs/index.ts b/frontend/src/translations/cs/index.ts index fc140a6..0ee328c 100644 --- a/frontend/src/translations/cs/index.ts +++ b/frontend/src/translations/cs/index.ts @@ -115,7 +115,7 @@ const cs: BaseTranslation = { }, single: { title: 'Ano, přihlášku na SSPŠaG jsem podával/a jen jednu ({first:number})', - title2: 'Ne, přihlášku na SSPŠaG jsem podával více přihlášek' + title2: 'Ne, na SSPŠaG jsem podával více přihlášek' } }, personalIdConfirmCheckBox: {