mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-17 05:21:07 +00:00
feat: formatting
This commit is contained in:
parent
e009b6ee80
commit
ec4fe74490
15 changed files with 127 additions and 108 deletions
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
export let applications: Array<number>;
|
||||
let title1 = $LL.components.checkbox.accountLinkCheckBox.multiple.title({
|
||||
first: applications[0],
|
||||
second: applications[1],
|
||||
second: applications[1]
|
||||
});
|
||||
let title2 = $LL.components.checkbox.accountLinkCheckBox.multiple.title2({
|
||||
first: applications[0]
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
if (applications.length === 1) {
|
||||
title1 = $LL.components.checkbox.accountLinkCheckBox.single.title({
|
||||
first: applications[0],
|
||||
first: applications[0]
|
||||
});
|
||||
title2 = $LL.components.checkbox.accountLinkCheckBox.single.title2();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -88,8 +87,8 @@ export const candidateData = writable<CandidateData>({
|
|||
schoolName: '',
|
||||
healthInsurance: '',
|
||||
grades: [],
|
||||
firstSchool: {name: '', field: ''},
|
||||
secondSchool: {name: '', field: ''},
|
||||
firstSchool: { name: '', field: '' },
|
||||
secondSchool: { name: '', field: '' },
|
||||
testLanguage: ''
|
||||
},
|
||||
parents: []
|
||||
|
|
|
|||
|
|
@ -1,74 +1,75 @@
|
|||
// 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: []
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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