mirror of
https://github.com/jakobkordez/ham-reserve.git
synced 2025-05-31 08:49:06 +00:00
Add admin buttons to reservation
This commit is contained in:
parent
085f583ddd
commit
db94cbce1b
@ -11,6 +11,10 @@
|
|||||||
import DownloadButton from './download-button.svelte';
|
import DownloadButton from './download-button.svelte';
|
||||||
import LogSummary from './log-summary.svelte';
|
import LogSummary from './log-summary.svelte';
|
||||||
import UploadLog from './upload-log.svelte';
|
import UploadLog from './upload-log.svelte';
|
||||||
|
import { userStore } from '$lib/stores/user-store';
|
||||||
|
import { Role } from '$lib/enums/role.enum';
|
||||||
|
import { getAccessToken } from '$lib/stores/auth-store';
|
||||||
|
import { apiFunctions } from '$lib/api';
|
||||||
|
|
||||||
const { data }: { data: PageData } = $props();
|
const { data }: { data: PageData } = $props();
|
||||||
|
|
||||||
@ -23,10 +27,29 @@
|
|||||||
{:then [reservation, event]}
|
{:then [reservation, event]}
|
||||||
<div class="flex flex-col gap-10">
|
<div class="flex flex-col gap-10">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<a href="/event/{event._id}" class="link flex items-center gap-2">
|
<div class="flex items-center justify-between flex-wrap">
|
||||||
<Fa icon={faArrowLeft} />
|
<a href="/event/{event._id}" class="link flex items-center gap-2">
|
||||||
<span>Nazaj na dogodek</span>
|
<Fa icon={faArrowLeft} />
|
||||||
</a>
|
<span>Nazaj na dogodek</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
{#if $userStore?.roles.includes(Role.Admin)}
|
||||||
|
<a href="/admin/events/{event._id}" class="btn btn-warning btn-sm">Nazaj na dogodek</a>
|
||||||
|
|
||||||
|
<button
|
||||||
|
onclick={() => {
|
||||||
|
if (!confirm('Ali ste prepričani, da želite izbrisati rezervacijo?')) return;
|
||||||
|
getAccessToken().then((token) => {
|
||||||
|
if (!token) return;
|
||||||
|
apiFunctions.deleteReservation(token, reservation._id).then(() => {
|
||||||
|
window.location.href = `/event/${event._id}`;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
class="btn btn-error btn-sm">Izbriši</button
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1 class="font-callsign text-3xl">{event.callsign}</h1>
|
<h1 class="font-callsign text-3xl">{event.callsign}</h1>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user