fix: formatting

This commit is contained in:
EETagent 2022-12-04 00:30:43 +01:00
parent 5f431fb92a
commit 23fab618db
23 changed files with 280 additions and 279 deletions

View file

@ -1,21 +1,18 @@
import { API_URL } from '$lib/@api'; import { API_URL } from '$lib/@api';
import type { HandleFetch } from '@sveltejs/kit'; import type { HandleFetch } from '@sveltejs/kit';
export const handleFetch: HandleFetch = async ({ request, fetch, event,}) => { export const handleFetch: HandleFetch = async ({ request, fetch, event }) => {
console.log(`SSR: handleFetch() BEFORE: ${request.method} ${request.url}`); console.log(`SSR: handleFetch() BEFORE: ${request.method} ${request.url}`);
const cookie = event.request.headers.get('cookie') || ''; const cookie = event.request.headers.get('cookie') || '';
console.log(`SSR: handleFetch() cookie: ${cookie}`); console.log(`SSR: handleFetch() cookie: ${cookie}`);
request.headers.set('cookie', cookie);
request = new Request( request.headers.set('cookie', cookie);
request.url.replace(API_URL, 'http://127.0.0.1:8000'),
request
);
console.log(`SSR: handleFetch() AFTER: ${request.method} ${request.url}`); request = new Request(request.url.replace(API_URL, 'http://127.0.0.1:8000'), request);
console.log(`SSR: handleFetch() AFTER: ${request.method} ${request.url}`);
return fetch(request); return fetch(request);
}; };

View file

@ -1,14 +1,14 @@
import type { AxiosError } from "axios"; import type { AxiosError } from 'axios';
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response> export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
export const API_URL = "http://localhost:8000"; export const API_URL = 'http://localhost:8000';
export interface ApiError { export interface ApiError {
error: AxiosError, error: AxiosError;
msg: string, msg: string;
} }
export function errorHandler(error: AxiosError, msg: string): ApiError { export function errorHandler(error: AxiosError, msg: string): ApiError {
return {error, msg} return { error, msg };
} }

View file

@ -25,14 +25,14 @@
</svg> </svg>
<style> <style>
svg { svg {
@apply w-12 h-12; @apply w-12 h-12;
} }
.blue { .blue {
@apply stroke-sspsBlue fill-sspsBlue; @apply stroke-sspsBlue fill-sspsBlue;
@apply transition-colors duration-300 hover:fill-sspsBlueDark hover:stroke-sspsBlueDark; @apply transition-colors duration-300 hover:fill-sspsBlueDark hover:stroke-sspsBlueDark;
} }
.white { .white {
@apply stroke-white fill-white; @apply stroke-white fill-white;
} }
</style> </style>

View file

@ -1,23 +1,20 @@
<script lang="ts"> <script lang="ts">
import { fetchSubmProgress } from "$lib/stores/portfolio"; import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadCoverLetter } from "$lib/@api/candidate"; import { apiUploadCoverLetter } from '$lib/@api/candidate';
import DashboardUploadCard from "./DashboardUploadCard.svelte"; import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => {
const file = detail.file;
const callback = detail.callback;
await apiUploadCoverLetter(file, callback);
await fetchSubmProgress();
}
const onFileDrop = async (detail: any) => {
const file = detail.file;
const callback = detail.callback;
await apiUploadCoverLetter(file, callback);
await fetchSubmProgress();
};
</script> </script>
<DashboardUploadCard
<DashboardUploadCard on:filedrop={(e) => onFileDrop(e.detail)}
on:filedrop={e => onFileDrop(e.detail)} title="Motivační dopis"
title="Motivační dopis" filetype="PDF"
filetype="PDF" filesize={10}
filesize={10} fileType={1}
fileType={1} />
>
</DashboardUploadCard>

View file

@ -16,7 +16,7 @@
@apply bg-white rounded-xl shadow-md; @apply bg-white rounded-xl shadow-md;
@apply hover:bg-sspsBlue; @apply hover:bg-sspsBlue;
@apply hover:cursor-pointer; @apply hover:cursor-pointer;
} }
div, div,

View file

@ -1,22 +1,20 @@
<script lang="ts"> <script lang="ts">
import { fetchSubmProgress } from "$lib/stores/portfolio"; import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadPortfolioLetter } from "../../@api/candidate"; import { apiUploadPortfolioLetter } from '../../@api/candidate';
import DashboardUploadCard from "./DashboardUploadCard.svelte"; import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => {
const file = detail.file;
const callback = detail.callback;
await apiUploadPortfolioLetter(file, callback);
await fetchSubmProgress();
}
const onFileDrop = async (detail: any) => {
const file = detail.file;
const callback = detail.callback;
await apiUploadPortfolioLetter(file, callback);
await fetchSubmProgress();
};
</script> </script>
<DashboardUploadCard <DashboardUploadCard
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={(e) => onFileDrop(e.detail)}
title="Portfolio" title="Portfolio"
filetype="PDF" filetype="PDF"
filesize={10} filesize={10}
fileType={2}> fileType={2}
</DashboardUploadCard> />

View file

@ -1,22 +1,20 @@
<script lang="ts"> <script lang="ts">
import { fetchSubmProgress } from "$lib/stores/portfolio"; import { fetchSubmProgress } from '$lib/stores/portfolio';
import { apiUploadPortfolioZip } from "$lib/@api/candidate"; import { apiUploadPortfolioZip } from '$lib/@api/candidate';
import DashboardUploadCard from "./DashboardUploadCard.svelte"; import DashboardUploadCard from './DashboardUploadCard.svelte';
const onFileDrop = async (detail: any) => {
const file = detail.file;
const callback = detail.callback;
await apiUploadPortfolioZip(file, callback);
await fetchSubmProgress();
}
const onFileDrop = async (detail: any) => {
const file = detail.file;
const callback = detail.callback;
await apiUploadPortfolioZip(file, callback);
await fetchSubmProgress();
};
</script> </script>
<DashboardUploadCard <DashboardUploadCard
on:filedrop={e => onFileDrop(e.detail)} on:filedrop={(e) => onFileDrop(e.detail)}
title="Další data" title="Další data"
filetype="ZIP" filetype="ZIP"
filesize={100} filesize={100}
fileType={3}> fileType={3}
</DashboardUploadCard> />

View file

@ -1,22 +1,39 @@
<script lang="ts"> <script lang="ts">
export let progress: number; export let progress: number;
</script> </script>
<div class="progress-bar"> <div class="progress-bar">
<svg class="animated animate-ease-linear" <svg
width="40mm" class="animated animate-ease-linear"
height="8mm" width="40mm"
viewBox="0 0 50 6" height="8mm"
version="1.1" viewBox="0 0 50 6"
xmlns="http://www.w3.org/2000/svg"> version="1.1"
xmlns="http://www.w3.org/2000/svg"
>
<line x1="5" y1="3" x2="45" y2="3" stroke="#e6e6e6" stroke-width="6" stroke-linecap="round" />
<line x1="5" y1="3" x2="45" y2="3" stroke="#e6e6e6" stroke-width="6" stroke-linecap="round" /> {#if progress === 1}
<line
{#if progress === 1} x1="5"
<line x1="5" y1="3" x2={progress * 45} y2="3" stroke="#35e000ff" stroke-width="3" stroke-linecap="round" /> y1="3"
{:else} x2={progress * 45}
<line x1="5" y1="3" x2={progress * 45} y2="3" stroke="#75bff8ff" stroke-width="3" stroke-linecap="round" /> y2="3"
{/if} stroke="#35e000ff"
> stroke-width="3"
</svg> stroke-linecap="round"
</div> />
{:else}
<line
x1="5"
y1="3"
x2={progress * 45}
y2="3"
stroke="#75bff8ff"
stroke-width="3"
stroke-linecap="round"
/>
{/if}
>
</svg>
</div>

View file

@ -1,42 +1,41 @@
<script lang="ts"> <script lang="ts">
import type { Status } from "$lib/stores/portfolio"; import type { Status } from '$lib/stores/portfolio';
import StatusNotificationDot from "./StatusNotificationDot.svelte"; import StatusNotificationDot from './StatusNotificationDot.svelte';
export let status: Status; export let status: Status;
let title: string;
switch (status) {
case "submitted":
title = "Soubory odeslány!";
break;
case "uploaded":
title = "Soubory nahrány!";
break;
case "missing":
title = "Chybí soubory!";
break;
}
let title: string;
switch (status) {
case 'submitted':
title = 'Soubory odeslány!';
break;
case 'uploaded':
title = 'Soubory nahrány!';
break;
case 'missing':
title = 'Chybí soubory!';
break;
}
</script> </script>
<div class="bg-white rounded-full flex mb-8"> <div class="bg-white rounded-full flex mb-8">
<div class="mt-3 mb-3 ml-3 flex flex-row"> <div class="mt-3 mb-3 ml-3 flex flex-row">
<h2 class="ml-2 text-2xl text-sspsBlueDark font-bold">{title}</h2> <h2 class="ml-2 text-2xl text-sspsBlueDark font-bold">{title}</h2>
<span class="ml-32 w-8 h-8 rounded-full self-center {status}" /> <span class="ml-32 w-8 h-8 rounded-full self-center {status}" />
<!-- <StatusNotificationDot {status} /> --> <!-- <StatusNotificationDot {status} /> -->
</div> </div>
</div> </div>
<style> <style>
.submitted { .submitted {
@apply bg-[#35e000ff]; @apply bg-[#35e000ff];
} }
.uploaded { .uploaded {
@apply bg-[#ff8530ff]; @apply bg-[#ff8530ff];
} }
.missing { .missing {
@apply bg-[#ff3030ff]; @apply bg-[#ff3030ff];
} }
</style> </style>

View file

@ -1,50 +1,47 @@
<script lang="ts"> <script lang="ts">
import type { Status } from "$lib/stores/portfolio"; import type { Status } from '$lib/stores/portfolio';
export let status: Status;
let title: string;
export let status: Status; $: switch (status) {
let title: string; case 'submitted':
title = 'Odeslané';
$: switch (status) { break;
case "submitted": case 'uploaded':
title = "Odeslané"; title = 'Nahráno';
break; break;
case "uploaded": case 'missing':
title = "Nahráno"; title = 'Chybí';
break; break;
case "missing": }
title = "Chybí";
break;
};
</script> </script>
<!-- make red dot --> <!-- make red dot -->
<div class="flex flex-row justify-between animate-pulse div-{status}"> <div class="flex flex-row justify-between animate-pulse div-{status}">
<span class="mt-1 w-6 h-6 rounded-full {status}" /> <span class="mt-1 w-6 h-6 rounded-full {status}" />
<!-- <h3 class="ml-8 font-bold text-xl">{title}</h3> --> <!-- <h3 class="ml-8 font-bold text-xl">{title}</h3> -->
</div> </div>
<style> <style>
span { span {
@apply rounded-full p-1; @apply rounded-full p-1;
} }
.div-submitted { .div-submitted {
@apply animate-none; @apply animate-none;
} }
.submitted { .submitted {
@apply bg-[#35e000ff]; @apply bg-[#35e000ff];
} }
.uploaded { .uploaded {
@apply bg-[#ff8530ff]; @apply bg-[#ff8530ff];
@apply animate-none; @apply animate-none;
}
} .missing {
@apply bg-red-700;
.missing { }
@apply bg-red-700; </style>
}
</style>

View file

@ -6,7 +6,7 @@
@apply text-center text-2xl text-sspsBlue; @apply text-center text-2xl text-sspsBlue;
@apply pb-1; @apply pb-1;
@apply select-none; @apply select-none;
} }
span:hover { span:hover {
@apply cursor-pointer; @apply cursor-pointer;

View file

@ -1,20 +1,20 @@
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg" <svg height="24" width="24" xmlns="http://www.w3.org/2000/svg"
><path ><path
d="M4.586 20.414l-.707.707zm14.828 0l-.707-.707zM19 10v7h2v-7zm-3 10H8v2h8zM5 17v-7H3v7zm3 3c-.971 0-1.599-.002-2.061-.064-.434-.059-.57-.153-.646-.229l-1.414 1.414c.51.51 1.138.709 1.793.797C6.3 22.002 7.085 22 8 22zm-5-3c0 .915-.002 1.701.082 2.328.088.655.287 1.284.797 1.793l1.414-1.414c-.076-.076-.17-.212-.229-.646C5.002 18.6 5 17.971 5 17zm16 0c0 .971-.002 1.599-.064 2.061-.059.434-.153.57-.229.646l1.414 1.414c.51-.51.709-1.138.797-1.793C21.002 18.7 21 17.915 21 17zm-3 5c.915 0 1.701.002 2.328-.082.655-.088 1.284-.287 1.793-.797l-1.414-1.414c-.076.076-.212.17-.646.229-.462.062-1.09.064-2.061.064z" d="M4.586 20.414l-.707.707zm14.828 0l-.707-.707zM19 10v7h2v-7zm-3 10H8v2h8zM5 17v-7H3v7zm3 3c-.971 0-1.599-.002-2.061-.064-.434-.059-.57-.153-.646-.229l-1.414 1.414c.51.51 1.138.709 1.793.797C6.3 22.002 7.085 22 8 22zm-5-3c0 .915-.002 1.701.082 2.328.088.655.287 1.284.797 1.793l1.414-1.414c-.076-.076-.17-.212-.229-.646C5.002 18.6 5 17.971 5 17zm16 0c0 .971-.002 1.599-.064 2.061-.059.434-.153.57-.229.646l1.414 1.414c.51-.51.709-1.138.797-1.793C21.002 18.7 21 17.915 21 17zm-3 5c.915 0 1.701.002 2.328-.082.655-.088 1.284-.287 1.793-.797l-1.414-1.414c-.076.076-.212.17-.646.229-.462.062-1.09.064-2.061.064z"
/><path /><path
d="M3 11l6.172-6.172c1.333-1.333 2-2 2.828-2s1.495.667 2.828 2L21 11" d="M3 11l6.172-6.172c1.333-1.333 2-2 2.828-2s1.495.667 2.828 2L21 11"
stroke-linecap="round" stroke-linecap="round"
stroke-width="2" stroke-width="2"
/><path /><path
d="M9 17c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C10.602 14 11.068 14 12 14s1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C15 15.602 15 16.068 15 17v4H9zm7-12.5c0-.466 0-.699.076-.883a1 1 0 0 1 .541-.54C16.801 3 17.034 3 17.5 3s.699 0 .883.076a1 1 0 0 1 .54.541c.077.184.077.417.077.883V10l-3-3.5z" d="M9 17c0-.932 0-1.398.152-1.765a2 2 0 0 1 1.083-1.083C10.602 14 11.068 14 12 14s1.398 0 1.765.152a2 2 0 0 1 1.083 1.083C15 15.602 15 16.068 15 17v4H9zm7-12.5c0-.466 0-.699.076-.883a1 1 0 0 1 .541-.54C16.801 3 17.034 3 17.5 3s.699 0 .883.076a1 1 0 0 1 .54.541c.077.184.077.417.077.883V10l-3-3.5z"
/></svg /></svg
> >
<style> <style>
path { path {
@apply fill-sspsBlue; @apply fill-sspsBlue;
} }
path:nth-child(2) { path:nth-child(2) {
@apply stroke-sspsBlue; @apply stroke-sspsBlue;
} }
</style> </style>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,5 +1,5 @@
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg" <svg height="24" width="24" xmlns="http://www.w3.org/2000/svg"
><g ><g
><path ><path
d="M19.414 20.414l.707.707zm-14.828 0l-.707.707zm14.828-9.828l.707-.707zM8 11h8V9H8zm-3 6v-3H3v3zm11 3H8v2h8zm3-6v3h2v-3zm-3 8c.915 0 1.701.002 2.328-.082.655-.088 1.284-.287 1.793-.797l-1.414-1.414c-.076.076-.212.17-.646.229-.462.062-1.09.064-2.061.064zm3-5c0 .971-.002 1.599-.064 2.061-.059.434-.153.57-.229.646l1.414 1.414c.51-.51.709-1.138.797-1.793C21.002 18.7 21 17.915 21 17zM3 17c0 .915-.002 1.701.082 2.328.088.655.287 1.284.797 1.793l1.414-1.414c-.076-.076-.17-.212-.229-.646C5.002 18.6 5 17.971 5 17zm5 3c-.971 0-1.599-.002-2.061-.064-.434-.059-.57-.153-.646-.229l-1.414 1.414c.51.51 1.138.709 1.793.797C6.3 22.002 7.085 22 8 22zm8-9c.971 0 1.599.002 2.061.064.434.059.57.153.646.229l1.414-1.414c-.51-.51-1.138-.709-1.793-.797C17.7 8.998 16.915 9 16 9zm5 3c0-.915.002-1.701-.082-2.328-.088-.655-.287-1.284-.797-1.793l-1.414 1.414c.076.076.17.212.229.646.062.462.064 1.09.064 2.061zM8 9c-.915 0-1.701-.002-2.328.082-.655.088-1.284.287-1.793.797l1.414 1.414c.076-.076.212-.17.646-.229C6.4 11.002 7.029 11 8 11zm-3 5c0-.971.002-1.599.064-2.061.059-.434.153-.57.229-.646L3.879 9.879c-.51.51-.709 1.138-.797 1.793C2.998 12.3 3 13.085 3 14z" d="M19.414 20.414l.707.707zm-14.828 0l-.707.707zm14.828-9.828l.707-.707zM8 11h8V9H8zm-3 6v-3H3v3zm11 3H8v2h8zm3-6v3h2v-3zm-3 8c.915 0 1.701.002 2.328-.082.655-.088 1.284-.287 1.793-.797l-1.414-1.414c-.076.076-.212.17-.646.229-.462.062-1.09.064-2.061.064zm3-5c0 .971-.002 1.599-.064 2.061-.059.434-.153.57-.229.646l1.414 1.414c.51-.51.709-1.138.797-1.793C21.002 18.7 21 17.915 21 17zM3 17c0 .915-.002 1.701.082 2.328.088.655.287 1.284.797 1.793l1.414-1.414c-.076-.076-.17-.212-.229-.646C5.002 18.6 5 17.971 5 17zm5 3c-.971 0-1.599-.002-2.061-.064-.434-.059-.57-.153-.646-.229l-1.414 1.414c.51.51 1.138.709 1.793.797C6.3 22.002 7.085 22 8 22zm8-9c.971 0 1.599.002 2.061.064.434.059.57.153.646.229l1.414-1.414c-.51-.51-1.138-.709-1.793-.797C17.7 8.998 16.915 9 16 9zm5 3c0-.915.002-1.701-.082-2.328-.088-.655-.287-1.284-.797-1.793l-1.414 1.414c.076.076.17.212.229.646.062.462.064 1.09.064 2.061zM8 9c-.915 0-1.701-.002-2.328.082-.655.088-1.284.287-1.793.797l1.414 1.414c.076-.076.212-.17.646-.229C6.4 11.002 7.029 11 8 11zm-3 5c0-.971.002-1.599.064-2.061.059-.434.153-.57.229-.646L3.879 9.879c-.51.51-.709 1.138-.797 1.793C2.998 12.3 3 13.085 3 14z"
/><path /><path
@ -9,10 +9,11 @@
> >
<style> <style>
svg { svg {
@apply stroke-sspsBlue fill-sspsBlue; @apply stroke-sspsBlue fill-sspsBlue;
} }
g, path { g,
@apply fill-sspsBlue stroke-sspsBlue; path {
} @apply fill-sspsBlue stroke-sspsBlue;
</style> }
</style>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,4 +1,4 @@
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg" <svg height="24" width="24" xmlns="http://www.w3.org/2000/svg"
><path ><path
d="M19 21v-1.45c0-.977 0-1.465-.113-1.864a3 3 0 0 0-2.073-2.073c-.399-.113-.887-.113-1.864-.113h-6.9c-.977 0-1.465 0-1.864.113a3 3 0 0 0-2.073 2.073C4 18.085 4 18.573 4 19.55V21M16.2 7.06c0 2.245-1.88 4.065-4.2 4.065S7.8 9.305 7.8 7.06 9.68 2.996 12 2.996s4.2 1.82 4.2 4.064z" d="M19 21v-1.45c0-.977 0-1.465-.113-1.864a3 3 0 0 0-2.073-2.073c-.399-.113-.887-.113-1.864-.113h-6.9c-.977 0-1.465 0-1.864.113a3 3 0 0 0-2.073 2.073C4 18.085 4 18.573 4 19.55V21M16.2 7.06c0 2.245-1.88 4.065-4.2 4.065S7.8 9.305 7.8 7.06 9.68 2.996 12 2.996s4.2 1.82 4.2 4.064z"
stroke="currentColor" stroke="currentColor"

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 524 B

View file

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import lion from '$lib/assets/logo/lion.png'; import lion from '$lib/assets/logo/lion.png';
</script> </script>
<div <div
class="py-3 px-6 md:py-4 md:px-8 rounded-[999px] shadow-2xl flex items-center justify-center transition-all duration-700 hover:shadow-md" class="py-3 px-6 md:py-4 md:px-8 rounded-[999px] shadow-2xl flex items-center justify-center transition-all duration-700 hover:shadow-md"
> >
@ -8,5 +9,4 @@
</div> </div>
<style> <style>
</style>
</style>

View file

@ -6,7 +6,7 @@
<div class="bg"> <div class="bg">
<div class="bgOverlay"> <div class="bgOverlay">
<img class="logo" src={logo} alt="SSPŠ logo" /> <img class="logo" src={logo} alt="SSPŠ logo" />
<div class="darkModeToggle"> <div class="darkModeToggle">
<DarkModeToggle backgroundColor="dark" /> <DarkModeToggle backgroundColor="dark" />
</div> </div>
@ -21,7 +21,7 @@
<style> <style>
.logo { .logo {
@apply w-[200px] h-[200px] @apply w-[200px] h-[200px];
} }
.bgImage { .bgImage {
@apply -z-20; @apply -z-20;

View file

@ -4,19 +4,22 @@
import DarkModeToggle from '../DarkModeToggle.svelte'; import DarkModeToggle from '../DarkModeToggle.svelte';
export let backgroundImage: string = defaultBg; export let backgroundImage: string = defaultBg;
export let backgroundPosition: string = "55%"; export let backgroundPosition: string = '55%';
</script> </script>
<div class="bg"> <div class="bg">
<div class="bgOverlay"> <div class="bgOverlay">
<img class="logo" src={logo} alt="SSPŠ logo" /> <img class="logo" src={logo} alt="SSPŠ logo" />
</div> </div>
<div style={`background-image: url(${backgroundImage}); background-position: ${backgroundPosition}`} class="bgImage" /> <div
style={`background-image: url(${backgroundImage}); background-position: ${backgroundPosition}`}
class="bgImage"
/>
</div> </div>
<div class="view"> <div class="view">
<div class="darkModeToggle"> <div class="darkModeToggle">
<DarkModeToggle/> <DarkModeToggle />
</div> </div>
<div class="content"> <div class="content">
<slot /> <slot />
</div> </div>
@ -52,7 +55,7 @@
@apply md:my-auto; @apply md:my-auto;
@apply bg-white; @apply bg-white;
} }
.content { .content {
@apply w-full h-full; @apply w-full h-full;
} }
</style> </style>

View file

@ -6,29 +6,22 @@
export let value: string = ''; export let value: string = '';
export let error: string = ''; export let error: string = '';
// Phone Number formatting // Phone Number formatting
$: { $: {
let x = value.replace(/\D/g, '').match(/(\d{0,3})(\d{0,3})(\d{0,3})(\d{0,3})/)!; let x = value.replace(/\D/g, '').match(/(\d{0,3})(\d{0,3})(\d{0,3})(\d{0,3})/)!;
value = value =
(x[1] ? '+' + x[1] : '') + (x[2] ? ' ' + x[2] : '') + (x[3] ? ' ' + x[3] : '') + (x[4] ? ' ' + x[4] : ''); (x[1] ? '+' + x[1] : '') +
(x[2] ? ' ' + x[2] : '') +
(x[3] ? ' ' + x[3] : '') +
(x[4] ? ' ' + x[4] : '');
} }
</script> </script>
<TextField <TextField bind:error bind:value on:keydown on:keyup on:change type="tel" {placeholder} icon>
bind:error
bind:value
on:keydown
on:keyup
on:change
type="tel"
{placeholder}
icon
>
<div slot="icon" class="flex items-center justify-center"> <div slot="icon" class="flex items-center justify-center">
<Telephone /> <Telephone />
</div> </div>
</TextField> </TextField>
<style> <style>
</style>
</style>

View file

@ -1,26 +1,26 @@
import { writable } from "svelte/store"; import { writable } from 'svelte/store';
export interface CandidateData { export interface CandidateData {
name?: string; name?: string;
surname?: string; surname?: string;
birthplace?: string; birthplace?: string;
birthdate?: string; birthdate?: string;
address?: string; address?: string;
telephone?: string; telephone?: string;
citizenship?: string; citizenship?: string;
email?: string; email?: string;
sex?: string; sex?: string;
study?: string; study?: string;
personalIdNumber?: string; personalIdNumber?: string;
parentName?: string; parentName?: string;
parentSurname?: string; parentSurname?: string;
parentTelephone?: string; parentTelephone?: string;
parentEmail?: string; parentEmail?: string;
} }
export interface CandidateLogin { export interface CandidateLogin {
applicationId: number; applicationId: number;
password: string; password: string;
} }
export const candidateData = writable<CandidateData>({}); export const candidateData = writable<CandidateData>({});

View file

@ -1,26 +1,26 @@
import { apiFetchSubmissionProgress } from "../@api/candidate"; import { apiFetchSubmissionProgress } from '../@api/candidate';
import { writable } from "svelte/store"; import { writable } from 'svelte/store';
export type Status = 'submitted' | 'uploaded' | 'missing'; export type Status = 'submitted' | 'uploaded' | 'missing';
export enum UploadStatus { export enum UploadStatus {
None = 1, None = 1,
Some = 2, Some = 2,
All = 3, All = 3,
Submitted = 4, Submitted = 4
} }
export interface SubmissionProgress { export interface SubmissionProgress {
status?: UploadStatus; status?: UploadStatus;
files?: [number]; files?: [number];
} }
export const submissionProgress = writable<SubmissionProgress>({}); export const submissionProgress = writable<SubmissionProgress>({});
export async function fetchSubmProgress() { export async function fetchSubmProgress() {
try { try {
const prog = await apiFetchSubmissionProgress(); const prog = await apiFetchSubmissionProgress();
submissionProgress.set(prog); submissionProgress.set(prog);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
} }

View file

@ -43,7 +43,10 @@
name: yup.string().required(), name: yup.string().required(),
surname: yup.string(), surname: yup.string(),
email: yup.string().email().required(), email: yup.string().email().required(),
telephone: yup.string().required().matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/), telephone: yup
.string()
.required()
.matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/),
birthplace: yup.string().required(), birthplace: yup.string().required(),
birthdate: yup.string().required(), birthdate: yup.string().required(),
sex: yup.string(), sex: yup.string(),
@ -53,24 +56,27 @@
study: yup.string().required(), study: yup.string().required(),
parentName: yup.string(), parentName: yup.string(),
parentSurname: yup.string(), parentSurname: yup.string(),
parentTelephone: yup.string().required().matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/), parentTelephone: yup
.string()
.required()
.matches(/^\+\d{1,3} \d{3} \d{3} \d{3}$/),
parentEmail: yup.string().email().required() parentEmail: yup.string().email().required()
}), }),
onSubmit: async (values) => { onSubmit: async (values) => {
if (pageIndex === pageCount) { if (pageIndex === pageCount) {
try { try {
console.log("submit") console.log('submit');
// @ts-ignore // love javascript // @ts-ignore // love javascript
delete values.undefined; delete values.undefined;
values.birthdate = '2000-01-01' // TODO: reformat user typed date values.birthdate = '2000-01-01'; // TODO: reformat user typed date
await apiFillDetails(values); await apiFillDetails(values);
goto("/dashboard"); goto('/dashboard');
} catch (e) { } catch (e) {
console.error("error while submitting data: " + e); console.error('error while submitting data: ' + e);
} }
} }
}, }
}); });
$: console.log($errors); $: console.log($errors);
@ -84,7 +90,10 @@
break; break;
case 1: case 1:
if (/* $errors.birthdurname || */ $errors.birthplace || $errors.birthdate /* || $errors.sex */) { if (
/* $errors.birthdurname || */ $errors.birthplace ||
$errors.birthdate /* || $errors.sex */
) {
return true; return true;
} }
break; break;
@ -158,11 +167,7 @@
</p> </p>
<div class="flex flex-row md:flex-col w-full"> <div class="flex flex-row md:flex-col w-full">
<span class="w-full mt-8"> <span class="w-full mt-8">
<TextField <TextField type="text" placeholder="Rodné příjmení" on:change={handleChange} />
type="text"
placeholder="Rodné příjmení"
on:change={handleChange}
/>
</span> </span>
<span class="w-full mt-8 ml-2 md:ml-0"> <span class="w-full mt-8 ml-2 md:ml-0">
<TextField <TextField
@ -250,11 +255,7 @@
/> />
</span> </span>
<span class="w-full mt-8 ml-2 md:ml-0"> <span class="w-full mt-8 ml-2 md:ml-0">
<TextField <TextField on:change={handleChange} type="text" placeholder="Evidenční číslo přihlášky" />
on:change={handleChange}
type="text"
placeholder="Evidenční číslo přihlášky"
/>
</span> </span>
</div> </div>
<div class="mt-8 flex items-center justify-center w-full"> <div class="mt-8 flex items-center justify-center w-full">
@ -278,7 +279,7 @@
<input <input
on:click={async (e) => { on:click={async (e) => {
await handleSubmit(e); await handleSubmit(e);
console.log("clicked " + isPageInvalid()); console.log('clicked ' + isPageInvalid());
if (isPageInvalid()) return; if (isPageInvalid()) return;
if (pageIndex === pageCount) { if (pageIndex === pageCount) {
} else { } else {

View file

@ -6,8 +6,8 @@ import { apiLogout } from '$lib/@api/candidate';
export const load: PageServerLoad = async ({ fetch, cookies }) => { export const load: PageServerLoad = async ({ fetch, cookies }) => {
await apiLogout(fetch); await apiLogout(fetch);
cookies.delete('id', { path: '/' }); cookies.delete('id', { path: '/' });
cookies.delete('key', { path: '/' }); cookies.delete('key', { path: '/' });
throw redirect(302, '/auth/login'); throw redirect(302, '/auth/login');
}; };

View file

@ -1,13 +1,13 @@
import { defineConfig } from 'windicss/helpers'; import { defineConfig } from 'windicss/helpers';
export default defineConfig({ export default defineConfig({
theme: { theme: {
extend: { extend: {
colors: { colors: {
"sspsBlue": '#406280', sspsBlue: '#406280',
"sspsBlueDark": '#243a55', sspsBlueDark: '#243a55',
"sspsGray": "#e6e6e6", sspsGray: '#e6e6e6'
} }
} }
} }
}); });