mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-23 16:41:57 +00:00
Merge branch 'master' into admin_create_more_data
This commit is contained in:
commit
18621c55c0
22 changed files with 418 additions and 165 deletions
|
|
@ -67,10 +67,10 @@ pub struct CandidateDetails {
|
|||
pub name: String,
|
||||
#[validate(length(min = 1, max = 255))]
|
||||
pub surname: String,
|
||||
#[validate(length(min = 1, max = 255))]
|
||||
pub birth_surname: String,
|
||||
#[validate(length(min = 1, max = 255))]
|
||||
pub birthplace: String,
|
||||
// NaiveDate validated natively
|
||||
pub birthdate: NaiveDate,
|
||||
#[validate(length(min = 1, max = 255))]
|
||||
pub address: String,
|
||||
|
|
@ -91,6 +91,7 @@ pub struct CandidateDetails {
|
|||
pub grades: GradeList,
|
||||
pub first_school: School,
|
||||
pub second_school: School,
|
||||
#[validate(length(min = 1, max = 255))]
|
||||
pub test_language: String,
|
||||
}
|
||||
impl CandidateDetails {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"baseLocale": "cs",
|
||||
"adapter": "svelte",
|
||||
"esmImports": true,
|
||||
"outputPath": "./src/translations",
|
||||
"$schema": "https://unpkg.com/typesafe-i18n@5.20.0/schema/typesafe-i18n.json"
|
||||
}
|
||||
"baseLocale": "cs",
|
||||
"adapter": "svelte",
|
||||
"esmImports": true,
|
||||
"outputPath": "./src/translations",
|
||||
"$schema": "https://unpkg.com/typesafe-i18n@5.20.0/schema/typesafe-i18n.json"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@
|
|||
|
||||
<div class="w-full text-lg font-semibold">{$LL.components.checkbox.gdprCheckBox.title()}</div>
|
||||
<div class="w-full text-sm">{$LL.components.checkbox.gdprCheckBox.description()}</div>
|
||||
<div class="w-full text-sm"><a class="underline" href="/gdpr">{$LL.components.checkbox.gdprCheckBox.here()}</a></div>
|
||||
<div class="w-full text-sm">
|
||||
<a class="underline" href="/gdpr">{$LL.components.checkbox.gdprCheckBox.here()}</a>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
export let personalIdErr: boolean = false;
|
||||
export let personalIdNumber: string;
|
||||
let titleOk = $LL.components.checkbox.personalIdConfirmCheckBox.titleOk({
|
||||
personalId: personalIdNumber,
|
||||
personalId: personalIdNumber
|
||||
});
|
||||
let titleErr = $LL.components.checkbox.personalIdConfirmCheckBox.titleErr({
|
||||
personalId: personalIdNumber,
|
||||
personalId: personalIdNumber
|
||||
});
|
||||
|
||||
export let error: string = '';
|
||||
|
|
@ -61,7 +61,9 @@
|
|||
<div class="w-full text-lg font-semibold">
|
||||
{titleErr}
|
||||
</div>
|
||||
<div class="w-full text-sm">{$LL.components.checkbox.personalIdConfirmCheckBox.whatHappened()}</div>
|
||||
<div class="w-full text-sm">
|
||||
{$LL.components.checkbox.personalIdConfirmCheckBox.whatHappened()}
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -160,30 +160,33 @@
|
|||
<span class="font-bold">{$baseCandidateData.applications[1]}</span></span
|
||||
>
|
||||
{/if}
|
||||
<span>{$LL.input.address()}: <span class="font-bold">{$candidateData.candidate.address}</span></span>
|
||||
<span
|
||||
>{$LL.input.birthDate()}: <span class="font-bold">{$candidateData.candidate.birthdate}</span
|
||||
></span
|
||||
>{$LL.input.address()}:
|
||||
<span class="font-bold">{$candidateData.candidate.address}</span></span
|
||||
>
|
||||
<span
|
||||
>{$LL.input.birthPlace()}: <span class="font-bold">{$candidateData.candidate.birthplace}</span
|
||||
></span
|
||||
>{$LL.input.birthDate()}:
|
||||
<span class="font-bold">{$candidateData.candidate.birthdate}</span></span
|
||||
>
|
||||
<span
|
||||
>{$LL.input.personalIdentificationNumber()}: <span class="font-bold"
|
||||
>{$candidateData.candidate.personalIdNumber}</span
|
||||
></span
|
||||
>{$LL.input.birthPlace()}:
|
||||
<span class="font-bold">{$candidateData.candidate.birthplace}</span></span
|
||||
>
|
||||
<span
|
||||
>{$LL.input.schoolIzo()}: <span class="font-bold">{$candidateData.candidate.schoolName}</span
|
||||
></span
|
||||
>{$LL.input.personalIdentificationNumber()}:
|
||||
<span class="font-bold">{$candidateData.candidate.personalIdNumber}</span></span
|
||||
>
|
||||
<span
|
||||
>{$LL.input.insuranceNumber()}: <span class="font-bold"
|
||||
>{$candidateData.candidate.healthInsurance}</span
|
||||
></span
|
||||
>{$LL.input.schoolIzo()}:
|
||||
<span class="font-bold">{$candidateData.candidate.schoolName}</span></span
|
||||
>
|
||||
<span>{$LL.input.telephone()}: <span class="font-bold">{$candidateData.candidate.telephone}</span></span
|
||||
<span
|
||||
>{$LL.input.insuranceNumber()}:
|
||||
<span class="font-bold">{$candidateData.candidate.healthInsurance}</span></span
|
||||
>
|
||||
<span
|
||||
>{$LL.input.telephone()}:
|
||||
<span class="font-bold">{$candidateData.candidate.telephone}</span></span
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
|
|
@ -202,7 +205,9 @@
|
|||
>{parent.name + ' ' + parent.surname}</span
|
||||
>
|
||||
<span>{$LL.input.email()}: <span class="font-bold">{parent.email}</span></span>
|
||||
<span>{$LL.input.telephone()}: <span class="font-bold">{parent.telephone}</span></span>
|
||||
<span
|
||||
>{$LL.input.telephone()}: <span class="font-bold">{parent.telephone}</span></span
|
||||
>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@
|
|||
{#if status === 'uploaded'}
|
||||
<button
|
||||
class="mr-3 rounded-xl bg-[#ef8b46] py-0.5 px-2 text-white shadow-md transition-all duration-300 hover:bg-orange-400"
|
||||
on:click={debounce(() => dispatch('delete'), 150)}>{$LL.components.dashboard.dashboardUploadCard.delete()}</button
|
||||
on:click={debounce(() => dispatch('delete'), 150)}
|
||||
>{$LL.components.dashboard.dashboardUploadCard.delete()}</button
|
||||
>
|
||||
{/if}
|
||||
<StatusNotificationDot {status} />
|
||||
|
|
@ -133,9 +134,16 @@
|
|||
>
|
||||
<div class="hidden items-center xl:block">
|
||||
{#if bytesTotal === 0 || Math.round(progress * 100) === 100}
|
||||
<h2 class="text-xl font-bold">{status === 'submitted' ? $LL.components.dashboard.dashboardUploadCard.sent() : $LL.components.dashboard.dashboardUploadCard.uploaded()}</h2>
|
||||
<h2 class="text-xl font-bold">
|
||||
{status === 'submitted'
|
||||
? $LL.components.dashboard.dashboardUploadCard.sent()
|
||||
: $LL.components.dashboard.dashboardUploadCard.uploaded()}
|
||||
</h2>
|
||||
{:else}
|
||||
<h2 class="text-xl">{$LL.components.dashboard.dashboardUploadCard.uploaded()} {((bytesTotal / 1_000_000) * progress).toFixed(1)} MB</h2>
|
||||
<h2 class="text-xl">
|
||||
{$LL.components.dashboard.dashboardUploadCard.uploaded()}
|
||||
{((bytesTotal / 1_000_000) * progress).toFixed(1)} MB
|
||||
</h2>
|
||||
<h2 class="self-center text-xl">z {(bytesTotal / 1_000_000).toFixed(1)} MB</h2>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
}
|
||||
return grades;
|
||||
};
|
||||
|
||||
|
||||
let gradesLocal: Array<Grade> =
|
||||
grades.length > 0
|
||||
? convertGradeBackendToGrade(grades)
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@
|
|||
}
|
||||
.view {
|
||||
@apply z-10;
|
||||
@apply absolute top-0 right-0 bottom-0 m-auto md:top-auto md:bottom-auto md:left-auto md:m-0;
|
||||
@apply md:h-screen md:w-[75vw];
|
||||
@apply absolute top-0 right-0 bottom-0 left-0 m-auto md:top-auto md:bottom-auto md:left-auto md:m-0;
|
||||
@apply md:h-screen md:w-[60vw];
|
||||
@apply md:my-auto;
|
||||
@apply bg-white;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
<script lang="ts">
|
||||
export let itemLabel: string;
|
||||
export let highlighted: boolean;
|
||||
</script>
|
||||
|
||||
<li class="autocomplete-items" class:autocomplete-active={highlighted} on:click on:keydown={null}>
|
||||
{@html itemLabel}
|
||||
</li>
|
||||
|
||||
<style>
|
||||
li.autocomplete-items {
|
||||
list-style: none;
|
||||
border-bottom: 1px solid #d4d4d4;
|
||||
z-index: 99;
|
||||
/*position the autocomplete items to be the same width as the container:*/
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
li.autocomplete-items:hover {
|
||||
/*when hovering an item:*/
|
||||
background-color: #81921f;
|
||||
color: white;
|
||||
}
|
||||
|
||||
li.autocomplete-items:active {
|
||||
/*when navigating through the items using the arrow keys:*/
|
||||
background-color: DodgerBlue !important;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.autocomplete-active {
|
||||
/*when navigating through the items using the arrow keys:*/
|
||||
background-color: DodgerBlue !important;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<script lang="ts">
|
||||
import LL from '$i18n/i18n-svelte';
|
||||
|
||||
import schoollistString from '$lib/assets/schoollist.txt?raw';
|
||||
import School from './School.svelte';
|
||||
import type { School as SchoolType } from '$lib/stores/candidate';
|
||||
|
||||
const schoolList: Array<string> = schoollistString.split(';');
|
||||
|
||||
let filteredSchools: Array<string> = [];
|
||||
|
||||
const filterSchools = () => {
|
||||
let storageArr: Array<string> = [];
|
||||
if (schoolNameInputValue) {
|
||||
schoolList.forEach((school) => {
|
||||
if (school.toLowerCase().startsWith(schoolNameInputValue.toLowerCase())) {
|
||||
storageArr = [...storageArr, makeMatchBold(school)];
|
||||
}
|
||||
});
|
||||
}
|
||||
filteredSchools = storageArr;
|
||||
};
|
||||
|
||||
let searchInput: HTMLInputElement;
|
||||
let optionsList: HTMLUListElement;
|
||||
|
||||
let schoolNameInputValue = '';
|
||||
let schoolFieldInputValue = '';
|
||||
|
||||
$: if (!schoolNameInputValue) {
|
||||
filteredSchools = [];
|
||||
hiLiteIndex = -1;
|
||||
}
|
||||
|
||||
const setInputVal = (schoolName: string) => {
|
||||
schoolNameInputValue = removeBold(schoolName);
|
||||
filteredSchools = [];
|
||||
hiLiteIndex = -1;
|
||||
searchInput.focus();
|
||||
};
|
||||
|
||||
const makeMatchBold = (str: string) => {
|
||||
let matched = str.substring(0, schoolNameInputValue.length);
|
||||
let makeBold = `<strong>${matched}</strong>`;
|
||||
let boldedMatch = str.replace(matched, makeBold);
|
||||
return boldedMatch;
|
||||
};
|
||||
|
||||
const removeBold = (str: string) => {
|
||||
return str.replace(/<(.)*?>/g, '');
|
||||
};
|
||||
|
||||
let hiLiteIndex: number = 0;
|
||||
|
||||
const navigateList = (e: KeyboardEvent) => {
|
||||
if (e.key === 'ArrowDown') {
|
||||
if (hiLiteIndex < filteredSchools.length - 1) {
|
||||
hiLiteIndex++;
|
||||
// scroll optionsList
|
||||
let option = optionsList.children[hiLiteIndex];
|
||||
if (option) {
|
||||
option.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
} else if (e.key === 'ArrowUp') {
|
||||
if (hiLiteIndex > 0) {
|
||||
hiLiteIndex--;
|
||||
}
|
||||
} else if (e.key === 'Enter') {
|
||||
if (hiLiteIndex > -1) {
|
||||
setInputVal(filteredSchools[hiLiteIndex]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export let selectedSchool: SchoolType;
|
||||
export let error: string = '';
|
||||
|
||||
schoolFieldInputValue = selectedSchool.field;
|
||||
schoolNameInputValue = selectedSchool.name;
|
||||
|
||||
$: selectedSchool.field = schoolFieldInputValue;
|
||||
$: selectedSchool.name = schoolNameInputValue;
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={navigateList} />
|
||||
|
||||
<div class="autocomplete">
|
||||
<div class="flex">
|
||||
<input
|
||||
class:error
|
||||
class="flex-1"
|
||||
type="text"
|
||||
bind:this={searchInput}
|
||||
bind:value={schoolNameInputValue}
|
||||
on:input={filterSchools}
|
||||
placeholder={$LL.input.schoolName()}
|
||||
/>
|
||||
<input
|
||||
class:error
|
||||
class="ml-2 w-2/5"
|
||||
type="text"
|
||||
bind:value={schoolFieldInputValue}
|
||||
placeholder={$LL.input.fieldOfStudy()}
|
||||
/>
|
||||
</div>
|
||||
{#if filteredSchools.length > 0}
|
||||
<ul bind:this={optionsList} class="schoolAutocompleteList">
|
||||
{#each filteredSchools as country, i}
|
||||
<School
|
||||
itemLabel={country}
|
||||
highlighted={i === hiLiteIndex}
|
||||
on:click={() => setInputVal(country)}
|
||||
/>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="postcss">
|
||||
div,
|
||||
input {
|
||||
@apply w-full;
|
||||
}
|
||||
div {
|
||||
@apply relative flex items-center justify-center;
|
||||
}
|
||||
input {
|
||||
@apply hover:border-sspsBlue w-full rounded-lg border border-2 bg-[#f8fafb] p-3 text-xl shadow-lg outline-none transition-colors duration-300;
|
||||
}
|
||||
|
||||
.error {
|
||||
@apply border-red-700;
|
||||
}
|
||||
|
||||
.autocomplete {
|
||||
@apply relative;
|
||||
}
|
||||
|
||||
.schoolAutocompleteList {
|
||||
@apply absolute top-20 z-50;
|
||||
@apply w-full;
|
||||
@apply max-h-72 overflow-scroll;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
import type { GradeBackend } from '$lib/components/grades/GradesTable.svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
|
||||
export interface School {
|
||||
name: string;
|
||||
field: string;
|
||||
|
|
@ -90,8 +89,8 @@ export const candidateData = writable<CandidateData>({
|
|||
schoolName: '',
|
||||
healthInsurance: '',
|
||||
grades: [],
|
||||
firstSchool: {name: '', field: ''},
|
||||
secondSchool: {name: '', field: ''},
|
||||
firstSchool: { name: '', field: '' },
|
||||
secondSchool: { name: '', field: '' },
|
||||
testLanguage: ''
|
||||
},
|
||||
parents: []
|
||||
|
|
|
|||
|
|
@ -1,73 +1,78 @@
|
|||
// TODO: nefunguje pro lidi nar. pred 1.1.1954 :D
|
||||
export const isPersonalIdNumberValid = (personalIdNumber: string): boolean => {
|
||||
const idFmt = personalIdNumber.split('/').join('');
|
||||
const idFmt = personalIdNumber.split('/').join('');
|
||||
|
||||
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;
|
||||
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) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (lastDigitCheck && divisibleBy11) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const isPersonalIdNumberWithBirthdateValid = (
|
||||
personalIdNumber: string,
|
||||
birthdate: string
|
||||
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 dateFmt = birthdate
|
||||
.split('.')
|
||||
.map((x) => x.padStart(2, '0'))
|
||||
.reverse()
|
||||
.join('')
|
||||
.slice(2);
|
||||
const idFmt = personalIdNumber.split('/').join('');
|
||||
|
||||
const divisionValid = isPersonalIdNumberValid(personalIdNumber);
|
||||
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;
|
||||
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;
|
||||
}
|
||||
if (
|
||||
idFmt.slice(0, 2) === dateFmt.slice(0, 2) &&
|
||||
monthValid &&
|
||||
idFmt.slice(4, 6) === dateFmt.slice(4, 6) &&
|
||||
divisionValid
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const deriveBirthdateFromPersonalId = (personalIdNumber: string):
|
||||
[birthdate: string, sex: 'MUŽ' | 'ŽENA'] => {
|
||||
const year = Number(personalIdNumber.slice(0, 2));
|
||||
const idMonth = Number(personalIdNumber.slice(2, 4));
|
||||
let month;
|
||||
let sex: 'MUŽ' | 'ŽENA';
|
||||
if (idMonth > 12 && idMonth <= 32) {
|
||||
month = idMonth - 20;
|
||||
sex = 'MUŽ';
|
||||
} else if (idMonth > 50 && idMonth <= 52) {
|
||||
month = idMonth - 50;
|
||||
sex = 'ŽENA';
|
||||
} else if (idMonth > 70 && idMonth <= 82) {
|
||||
month = idMonth - 70;
|
||||
sex = 'ŽENA';
|
||||
} else {
|
||||
month = idMonth;
|
||||
sex = 'MUŽ';
|
||||
};
|
||||
const day = Number(personalIdNumber.slice(4, 6));
|
||||
export const deriveBirthdateFromPersonalId = (
|
||||
personalIdNumber: string
|
||||
): [birthdate: string, sex: 'MUŽ' | 'ŽENA'] => {
|
||||
const year = Number(personalIdNumber.slice(0, 2));
|
||||
const idMonth = Number(personalIdNumber.slice(2, 4));
|
||||
let month;
|
||||
let sex: 'MUŽ' | 'ŽENA';
|
||||
if (idMonth > 12 && idMonth <= 32) {
|
||||
month = idMonth - 20;
|
||||
sex = 'MUŽ';
|
||||
} else if (idMonth > 50 && idMonth <= 52) {
|
||||
month = idMonth - 50;
|
||||
sex = 'ŽENA';
|
||||
} else if (idMonth > 70 && idMonth <= 82) {
|
||||
month = idMonth - 70;
|
||||
sex = 'ŽENA';
|
||||
} else {
|
||||
month = idMonth;
|
||||
sex = 'MUŽ';
|
||||
}
|
||||
const day = Number(personalIdNumber.slice(4, 6));
|
||||
|
||||
const birthdate = `${day}.${month}.${year}`;
|
||||
return [birthdate, sex];
|
||||
};
|
||||
|
||||
const birthdate = `${day}.${month}.${year}`;
|
||||
return [birthdate, sex];
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ export const load: PageServerLoad = async ({ fetch, params }) => {
|
|||
schoolName: '',
|
||||
healthInsurance: '',
|
||||
grades: [],
|
||||
firstSchool: {name: '', field: ''},
|
||||
secondSchool: {name: '', field: ''},
|
||||
firstSchool: { name: '', field: '' },
|
||||
secondSchool: { name: '', field: '' },
|
||||
testLanguage: ''
|
||||
},
|
||||
parents: []
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@
|
|||
.string()
|
||||
.required()
|
||||
.matches(/^([0-3]?[0-9])\.(0?[1-9]|1[0-2])\.[0-9]{4}$/),
|
||||
birthSurname: yup.string().required(),
|
||||
sex: yup.string(),
|
||||
address: yup.string(),
|
||||
street: yup.string().required(),
|
||||
|
|
@ -136,16 +137,17 @@
|
|||
semester: yup.string().required()
|
||||
})
|
||||
.required()
|
||||
).required(),
|
||||
)
|
||||
.required(),
|
||||
firstSchool: yup.object().shape({
|
||||
name: yup.string().required(),
|
||||
field: yup.string().required(),
|
||||
field: yup.string().required()
|
||||
}),
|
||||
secondSchool: yup.object().shape({
|
||||
name: yup.string().required(),
|
||||
field: yup.string().required(),
|
||||
field: yup.string().required()
|
||||
}),
|
||||
testLanguage: yup.string().required(),
|
||||
testLanguage: yup.string().required()
|
||||
}),
|
||||
parents: yup.array().of(
|
||||
yup.object().shape({
|
||||
|
|
@ -186,7 +188,12 @@
|
|||
unknown
|
||||
>
|
||||
? {
|
||||
[K2 in keyof (typeof formInitialValues)[K]]: string;
|
||||
[K2 in keyof (typeof formInitialValues)[K]]: (typeof formInitialValues)[K][K2] extends Record<
|
||||
string,
|
||||
unknown
|
||||
>
|
||||
? { [K4 in keyof (typeof formInitialValues)[K][K2]]: string }
|
||||
: string;
|
||||
}
|
||||
: (typeof formInitialValues)[K] extends Array<Record<string, unknown>>
|
||||
? Array<{ [K3 in keyof (typeof formInitialValues)[K][number]]: string }>
|
||||
|
|
@ -276,8 +283,8 @@
|
|||
|
||||
const isPageInvalid = (index: number): boolean => {
|
||||
switch (index) {
|
||||
case 0:
|
||||
if ($typedErrors['personalIdOk'] || $typedErrors['personalIdErr']) {
|
||||
case 0:
|
||||
if ($typedErrors['personalIdOk'] || $typedErrors['personalIdErr']) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -363,7 +370,7 @@
|
|||
return '+' + telephone.match(/[0-9]{1,3}/g)!.join(' ');
|
||||
};
|
||||
|
||||
|
||||
// TODO
|
||||
/* $form.candidate.personalIdNumber = data.whoami.personalIdNumber;
|
||||
const [birthdate, sex] = deriveBirthdateFromPersonalId(data.whoami.personalIdNumber);
|
||||
$form.candidate.birthdate = birthdate;
|
||||
|
|
@ -376,6 +383,7 @@
|
|||
details.parents.map(
|
||||
(x) => (x.telephone = x.telephone != '' ? formatTelephone(x.telephone) : '')
|
||||
);
|
||||
|
||||
form.set({
|
||||
gdpr: true,
|
||||
linkOk: true,
|
||||
|
|
@ -414,16 +422,12 @@
|
|||
<SvelteToast />
|
||||
<div class="form relative bg-center">
|
||||
<div class="bottom-5/24 absolute flex w-full flex-col md:h-auto">
|
||||
<!-- TODO: Find different way how to display SchoolBadge -->
|
||||
{#if pageIndex !== 0 && pageIndex !== 7}
|
||||
<div class="<md:h-24 <md:w-24 h-32 w-32 self-center">
|
||||
<SchoolBadge />
|
||||
</div>
|
||||
{/if}
|
||||
<div class="<md:hidden self-center">
|
||||
<SchoolBadge />
|
||||
</div>
|
||||
<form on:submit={handleSubmit} id="triggerForm" class="invisible hidden" />
|
||||
{#if pageIndex === 0}
|
||||
<form on:submit={handleSubmit}>
|
||||
<h1 class="title mt-8">{$LL.candidate.register.first.title()}</h1>
|
||||
<h1 class="title mt-8">{$LL.candidate.register.first.title()}</h1>
|
||||
<p class="description mt-8 block text-center">
|
||||
{$LL.candidate.register.first.description()}
|
||||
|
|
@ -475,17 +479,18 @@
|
|||
<div class="field flex">
|
||||
<span class="w-[50%]">
|
||||
<NameField
|
||||
error={$typedErrors['candidate']['name'] || $typedErrors['candidate']['surname']}
|
||||
error={$typedErrors['candidate']['name'] ||
|
||||
$typedErrors['candidate']['surname']}
|
||||
bind:valueName={$form.candidate.name}
|
||||
bind:valueSurname={$form.candidate.surname}
|
||||
placeholder="Jméno a příjmení"
|
||||
placeholder={$LL.input.nameSurname()}
|
||||
/>
|
||||
</span>
|
||||
<span class="w-[50%] ml-2">
|
||||
<span class="ml-2 w-[50%]">
|
||||
<TextField
|
||||
error={$typedErrors['candidate']['birthSurname']}
|
||||
bind:value={$form.candidate.birthSurname}
|
||||
placeholder="Rodné příjmení (pokud odlišné)"
|
||||
placeholder={$LL.input.birthSurname()}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -494,25 +499,25 @@
|
|||
<EmailField
|
||||
error={$typedErrors['candidate']['email']}
|
||||
bind:value={$form.candidate.email}
|
||||
placeholder="E-mail"
|
||||
placeholder={$LL.input.email()}
|
||||
/>
|
||||
</span>
|
||||
<span class="w-[50%] ml-2">
|
||||
<span class="ml-2 w-[50%]">
|
||||
<TelephoneField
|
||||
error={$typedErrors['candidate']['telephone']}
|
||||
bind:value={$form.candidate.telephone}
|
||||
placeholder="Telefon"
|
||||
placeholder={$LL.input.telephone()}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<span class="field">
|
||||
<TextField
|
||||
error={$typedErrors['candidate']['city']}
|
||||
bind:value={$form.candidate.city}
|
||||
type="text"
|
||||
placeholder="Město"
|
||||
helperText="Uveďte poštovní směrovací číslo. (např. 602 00)"
|
||||
/>
|
||||
error={$typedErrors['candidate']['city']}
|
||||
bind:value={$form.candidate.city}
|
||||
type="text"
|
||||
placeholder={$LL.input.city()}
|
||||
helperText="Uveďte poštovní směrovací číslo. (např. 602 00)"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div class="field flex">
|
||||
|
|
@ -522,7 +527,7 @@
|
|||
$typedErrors['candidate']['houseNumber']}
|
||||
bind:valueName={$form.candidate.street}
|
||||
bind:valueSurname={$form.candidate.houseNumber}
|
||||
placeholder="Ulice a č. p."
|
||||
placeholder={$LL.input.address()}
|
||||
helperText="Uveďte ulici a číslo popisné (např. Preslova 72)."
|
||||
/>
|
||||
</span>
|
||||
|
|
@ -531,7 +536,7 @@
|
|||
error={$typedErrors['candidate']['zip']}
|
||||
bind:value={$form.candidate.zip}
|
||||
type="number"
|
||||
placeholder="PSČ"
|
||||
placeholder={$LL.input.zipCode()}
|
||||
helperText="Uveďte poštovní směrovací číslo. (např. 602 00)"
|
||||
/>
|
||||
</span>
|
||||
|
|
@ -541,19 +546,18 @@
|
|||
{:else if pageIndex === 4}
|
||||
<h1 class="title mt-8">{pageTexts[2]}</h1>
|
||||
<p class="description mt-8 block text-center">
|
||||
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é.
|
||||
{$LL.candidate.register.fourth.description()}
|
||||
</p>
|
||||
<div class="field flex w-full">
|
||||
<span class="w-[50%]">
|
||||
<SelectField
|
||||
error={$typedErrors['candidate']['citizenship']}
|
||||
bind:value={$form.candidate.citizenship}
|
||||
placeholder="Občanství"
|
||||
placeholder={$LL.input.citizenship()}
|
||||
options={['Česká republika', 'Slovenská republika', 'Ukrajina', 'Jiné']}
|
||||
/>
|
||||
</span>
|
||||
<span class="w-[50%] ml-2">
|
||||
<span class="ml-2 w-[50%]">
|
||||
<SelectField
|
||||
error={$typedErrors['candidate']['testLanguage']}
|
||||
bind:value={$form.candidate.testLanguage}
|
||||
|
|
@ -570,13 +574,15 @@
|
|||
placeholder={$LL.input.birthDate()}
|
||||
helperText="TODO: (Uveďte ve formátu DD.MM.RRRR)"
|
||||
/>
|
||||
<TextField
|
||||
error={$typedErrors['candidate']['birthplace']}
|
||||
bind:value={$form.candidate.birthplace}
|
||||
type="text"
|
||||
placeholder={$LL.input.birthPlace()}
|
||||
helperText="TODO: (Místo narození)"
|
||||
/>
|
||||
<div class="ml-2">
|
||||
<TextField
|
||||
error={$typedErrors['candidate']['birthplace']}
|
||||
bind:value={$form.candidate.birthplace}
|
||||
type="text"
|
||||
placeholder={$LL.input.birthPlace()}
|
||||
helperText="TODO: (Místo narození)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field flex items-center justify-center">
|
||||
{#if $form.candidate.citizenship === 'Česká republika' || !$form.candidate.citizenship}
|
||||
|
|
@ -608,14 +614,14 @@
|
|||
error={$typedErrors['candidate']['schoolName']}
|
||||
type="number"
|
||||
bind:value={$form.candidate.schoolName}
|
||||
placeholder="IZO školy"
|
||||
placeholder={$LL.input.schoolIzo()}
|
||||
/>
|
||||
{:else}
|
||||
<TextField
|
||||
error={$typedErrors['candidate']['schoolName']}
|
||||
type="text"
|
||||
bind:value={$form.candidate.schoolName}
|
||||
placeholder="Název školy"
|
||||
placeholder={$LL.input.schoolName()}
|
||||
/>
|
||||
{/if}
|
||||
</span>
|
||||
|
|
@ -625,11 +631,10 @@
|
|||
error={$typedErrors['candidate']['healthInsurance']}
|
||||
type="text"
|
||||
bind:value={$form.candidate.healthInsurance}
|
||||
placeholder="Číslo zdravotní pojišťovny"
|
||||
placeholder={$LL.input.insuranceNumber()}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{:else if pageIndex === 5}
|
||||
<h1 class="title mt-8">{pageTexts[3]}</h1>
|
||||
<p class="description mt-8 block text-center">
|
||||
|
|
@ -689,13 +694,24 @@
|
|||
</span>
|
||||
</div>
|
||||
{:else if pageIndex === 7}
|
||||
<h1 class="title mt-8">Přihlášky na školy</h1>
|
||||
<div class="flex flex-col justify-between h-full">
|
||||
<span>
|
||||
<SchoolSelect bind:selectedSchool={$form.candidate.firstSchool}></SchoolSelect>
|
||||
<h1 class="title mt-8">{pageTexts[5]}</h1>
|
||||
<p class="description my-8 block text-center">
|
||||
{$LL.candidate.register.seventh.description()}
|
||||
</p>
|
||||
<div class="flex h-full flex-col justify-between">
|
||||
<span class="field">
|
||||
<SchoolSelect
|
||||
error={$typedErrors['candidate']['firstSchool']['name'] ||
|
||||
$typedErrors['candidate']['firstSchool']['field']}
|
||||
bind:selectedSchool={$form.candidate.firstSchool}
|
||||
/>
|
||||
</span>
|
||||
<span class="mt-10 w-full">
|
||||
<SchoolSelect bind:selectedSchool={$form.candidate.secondSchool}></SchoolSelect>
|
||||
<span class="field mt-10">
|
||||
<SchoolSelect
|
||||
error={$typedErrors['candidate']['secondSchool']['name'] ||
|
||||
$typedErrors['candidate']['secondSchool']['field']}
|
||||
bind:selectedSchool={$form.candidate.secondSchool}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
{:else if pageIndex === 8}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@
|
|||
{$LL.candidate.auth.login.description()}
|
||||
</p>
|
||||
<div class="w-4/5 lg:w-3/5">
|
||||
<TextField bind:value={applicationValue} placeholder={$LL.input.evidenceNumber()} type="number" />
|
||||
<TextField
|
||||
bind:value={applicationValue}
|
||||
placeholder={$LL.input.evidenceNumber()}
|
||||
type="number"
|
||||
/>
|
||||
</div>
|
||||
<div class="mt-8 w-4/5 lg:w-3/5">
|
||||
<Submit on:click={redirectToCode} value={$LL.input.submit()} />
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import type { LayoutLoad } from './$types';
|
|||
export const load: LayoutLoad = async ({ url }) => {
|
||||
await loadAllLocalesAsync();
|
||||
setLocale('cs');
|
||||
|
||||
|
||||
return {
|
||||
url: url.pathname
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ const cs: BaseTranslation = {
|
|||
'Zde můžete zadat údaje o druhém zákonném zástupci. Škole tím umožníte lépe komunikovat.'
|
||||
},
|
||||
seventh: {
|
||||
title: 'Dokončení registrace',
|
||||
title: 'Přihlášky na školy',
|
||||
description:
|
||||
'Zadejte prosím své občanství, rodné číslo, či jeho alternativu Vaší země a obor na který se hlásíte.'
|
||||
'Zde můžete vyplnit přihlášky na školy v pořadí Vašeho výběru. V případě, že jste podali přihlášku na více škol, vyplňte přihlášky na školy v pořadí Vašeho výběru.'
|
||||
},
|
||||
eighth: {
|
||||
title: 'Poslední krok',
|
||||
|
|
@ -100,7 +100,7 @@ const cs: BaseTranslation = {
|
|||
},
|
||||
missing: {
|
||||
title: 'Soubory nebyly nahrány!',
|
||||
description: 'Nahrajte včechny soubory prosím',
|
||||
description: 'Nahrajte včechny soubory prosím'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -122,7 +122,7 @@ const cs: BaseTranslation = {
|
|||
ok: 'Vše je v pořádku',
|
||||
whatHappened: 'Co se děje?',
|
||||
titleOk: 'Potvrzuji, že moje rodné číslo je {personalId}',
|
||||
titleErr: 'Ne, moje rodné číslo není {personalId}',
|
||||
titleErr: 'Ne, moje rodné číslo není {personalId}'
|
||||
},
|
||||
gdprCheckBox: {
|
||||
title: 'Souhlasím se zpracováním osobních údajů',
|
||||
|
|
@ -134,6 +134,7 @@ const cs: BaseTranslation = {
|
|||
input: {
|
||||
optional: 'nepovinné',
|
||||
nameSurname: 'Jméno a příjmení',
|
||||
birthSurname: 'Rodné příjmení',
|
||||
email: 'E-mail',
|
||||
telephone: 'Telefon',
|
||||
address: 'Ulice a č. p.',
|
||||
|
|
@ -153,6 +154,8 @@ const cs: BaseTranslation = {
|
|||
password: 'Heslo',
|
||||
submit: 'Odeslat',
|
||||
continue: 'Pokračovat',
|
||||
fieldOfStudy: 'Obor',
|
||||
selectedSchool: 'Vybraná škola',
|
||||
parent: {
|
||||
nameSurname: 'Jméno a příjmení zákonného zástupce',
|
||||
email: 'E-mail zákonného zástupce',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import type { FormattersInitializer } from 'typesafe-i18n'
|
||||
import type { Locales, Formatters } from './i18n-types.js'
|
||||
import type { FormattersInitializer } from 'typesafe-i18n';
|
||||
import type { Locales, Formatters } from './i18n-types.js';
|
||||
|
||||
export const initFormatters: FormattersInitializer<Locales, Formatters> = (locale: Locales) => {
|
||||
|
||||
const formatters: Formatters = {
|
||||
// add your formatter functions here
|
||||
}
|
||||
};
|
||||
|
||||
return formatters
|
||||
}
|
||||
return formatters;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -129,11 +129,11 @@ type RootTranslation = {
|
|||
}
|
||||
seventh: {
|
||||
/**
|
||||
* Dokončení registrace
|
||||
* Přihlášky na školy
|
||||
*/
|
||||
title: string
|
||||
/**
|
||||
* Zadejte prosím své občanství, rodné číslo, či jeho alternativu Vaší země a obor na který se hlásíte.
|
||||
* Zde můžete vyplnit přihlášky na školy v pořadí Vašeho výběru. V případě, že jste podali přihlášku na více škol, vyplňte přihlášky na školy v pořadí Vašeho výběru.
|
||||
*/
|
||||
description: string
|
||||
}
|
||||
|
|
@ -317,6 +317,10 @@ type RootTranslation = {
|
|||
* Jméno a příjmení
|
||||
*/
|
||||
nameSurname: string
|
||||
/**
|
||||
* Rodné příjmení
|
||||
*/
|
||||
birthSurname: string
|
||||
/**
|
||||
* E-mail
|
||||
*/
|
||||
|
|
@ -393,6 +397,14 @@ type RootTranslation = {
|
|||
* Pokračovat
|
||||
*/
|
||||
'continue': string
|
||||
/**
|
||||
* Obor
|
||||
*/
|
||||
fieldOfStudy: string
|
||||
/**
|
||||
* Vybraná škola
|
||||
*/
|
||||
selectedSchool: string
|
||||
parent: {
|
||||
/**
|
||||
* Jméno a příjmení zákonného zástupce
|
||||
|
|
@ -527,11 +539,11 @@ export type TranslationFunctions = {
|
|||
}
|
||||
seventh: {
|
||||
/**
|
||||
* Dokončení registrace
|
||||
* Přihlášky na školy
|
||||
*/
|
||||
title: () => LocalizedString
|
||||
/**
|
||||
* Zadejte prosím své občanství, rodné číslo, či jeho alternativu Vaší země a obor na který se hlásíte.
|
||||
* Zde můžete vyplnit přihlášky na školy v pořadí Vašeho výběru. V případě, že jste podali přihlášku na více škol, vyplňte přihlášky na školy v pořadí Vašeho výběru.
|
||||
*/
|
||||
description: () => LocalizedString
|
||||
}
|
||||
|
|
@ -708,6 +720,10 @@ export type TranslationFunctions = {
|
|||
* Jméno a příjmení
|
||||
*/
|
||||
nameSurname: () => LocalizedString
|
||||
/**
|
||||
* Rodné příjmení
|
||||
*/
|
||||
birthSurname: () => LocalizedString
|
||||
/**
|
||||
* E-mail
|
||||
*/
|
||||
|
|
@ -784,6 +800,14 @@ export type TranslationFunctions = {
|
|||
* Pokračovat
|
||||
*/
|
||||
'continue': () => LocalizedString
|
||||
/**
|
||||
* Obor
|
||||
*/
|
||||
fieldOfStudy: () => LocalizedString
|
||||
/**
|
||||
* Vybraná škola
|
||||
*/
|
||||
selectedSchool: () => LocalizedString
|
||||
parent: {
|
||||
/**
|
||||
* Jméno a příjmení zákonného zástupce
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import adapter from '@sveltejs/adapter-node';
|
||||
import preprocess from 'svelte-preprocess';
|
||||
import path from "path";
|
||||
import path from 'path';
|
||||
import { windi } from 'svelte-windicss-preprocess';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
|
|
@ -11,9 +11,8 @@ const config = {
|
|||
kit: {
|
||||
adapter: adapter({ out: 'build' }),
|
||||
alias: {
|
||||
$i18n: path.resolve('./src/translations'),
|
||||
$i18n: path.resolve('./src/translations')
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@
|
|||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"strict": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue