diff --git a/frontend/src/lib/components/admin/CreateCandidateModal.svelte b/frontend/src/lib/components/admin/CreateCandidateModal.svelte new file mode 100644 index 0000000..61df75b --- /dev/null +++ b/frontend/src/lib/components/admin/CreateCandidateModal.svelte @@ -0,0 +1,61 @@ + + +{#if isOpened} + + + {#if login} + {applicationId} + {login.password} + {:else} + Registrace nového uchazeče + Evidenčni číslo přihlášky + + Rodné číslo + + + {/if} + + +{/if} + + diff --git a/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte b/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte index 3b5be2f..5b002f4 100644 --- a/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte +++ b/frontend/src/routes/(admin)/admin/(authenticated)/dashboard/+page.svelte @@ -6,6 +6,8 @@ import CandidateDetails from '$lib/components/list/CandidateDetails.svelte'; import { onMount } from 'svelte'; import type { PageData } from '../$types'; + import Modal from '$lib/components/Modal.svelte'; + import CreateCandidateModal from '$lib/components/admin/CreateCandidateModal.svelte'; let candidates: [CandidatePreview] = [{}]; let candidateDetails: { [id: number]: CandidateData } = {}; @@ -16,7 +18,7 @@ candidates = data.preview; }); - async function getCandidates() { + const getCandidates = async () => { try { candidates = await apiListCandidates(); } catch { @@ -24,14 +26,6 @@ } } - async function toggleDetail(id: number | undefined) { - if (id === undefined) return true; - if (candidateDetails.hasOwnProperty(id)) { - delete candidateDetails[id]; - } else { - candidateDetails[id] = await apiFetchCandidate(id); - } - } type Filter = 'Vše' | 'KBB' | 'IT' | 'GYM'; @@ -40,8 +34,18 @@ let activeFilter: Filter = 'Vše'; let scrollTop = 0; + + let createCandidateModal: boolean = false; + + const openCreateCandidateModal = () => { + createCandidateModal = true; + }; +{#if createCandidateModal} + (createCandidateModal = false)} /> +{/if} + @@ -57,6 +61,7 @@ Nový uchazeč @@ -64,6 +69,7 @@ {#if scrollTop > 200} + @@ -90,11 +96,15 @@ {#each candidates as candidate} toggleDetail(candidate.applicationId)} class="border-b bg-white hover:cursor-pointer" > {candidate.applicationId}{candidate.applicationId} {candidate.name}