mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-07 08:40:16 +00:00
feat: two applications support candidate dashboard
This commit is contained in:
parent
cb25e713e6
commit
6655e9978f
3 changed files with 27 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import axios, { type AxiosProgressEvent } from 'axios';
|
import axios, { type AxiosProgressEvent } from 'axios';
|
||||||
import type { CandidateData, CandidateLogin, CreateCandidate } from '$lib/stores/candidate';
|
import type { BaseCandidate, CandidateData, CandidateLogin, CreateCandidate } from '$lib/stores/candidate';
|
||||||
import type { SubmissionProgress } from '$lib/stores/portfolio';
|
import type { SubmissionProgress } from '$lib/stores/portfolio';
|
||||||
import { API_URL, errorHandler, type Fetch } from '.';
|
import { API_URL, errorHandler, type Fetch } from '.';
|
||||||
import DOMPurify from 'isomorphic-dompurify';
|
import DOMPurify from 'isomorphic-dompurify';
|
||||||
|
|
@ -51,7 +51,7 @@ export const apiFetchSubmissionProgress = async (fetchSsr?: Fetch): Promise<Subm
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const apiWhoami = async (fetchSsr?: Fetch): Promise<CreateCandidate> => {
|
export const apiWhoami = async (fetchSsr?: Fetch): Promise<BaseCandidate> => {
|
||||||
const apiFetch = fetchSsr || fetch;
|
const apiFetch = fetchSsr || fetch;
|
||||||
try {
|
try {
|
||||||
console.log(API_URL + '/candidate/whoami');
|
console.log(API_URL + '/candidate/whoami');
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,16 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getField = (id: number) => {
|
||||||
|
if (id.toString().startsWith("101")) {
|
||||||
|
return 'G';
|
||||||
|
} else if (id.toString().startsWith("102")) {
|
||||||
|
return 'IT';
|
||||||
|
} else {
|
||||||
|
return 'KB';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const editDetails = async () => {
|
const editDetails = async () => {
|
||||||
goto('/register?edit=true');
|
goto('/register?edit=true');
|
||||||
};
|
};
|
||||||
|
|
@ -140,9 +150,15 @@
|
||||||
class="mt-4 flex flex-col justify-between leading-10"
|
class="mt-4 flex flex-col justify-between leading-10"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
>Ev. č. přihlášky: <span class="font-bold">{$baseCandidateData.applicationId}</span
|
>Ev. č. přihlášky ({getField($baseCandidateData.applications[0])}):
|
||||||
></span
|
<span class="font-bold">{$baseCandidateData.applications[0]}</span></span
|
||||||
>
|
>
|
||||||
|
{#if $baseCandidateData.applications.length > 1}
|
||||||
|
<span
|
||||||
|
>Ev. č. přihlášky ({getField($baseCandidateData.applications[1])}):
|
||||||
|
<span class="font-bold">{$baseCandidateData.applications[1]}</span></span
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
<span>Obor: <span class="font-bold">{$candidateData.candidate.study}</span></span>
|
<span>Obor: <span class="font-bold">{$candidateData.candidate.study}</span></span>
|
||||||
<span>Adresa: <span class="font-bold">{$candidateData.candidate.address}</span></span>
|
<span>Adresa: <span class="font-bold">{$candidateData.candidate.address}</span></span>
|
||||||
<span
|
<span
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,17 @@ export interface CreateCandidate {
|
||||||
personalIdNumber: string;
|
personalIdNumber: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BaseCandidate {
|
||||||
|
applications: Array<number>;
|
||||||
|
personalIdNumber: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CreateCandidateLogin extends CreateCandidate {
|
export interface CreateCandidateLogin extends CreateCandidate {
|
||||||
password: string;
|
password: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const baseCandidateData = writable<CreateCandidate>({
|
export const baseCandidateData = writable<BaseCandidate>({
|
||||||
applicationId: 0,
|
applications: [],
|
||||||
personalIdNumber: ''
|
personalIdNumber: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue