mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-08 04:20:46 +00:00
feat: schoolist splits only once
This commit is contained in:
parent
9932ce87b7
commit
3a9b479934
2 changed files with 6 additions and 4 deletions
|
|
@ -1,11 +1,10 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import LL from '$i18n/i18n-svelte';
|
import LL from '$i18n/i18n-svelte';
|
||||||
|
|
||||||
import schoollistString from '$lib/assets/schoollist.txt?raw';
|
|
||||||
import School from './School.svelte';
|
import School from './School.svelte';
|
||||||
import type { School as SchoolType } from '$lib/stores/candidate';
|
import type { School as SchoolType } from '$lib/stores/candidate';
|
||||||
|
|
||||||
const schoolList: Array<string> = schoollistString.split(';');
|
export let schoolList: Array<string>;
|
||||||
|
|
||||||
let filteredSchools: Array<string> = [];
|
let filteredSchools: Array<string> = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
let pagesFilled = [false, false, false, false, false, false, false, false];
|
let pagesFilled = [false, false, false, false, false, false, false, false];
|
||||||
const editModePageIndex = 3;
|
const editModePageIndex = 3;
|
||||||
const pageCount = pagesFilled.length;
|
const pageCount = pagesFilled.length;
|
||||||
|
const schoolList: Array<string> = schoollistString.split(';');
|
||||||
|
|
||||||
let pageTexts = [
|
let pageTexts = [
|
||||||
$LL.candidate.register.second.title(),
|
$LL.candidate.register.second.title(),
|
||||||
|
|
@ -152,7 +153,7 @@
|
||||||
.required()
|
.required()
|
||||||
.test((_val) => {
|
.test((_val) => {
|
||||||
if (!_val) return false;
|
if (!_val) return false;
|
||||||
return schoollistString.split(';').includes(_val);
|
return schoolList.includes(_val);
|
||||||
}),
|
}),
|
||||||
field: yup.string().required()
|
field: yup.string().required()
|
||||||
}),
|
}),
|
||||||
|
|
@ -162,7 +163,7 @@
|
||||||
.required()
|
.required()
|
||||||
.test((_val) => {
|
.test((_val) => {
|
||||||
if (!_val) return false;
|
if (!_val) return false;
|
||||||
return schoollistString.split(';').includes(_val);
|
return schoolList.includes(_val);
|
||||||
}),
|
}),
|
||||||
field: yup.string().required()
|
field: yup.string().required()
|
||||||
}),
|
}),
|
||||||
|
|
@ -745,6 +746,7 @@
|
||||||
První škola - termín JPZ: <span class="underline">13. 4. 2023</span>
|
První škola - termín JPZ: <span class="underline">13. 4. 2023</span>
|
||||||
</h2>
|
</h2>
|
||||||
<SchoolSelect
|
<SchoolSelect
|
||||||
|
schoolList={schoolList}
|
||||||
error={$typedErrors['candidate']['firstSchool']['name'] ||
|
error={$typedErrors['candidate']['firstSchool']['name'] ||
|
||||||
$typedErrors['candidate']['firstSchool']['field']}
|
$typedErrors['candidate']['firstSchool']['field']}
|
||||||
bind:selectedSchool={$form.candidate.firstSchool}
|
bind:selectedSchool={$form.candidate.firstSchool}
|
||||||
|
|
@ -768,6 +770,7 @@
|
||||||
Druhá škola - termín JPZ: <span class="underline">14. 4. 2023</span>
|
Druhá škola - termín JPZ: <span class="underline">14. 4. 2023</span>
|
||||||
</h2>
|
</h2>
|
||||||
<SchoolSelect
|
<SchoolSelect
|
||||||
|
schoolList={schoolList}
|
||||||
error={$typedErrors['candidate']['secondSchool']['name'] ||
|
error={$typedErrors['candidate']['secondSchool']['name'] ||
|
||||||
$typedErrors['candidate']['secondSchool']['field']}
|
$typedErrors['candidate']['secondSchool']['field']}
|
||||||
bind:selectedSchool={$form.candidate.secondSchool}
|
bind:selectedSchool={$form.candidate.secondSchool}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue