2024-10-06 12:02:39 +02:00
|
|
|
<template>
|
|
|
|
<MainTemplate>
|
|
|
|
<template #topBar>
|
|
|
|
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
|
|
|
<h1 class="font-bold text-xl h-8">Kalender</h1>
|
2025-02-12 18:02:09 +01:00
|
|
|
<div class="flex flex-row gap-2">
|
2025-04-14 09:12:00 +02:00
|
|
|
<PlusIcon
|
|
|
|
class="text-gray-500 h-5 w-5 cursor-pointer"
|
|
|
|
@click="select({ start: '', end: '', allDay: false })"
|
|
|
|
/>
|
2025-02-12 18:02:09 +01:00
|
|
|
<LinkIcon class="text-gray-500 h-5 w-5 cursor-pointer" @click="openLinkModal" />
|
|
|
|
</div>
|
2024-10-06 12:02:39 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #diffMain>
|
|
|
|
<div class="flex flex-col w-full h-full gap-2 justify-between px-7 overflow-hidden">
|
2025-04-14 09:12:00 +02:00
|
|
|
<CustomCalendar :items="formattedItems" @date-select="select" @event-select="eventClick" />
|
2024-10-06 12:02:39 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</MainTemplate>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-10-28 16:02:41 +01:00
|
|
|
import { defineComponent, markRaw, defineAsyncComponent } from "vue";
|
2024-10-06 12:02:39 +02:00
|
|
|
import { mapActions, mapState } from "pinia";
|
2024-10-28 16:02:41 +01:00
|
|
|
import { useModalStore } from "@/stores/modal";
|
2024-10-06 12:02:39 +02:00
|
|
|
import MainTemplate from "@/templates/Main.vue";
|
2025-01-02 18:28:13 +01:00
|
|
|
import { useCalendarStore } from "@/stores/admin/club/calendar";
|
2024-11-24 15:31:08 +01:00
|
|
|
import { useAbilityStore } from "@/stores/ability";
|
2025-02-12 18:02:09 +01:00
|
|
|
import { LinkIcon, PlusIcon } from "@heroicons/vue/24/outline";
|
2025-04-14 09:12:00 +02:00
|
|
|
import CustomCalendar from "@/components/CustomCalendar.vue";
|
2024-10-06 12:02:39 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
data() {
|
2024-10-28 16:02:41 +01:00
|
|
|
return {};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(useCalendarStore, ["formattedItems"]),
|
2024-11-24 15:31:08 +01:00
|
|
|
...mapState(useAbilityStore, ["can"]),
|
2024-10-28 16:02:41 +01:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchCalendars();
|
2024-10-06 12:02:39 +02:00
|
|
|
},
|
2024-10-25 17:21:09 +02:00
|
|
|
methods: {
|
2024-10-28 16:02:41 +01:00
|
|
|
...mapActions(useModalStore, ["openModal"]),
|
|
|
|
...mapActions(useCalendarStore, ["fetchCalendars"]),
|
2025-04-14 09:12:00 +02:00
|
|
|
select({ start, end, allDay }: { start: string; end: string; allDay: boolean }) {
|
2024-11-24 15:31:08 +01:00
|
|
|
if (!this.can("create", "club", "calendar")) return;
|
2024-10-28 16:02:41 +01:00
|
|
|
this.openModal(
|
|
|
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/CreateCalendarModal.vue"))),
|
|
|
|
{
|
2025-04-14 09:12:00 +02:00
|
|
|
start,
|
|
|
|
end,
|
|
|
|
allDay,
|
2024-10-28 16:02:41 +01:00
|
|
|
}
|
|
|
|
);
|
2024-10-25 17:21:09 +02:00
|
|
|
},
|
2025-04-14 09:12:00 +02:00
|
|
|
eventClick(id: string) {
|
2024-11-24 15:31:08 +01:00
|
|
|
if (!this.can("update", "club", "calendar")) return;
|
2024-10-28 16:02:41 +01:00
|
|
|
this.openModal(
|
2024-11-07 09:16:38 +01:00
|
|
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/UpdateCalendarModal.vue"))),
|
2025-04-14 09:12:00 +02:00
|
|
|
id
|
2024-10-28 16:02:41 +01:00
|
|
|
);
|
2024-10-25 17:21:09 +02:00
|
|
|
},
|
2024-12-05 16:37:10 +01:00
|
|
|
openLinkModal(e: any) {
|
|
|
|
this.openModal(
|
|
|
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/CalendarLinkModal.vue")))
|
|
|
|
);
|
|
|
|
},
|
2024-10-25 17:21:09 +02:00
|
|
|
},
|
2024-10-06 12:02:39 +02:00
|
|
|
});
|
|
|
|
</script>
|