From 23c577fd52f9dd524c44b6c6e015eb1e061b33f1 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 12:28:30 +0100 Subject: [PATCH 01/16] feat: edit personal details --- .../dashboard/DashboardInfoCard.svelte | 104 +++++++----- frontend/src/lib/stores/candidate.ts | 44 +++-- .../(authenticated)/register/+page.server.ts | 14 ++ .../(authenticated)/register/+page.svelte | 151 ++++++++++++------ 4 files changed, 209 insertions(+), 104 deletions(-) create mode 100644 frontend/src/routes/(candidate)/(authenticated)/register/+page.server.ts diff --git a/frontend/src/lib/components/dashboard/DashboardInfoCard.svelte b/frontend/src/lib/components/dashboard/DashboardInfoCard.svelte index e11653c..db45d0f 100644 --- a/frontend/src/lib/components/dashboard/DashboardInfoCard.svelte +++ b/frontend/src/lib/components/dashboard/DashboardInfoCard.svelte @@ -7,7 +7,8 @@ import StatusNotificationBig from './StatusNotificationBig.svelte'; import InfoButton from './InfoButton.svelte'; import { candidateData } from '$lib/stores/candidate'; - import tippy from 'tippy.js'; + import tippy, {sticky} from 'tippy.js'; + import { goto } from '$app/navigation'; export let title: string; export let status: Status; @@ -58,6 +59,10 @@ console.log(e); } }; + + const editDetails = async () => { + goto('/register?edit=true') + }
@@ -86,52 +91,65 @@
{#if showDetails} -
-
+
+
Vámi vyplněné osobní údaje', + allowHTML: true, + placement: 'top', + showOnCreate: false, + delay: 0 + }} + class="mt-4 flex flex-col justify-between leading-10" + > + Adresa: {$candidateData.candidate.address} + Datum narození: {$candidateData.candidate.birthdate} + Místo narození: {$candidateData.candidate.birthplace} + Rodné číslo: {$candidateData.candidate.personalIdNumber} + Telefon: {$candidateData.candidate.telephone} +
+
Vámi vyplněné osobní údaje', + allowHTML: true, + placement: 'top', + showOnCreate: false, + delay: 0 + }} + class="mt-4 flex flex-col leading-10" + > + {#each $candidateData.parents as parent} +
+ {parent.name + ' ' + parent.surname} + Email: {parent.email} + Telefon: {parent.telephone} +
+ {/each} +
+
+ Vámi vyplněné osobní údaje', - allowHTML: true, + content: 'Upravit osobní údaje', placement: 'top', showOnCreate: false, - delay: 0 + sticky: true, + plugins: [sticky] }} - class="mt-4 flex flex-col justify-between leading-10" - > - Adresa: {$candidateData.candidate.address} - Datum narození: {$candidateData.candidate.birthdate} - Místo narození: {$candidateData.candidate.birthplace} - Rodné číslo: {$candidateData.candidate.personalIdNumber} - Telefon: {$candidateData.candidate.telephone} -
-
Vámi vyplněné osobní údaje', - allowHTML: true, - placement: 'top', - showOnCreate: false, - delay: 0 - }} - class="mt-4 flex flex-col leading-10" - > - {#each $candidateData.parents as parent} -
- {parent.name + ' ' + parent.surname} - Email: {parent.email} - Telefon: {parent.telephone} -
- {/each} -
+ on:click={(_) => editDetails()} on:keydown={(_) => editDetails()} class="mt-4 hover:cursor-pointer"> + +
{/if} diff --git a/frontend/src/lib/stores/candidate.ts b/frontend/src/lib/stores/candidate.ts index 498098e..810afd0 100644 --- a/frontend/src/lib/stores/candidate.ts +++ b/frontend/src/lib/stores/candidate.ts @@ -2,23 +2,23 @@ import { writable } from 'svelte/store'; export interface CandidateData { candidate: { - name?: string; - surname?: string; - birthplace?: string; - birthdate?: string; - address?: string; - telephone?: string; - citizenship?: string; - email?: string; - sex?: string; - study?: string; - personalIdNumber?: string; + name: string; + surname: string; + birthplace: string; + birthdate: string; + address: string; + telephone: string; + citizenship: string; + email: string; + sex: string; + study: string; + personalIdNumber: string; }; parents: Array<{ - name?: string; - surname?: string; - telephone?: string; - email?: string; + name: string; + surname: string; + telephone: string; + email: string; }>; } @@ -44,6 +44,18 @@ export interface CreateCandidateLogin extends CreateCandidate { } export const candidateData = writable({ - candidate: {}, + candidate: { + name: '', + surname: '', + birthplace: '', + birthdate: '', + address: '', + telephone: '', + citizenship: '', + email: '', + sex: '', + study: '', + personalIdNumber: '' + }, parents: [] }); diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.server.ts b/frontend/src/routes/(candidate)/(authenticated)/register/+page.server.ts new file mode 100644 index 0000000..6e591f8 --- /dev/null +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.server.ts @@ -0,0 +1,14 @@ +import { apiFetchDetails, apiFetchSubmissionProgress } from '$lib/@api/candidate'; +import type { CandidateData } from '$lib/stores/candidate'; +import type { PageServerLoad } from './$types'; + +export const load: PageServerLoad = async ({ fetch }) => { + const details: CandidateData | undefined = await apiFetchDetails(fetch).catch((e) => { + console.error(e); + return undefined; + }); + + return { + candidate: details, + }; +}; diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index d1c9570..2a63d30 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -13,16 +13,23 @@ import NameField from '$lib/components/textfield/NameField.svelte'; import TelephoneField from '$lib/components/textfield/TelephoneField.svelte'; import TextField from '$lib/components/textfield/TextField.svelte'; - import type { CandidateData } from '$lib/stores/candidate'; + import type { PageData } from './$types'; import { createForm } from 'svelte-forms-lib'; import type { Writable } from 'svelte/store'; import * as yup from 'yup'; + import type { CandidateData } from '$lib/stores/candidate'; + import { onMount } from 'svelte'; const pageCount = 5; let pageIndex = 0; let pagesFilled = [false, false, false, false, false]; + export let data: PageData; + let details = data.candidate; + + let editMode = false; + const formInitialValues = { gdpr: false, candidate: { @@ -108,43 +115,45 @@ ) }); + const onSubmit = async (values: CandidateData) => { + console.log('page count: ' + pageIndex); + console.log(values.candidate); + console.log(values.parents); + console.log(values); + if (pageIndex === pageCount) { + // clone values to oldValues + let oldValues = JSON.parse(JSON.stringify(values)); + try { + console.log('submit'); + // @ts-ignore // love javascript + delete values.undefined; + // convert birthdate from dd.mm.yyyy to yyyy-mm-dd + let birthdate_formttted = values.candidate + .birthdate!.split('.') + .map((x) => x.padStart(2, '0')) + .reverse() + .join('-'); + + values.candidate.birthdate = birthdate_formttted; + + values.parents.filter( + (x) => x.name !== '' && x.surname !== '' && x.email !== '' && x.telephone !== '' + ); + + await apiFillDetails(values); + goto('/dashboard'); + } catch (e) { + values = oldValues; + console.error('error while submitting data: ' + e); + } + } + } + const { form, errors, handleSubmit, handleChange } = createForm({ initialValues: formInitialValues, validationSchema: formValidationSchema, - onSubmit: async (values: CandidateData) => { - console.log('page count: ' + pageIndex); - console.log(values.candidate); - console.log(values.parents); - console.log(values); - if (pageIndex === pageCount) { - // clone values to oldValues - let oldValues = JSON.parse(JSON.stringify(values)); - try { - console.log('submit'); - // @ts-ignore // love javascript - delete values.undefined; - // convert birthdate from dd.mm.yyyy to yyyy-mm-dd - let birthdate_formttted = values.candidate - .birthdate!.split('.') - .map((x) => x.padStart(2, '0')) - .reverse() - .join('-'); - - values.candidate.birthdate = birthdate_formttted; - - values.parents.filter( - (x) => x.name !== '' && x.surname !== '' && x.email !== '' && x.telephone !== '' - ); - - await apiFillDetails(values); - goto('/dashboard'); - } catch (e) { - values = oldValues; - console.error('error while submitting data: ' + e); - } - } - } + onSubmit: async (values: CandidateData) => onSubmit(values) }); type FormErrorType = { @@ -163,8 +172,8 @@ // TODO: https://github.com/tjinauyeung/svelte-forms-lib/issues/171!! (Zatím tenhle mega typ) $: typedErrors = errors as unknown as Writable; - const isPageInvalid = (): boolean => { - switch (pageIndex) { + const isPageInvalid = (index: number): boolean => { + switch (index) { case 0: if ($typedErrors['gdpr']) { return true; @@ -224,6 +233,52 @@ } return false; }; + + const formatTelephone = (telephone: string) => { + return '+' + telephone + .match(/[0-9]{1,3}/g)! + .join(' '); + } + + $: console.log($form.candidate.birthdate); + + if (details !== undefined) { + details.candidate.birthdate = details.candidate.birthdate + .split('-') + .map((x) => x.startsWith('0') ? x.slice(1) : x) + .reverse() + .join('.'); + + details.candidate.telephone = formatTelephone(details.candidate.telephone); + details.parents.map((x) => x.telephone = x.telephone != '' ? formatTelephone(x.telephone) : ''); + form.set({ + gdpr: true, + candidate: { + ...details.candidate + }, + parents: [ + { + ...details.parents[0] + }, + { + ...details.parents[1] ?? { + name: '', + surname: '', + email: '', + telephone: '' + } + } + ] + }); + pageIndex = 1; // skip gdpr page + } + + // onMount(() => { + // let evt: Event = document.createEvent('MouseEvent'); + // handleSubmit(evt); + + // }); + @@ -231,8 +286,9 @@
+
{handleSubmit(e); console.log("event" + e)}} id="triggerForm" class="invisible hidden">
{#if pageIndex === 0} -
+ {handleSubmit(e); console.log("event" + e)}}>

Váš souhlas

V rámci portálu pro přijímací řízení zpracováváme mnoho osobních údajů. Proto je nutný Váš @@ -247,7 +303,7 @@

{:else if pageIndex === 1} -
+ {handleSubmit(e); console.log("event" + e)}}>

Registrace

V rámci usnadnění přijímacího řízení jsme připravili online formulář, který vám pomůže s @@ -452,9 +508,9 @@

{ + console.log('event: ' + e); await handleSubmit(e); - console.log('clicked ' + isPageInvalid()); - if (isPageInvalid()) return; + if (isPageInvalid(pageIndex)) return; if (pageIndex === pageCount) { } else { pagesFilled[pageIndex] = true; @@ -472,19 +528,24 @@
{:else if pageIndex === 4} -

Dobrovolné!

-

- V případě, že máte druhého zákonného zástupce (např. otec a matka), můžete jej zde zadat. +

{pageTexts[4]}

+

+ Zde můžete zadat údaje o druhém zákonném zástupci. Škole tím umožníte lépe komunikovat.

@@ -435,7 +443,7 @@ on:change={handleChange} bind:valueName={$form.parents[1].name} bind:valueSurname={$form.parents[1].surname} - placeholder="Jméno a příjmení zákonného zástupce" + placeholder="Jméno a příjmení zákonného zástupce (nepovinné)" />
@@ -444,7 +452,7 @@ error={$typedErrors['parents'][1]['email']} on:change={handleChange} bind:value={$form.parents[1].email} - placeholder="E-mail zákonného zástupce" + placeholder="E-mail zákonného zástupce (nepovinné)" /> @@ -452,14 +460,14 @@ error={$typedErrors['parents'][1]['telephone']} on:change={handleChange} bind:value={$form.parents[1].telephone} - placeholder="Telefon zákonného zástupce" + placeholder="Telefon zákonného zástupce (nepovinné)" />
{:else if pageIndex === 5} -

Poslední krok

-

+

{pageTexts[5]}

+

Zadejte prosím své občanství, rodné číslo a obor na který se hlásíte.

@@ -562,4 +570,7 @@ .dotActive { @apply bg-sspsBlue; } + .description { + @apply text-gray-500 + } From d09d7dfff38cf79644b06d9ff1c8e04304c8214f Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 13:07:31 +0100 Subject: [PATCH 08/16] feat: DD.MM.YYYY birthdate format --- .../routes/(candidate)/(authenticated)/register/+page.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index c381c21..97c97f7 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -81,7 +81,7 @@ birthdate: yup .string() .required() - .matches(/^([0-3]?[0-9])\.([1-9]|1[0-2])\.[0-9]{4}$/), + .matches(/^([0-3]?[0-9])\.(0?[1-9]|1[0-2])\.[0-9]{4}$/), sex: yup.string(), address: yup.string().required(), citizenship: yup.string().required(), @@ -250,7 +250,6 @@ if (details !== undefined) { details.candidate.birthdate = details.candidate.birthdate .split('-') - .map((x) => x.startsWith('0') ? x.slice(1) : x) .reverse() .join('.'); From 6222a01e8b37f13df6b79ebb27886ba641cd7d4f Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 14:27:00 +0100 Subject: [PATCH 09/16] feat: personal id number validation --- .../(authenticated)/register/+page.svelte | 96 ++++++++++++++----- 1 file changed, 71 insertions(+), 25 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index 97c97f7..fecb87a 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -121,6 +121,70 @@ ) }); + type FormErrorType = { + [K in keyof typeof formInitialValues]: typeof formInitialValues[K] extends Record< + string, + unknown + > + ? { + [K2 in keyof typeof formInitialValues[K]]: string; + } + : typeof formInitialValues[K] extends Array> + ? Array<{ [K3 in keyof typeof formInitialValues[K][number]]: string }> + : string; + }; + + // TODO: https://github.com/tjinauyeung/svelte-forms-lib/issues/171!! (Zatím tenhle mega typ) + $: typedErrors = errors as unknown as Writable; + + // TODO: validate on admin dashboard, move somewhere + // TODO: nefunguje pro lidi nar. pred 1.1.1954 :D + const isPersonalIdNumberValid = (personalIdNumber: string): boolean => { + const idFmt = personalIdNumber + .split('/') + .join(''); + + const lastDigitCheck = Number(idFmt.slice(0, 9)) % 11 === Number(idFmt.at(-1)) || Number(idFmt.at(-1)) === 10; + const divisibleBy11 = Number(idFmt) % 11 === 0; + + if (lastDigitCheck && divisibleBy11) { + return true; + } else { + return false; + } + } + + const isPersonalIdNumberWithBirthdateValid = (personalIdNumber: string, birthdate: string): boolean => { + const dateFmt = birthdate + .split('.') + .map((x) => x.padStart(2, '0')) + .reverse() + .join('') + .slice(2); + const idFmt = personalIdNumber + .split('/') + .join(''); + + const divisionValid = isPersonalIdNumberValid(personalIdNumber); + + const idMonth = Number(idFmt.slice(2, 4)); + const dateMonth = Number(dateFmt.slice(2, 4)); + const monthValid = idMonth === dateMonth || idMonth === dateMonth + 50 || + idMonth === dateMonth + 20 || idMonth === dateMonth + 70; + + if ( + idFmt.slice(0, 2) === dateFmt.slice(0, 2) && + monthValid && + idFmt.slice(4, 6) === dateFmt.slice(4, 6) && + divisionValid + ) { + return true; + } else { + return false; + } + + }; + const onSubmit = async (values: CandidateData) => { console.log('page count: ' + pageIndex); console.log(values.candidate); @@ -130,7 +194,12 @@ // clone values to oldValues let oldValues = JSON.parse(JSON.stringify(values)); try { - console.log('submit'); + if (values.candidate.citizenship === 'Česká republika') { + if (!isPersonalIdNumberWithBirthdateValid(values.candidate.personalIdNumber, values.candidate.birthdate)) { + alert('Rodné číslo neodpovídá oficiální specifikaci či datumu narození'); // TODO: alerts + throw new Error('Rodné číslo neodpovídá datumu narození'); + } + } // @ts-ignore // love javascript delete values.undefined; // convert birthdate from dd.mm.yyyy to yyyy-mm-dd @@ -146,6 +215,7 @@ (x) => x.name !== '' && x.surname !== '' && x.email !== '' && x.telephone !== '' ); + await apiFillDetails(values); goto('/dashboard'); } catch (e) { @@ -162,22 +232,6 @@ onSubmit: async (values: CandidateData) => onSubmit(values) }); - type FormErrorType = { - [K in keyof typeof formInitialValues]: typeof formInitialValues[K] extends Record< - string, - unknown - > - ? { - [K2 in keyof typeof formInitialValues[K]]: string; - } - : typeof formInitialValues[K] extends Array> - ? Array<{ [K3 in keyof typeof formInitialValues[K][number]]: string }> - : string; - }; - - // TODO: https://github.com/tjinauyeung/svelte-forms-lib/issues/171!! (Zatím tenhle mega typ) - $: typedErrors = errors as unknown as Writable; - const isPageInvalid = (index: number): boolean => { switch (index) { case 0: @@ -244,8 +298,6 @@ .match(/[0-9]{1,3}/g)! .join(' '); } - - $: console.log($form.candidate.birthdate); if (details !== undefined) { details.candidate.birthdate = details.candidate.birthdate @@ -278,12 +330,6 @@ pageTexts[1] = 'Úprava osobních údajů' } - // onMount(() => { - // let evt: Event = document.createEvent('MouseEvent'); - // handleSubmit(evt); - - // }); - From 990a5ac2851f7d811e52f0443dc56165bd1420c6 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 18:13:03 +0100 Subject: [PATCH 10/16] feat: title class, center text --- .../(authenticated)/register/+page.svelte | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index fecb87a..23f951a 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -340,7 +340,7 @@
{handleSubmit(e); console.log("event" + e)}} id="triggerForm" class="invisible hidden">
{#if pageIndex === 0}
{handleSubmit(e); console.log("event" + e)}}> -

{pageTexts[0]}

+

{pageTexts[0]}

V rámci portálu pro přijímací řízení zpracováváme mnoho osobních údajů. Proto je nutný Váš souhlas s jejich zpracováním. O bezpečnosti zpracování Vašich osobních údajů si můžete přečíst @@ -356,7 +356,7 @@

{:else if pageIndex === 1}
{handleSubmit(e); console.log("event" + e)}}> -

{pageTexts[1]}

+

{pageTexts[1]}

V rámci usnadnění přijímacího řízení jsme připravili online formulář, který Vám pomůže s vyplněním potřebných údajů. @@ -390,7 +390,7 @@

{:else if pageIndex === 2} -

{pageTexts[2]}

+

{pageTexts[2]}

Pro registraci je potřeba vyplnit několik údajů o Vás. Tyto údaje budou použity pro přijímací řízení. Všechny údaje jsou důležité a bez nich se registrace nezdaří. @@ -443,7 +443,7 @@ {:else if pageIndex === 3} -

{pageTexts[3]}

+

{pageTexts[3]}

Sběr dat o zákonném zástupci je klíčový pro získání důležitých kontaktů a informací.

@@ -477,7 +477,7 @@ {:else if pageIndex === 4} -

{pageTexts[4]}

+

{pageTexts[4]}

