0cf9602958
Events can be moved to archive and moved back Fixed validation
77 lines
2.8 KiB
Vue
77 lines
2.8 KiB
Vue
<script setup>
|
||
import { ref } from 'vue';
|
||
import AppLayout from "../../../../resources/js/layouts/AppLayout.vue";
|
||
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
|
||
import { toast } from 'vue3-toastify';
|
||
import axios from 'axios';
|
||
|
||
const props = defineProps({
|
||
events: Array,
|
||
});
|
||
|
||
const events = ref([...props.events]);
|
||
|
||
async function unarchiveEvent(eventId) {
|
||
try {
|
||
const response = await axios.post(`/api/v1/event/details/${eventId}/unarchive`);
|
||
if (response.data.status === 'success') {
|
||
events.value = events.value.filter(e => e.id !== eventId);
|
||
toast.success('Veranstaltung wurde aus dem Archiv geholt.');
|
||
} else {
|
||
toast.error('Fehler beim Wiederherstellen der Veranstaltung.');
|
||
}
|
||
} catch {
|
||
toast.error('Ein unerwarteter Fehler ist aufgetreten.');
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<AppLayout title="Archivierte Veranstaltungen">
|
||
<div style="width: 95%; margin: 20px auto;">
|
||
<h1 style="font-size: 1.5rem; font-weight: 700; margin-bottom: 20px;">Archivierte Veranstaltungen</h1>
|
||
|
||
<div
|
||
v-if="events.length === 0"
|
||
style="text-align: center; color: #6b7280; padding: 40px 0;"
|
||
>
|
||
Es sind keine archivierten Veranstaltungen vorhanden.
|
||
</div>
|
||
|
||
<ShadowedBox
|
||
v-for="event in events"
|
||
:key="event.id"
|
||
style="padding: 20px; margin-bottom: 16px;"
|
||
>
|
||
<div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;">
|
||
<div>
|
||
<h2 style="margin: 0 0 4px 0; font-size: 1.1rem; font-weight: 600;">{{ event.name }}</h2>
|
||
<span style="color: #6b7280; font-size: 0.875rem;">
|
||
{{ event.postalCode }} {{ event.location }}
|
||
·
|
||
{{ event.eventBegin }} – {{ event.eventEnd }}
|
||
</span>
|
||
</div>
|
||
|
||
<button
|
||
@click="unarchiveEvent(event.id)"
|
||
style="
|
||
padding: 8px 20px;
|
||
background-color: #f59e0b;
|
||
color: white;
|
||
border: none;
|
||
border-radius: 8px;
|
||
font-weight: 600;
|
||
font-size: 0.9rem;
|
||
cursor: pointer;
|
||
white-space: nowrap;
|
||
"
|
||
>
|
||
Aus dem Archiv holen
|
||
</button>
|
||
</div>
|
||
</ShadowedBox>
|
||
</div>
|
||
</AppLayout>
|
||
</template>
|