Zde můžete zadat údaje o druhém zákonném zástupci. Škole tím umožníte lépe komunikovat.

@@ -618,4 +618,7 @@ .description { @apply text-gray-500 } + .title { + @apply text-sspsBlue text-4xl font-semibold text-center; + } From bd8b1d2feecdd7697d883355adbdcb45d361f270 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 18:23:36 +0100 Subject: [PATCH 11/16] refactor: code cleanup --- .../(candidate)/(authenticated)/register/+page.svelte | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index 23f951a..39259f9 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -186,10 +186,6 @@ }; const onSubmit = async (values: CandidateData) => { - console.log('page count: ' + pageIndex); - console.log(values.candidate); - console.log(values.parents); - console.log(values); if (pageIndex === pageCount) { // clone values to oldValues let oldValues = JSON.parse(JSON.stringify(values)); @@ -337,9 +333,9 @@
-
{handleSubmit(e); console.log("event" + e)}} id="triggerForm" class="invisible hidden">
+ {#if pageIndex === 0} -
{handleSubmit(e); console.log("event" + e)}}> +

{pageTexts[0]}

V rámci portálu pro přijímací řízení zpracováváme mnoho osobních údajů. Proto je nutný Váš @@ -355,7 +351,7 @@

{:else if pageIndex === 1} -
{handleSubmit(e); console.log("event" + e)}}> +

{pageTexts[1]}

V rámci usnadnění přijímacího řízení jsme připravili online formulář, který Vám pomůže s @@ -560,7 +556,6 @@

{ - console.log('event: ' + e); await handleSubmit(e); if (isPageInvalid(pageIndex)) return; if (pageIndex === pageCount) { From 83d4b08437a83d1547a8062a405cadb8abe038ee Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 18:49:42 +0100 Subject: [PATCH 12/16] fix: first 9 digits mod 11 edge case --- .../routes/(candidate)/(authenticated)/register/+page.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index 39259f9..b9a8a22 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -144,7 +144,8 @@ .split('/') .join(''); - const lastDigitCheck = Number(idFmt.slice(0, 9)) % 11 === Number(idFmt.at(-1)) || Number(idFmt.at(-1)) === 10; + const lastDigitCheck = Number(idFmt.slice(0, 9)) % 11 === Number(idFmt.at(-1)) || + Number(idFmt.slice(0, 9)) % 11 === 10; // an edge case that could occur const divisibleBy11 = Number(idFmt) % 11 === 0; if (lastDigitCheck && divisibleBy11) { From 326aef54836f55c614235d8713049bc79cc9f844 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 19:56:08 +0100 Subject: [PATCH 13/16] feat: stable dot navigation & continue button --- .../(authenticated)/register/+page.svelte | 105 +++++++++--------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index b9a8a22..14b9cdf 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -330,10 +330,11 @@ -
-
- -
+
+
+
+ +
{#if pageIndex === 0}
@@ -444,35 +445,35 @@

Sběr dat o zákonném zástupci je klíčový pro získání důležitých kontaktů a informací.

-
- - + + - -
- - + +
+ + - - - + + + - -
+ /> +
+
{:else if pageIndex === 4}

{pageTexts[4]}

@@ -508,7 +509,7 @@

{:else if pageIndex === 5} -

{pageTexts[5]}

+

{pageTexts[5]}

Zadejte prosím své občanství, rodné číslo a obor na který se hlásíte.

@@ -553,41 +554,43 @@
{/if} - -
- { - await handleSubmit(e); - if (isPageInvalid(pageIndex)) return; - if (pageIndex === pageCount) { - } else { - pagesFilled[pageIndex] = true; - pageIndex++; - } - // @ts-ignore - errors.set(formInitialValues); - }} - value={pageIndex === pageCount ? 'Odeslat' : 'Pokračovat'} - />
- -
- {#each Array(pageCount + 1) as _, i} -
From 54752a50d30fa5ab517a6e85e807da12648a2aff Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 21:26:24 +0100 Subject: [PATCH 14/16] fix: parent's email, telephone validation --- .../(candidate)/(authenticated)/register/+page.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte index 14b9cdf..5cb205e 100644 --- a/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte +++ b/frontend/src/routes/(candidate)/(authenticated)/register/+page.svelte @@ -71,7 +71,7 @@ gdpr: yup.boolean().oneOf([true]), candidate: yup.object().shape({ name: yup.string().required(), - surname: yup.string(), + surname: yup.string().required(), email: yup.string().email().required(), telephone: yup .string() @@ -106,13 +106,13 @@ .string() .email() .test((_val, context) => { - if (context.path.includes('parents[1]')) { + if (context.path.includes('parents[1]') && _val === '') { return true; } return _val !== ''; }), telephone: yup.string().test((_val, context) => { - if (context.path.includes('parents[1]')) { + if (context.path.includes('parents[1]') && _val === '') { return true; } return _val?.match(/^\+\d{1,3} \d{3} \d{3} \d{3}$/) !== null; From 4f64117dddca715880a2064336635ef54a113f79 Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Sun, 25 Dec 2022 23:08:43 +0100 Subject: [PATCH 15/16] feat: phone optimizations --- .../lib/components/layout/SplitLayout.svelte | 4 +- .../(authenticated)/register/+page.svelte | 92 +++++++++---------- .../login/[code=application]/+page.svelte | 2 +- 3 files changed, 47 insertions(+), 51 deletions(-) diff --git a/frontend/src/lib/components/layout/SplitLayout.svelte b/frontend/src/lib/components/layout/SplitLayout.svelte index 4a4d9aa..8251601 100644 --- a/frontend/src/lib/components/layout/SplitLayout.svelte +++ b/frontend/src/lib/components/layout/SplitLayout.svelte @@ -28,11 +28,11 @@