2024-12-04 18:00:24 +00:00
|
|
|
<template>
|
|
|
|
<MainTemplate :showBack="false">
|
|
|
|
<template #topBar>
|
2024-12-05 15:37:10 +00:00
|
|
|
<div class="flex flex-row items-center gap-4 pt-5 pb-3 px-7">
|
2024-12-04 18:00:24 +00:00
|
|
|
<h1 class="font-bold text-xl h-8">Kalender</h1>
|
2024-12-05 15:37:10 +00:00
|
|
|
<div class="grow"></div>
|
|
|
|
<LinkIcon class="text-gray-500 h-5 w-5 cursor-pointer" @click="openLinkModal" />
|
|
|
|
<RouterLink :to="{ name: 'public-calendar-explain' }">
|
|
|
|
<InformationCircleIcon class="text-gray-500 h-5 w-5 cursor-pointer" />
|
|
|
|
</RouterLink>
|
2024-12-04 18:00:24 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #diffMain>
|
|
|
|
<div class="flex flex-col w-full h-full gap-2 justify-between px-7 overflow-hidden">
|
|
|
|
<FullCalendar :options="calendarOptions" class="max-h-full h-full" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</MainTemplate>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-12-05 15:37:10 +00:00
|
|
|
import { defineComponent, markRaw, defineAsyncComponent } from "vue";
|
|
|
|
import { mapActions, mapState } from "pinia";
|
|
|
|
import { useModalStore } from "@/stores/modal";
|
2024-12-04 18:00:24 +00:00
|
|
|
import MainTemplate from "@/templates/Main.vue";
|
|
|
|
import FullCalendar from "@fullcalendar/vue3";
|
|
|
|
import deLocale from "@fullcalendar/core/locales/de";
|
|
|
|
import dayGridPlugin from "@fullcalendar/daygrid";
|
|
|
|
import timeGridPlugin from "@fullcalendar/timegrid";
|
|
|
|
import interactionPlugin from "@fullcalendar/interaction";
|
2024-12-05 15:37:10 +00:00
|
|
|
import { InformationCircleIcon, LinkIcon } from "@heroicons/vue/24/outline";
|
2024-12-04 18:00:24 +00:00
|
|
|
import type { CalendarViewModel } from "@/viewmodels/admin/calendar.models";
|
2024-12-05 15:37:10 +00:00
|
|
|
import { RouterLink } from "vue-router";
|
2024-12-04 18:00:24 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
calendars: [] as Array<CalendarViewModel>,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
formattedItems() {
|
|
|
|
return this.calendars.map((c) => ({
|
|
|
|
id: c.id,
|
|
|
|
title: c.title,
|
|
|
|
start: c.starttime,
|
|
|
|
end: c.endtime,
|
|
|
|
backgroundColor: c.type.color,
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
calendarOptions() {
|
|
|
|
return {
|
|
|
|
timeZone: "local",
|
|
|
|
locale: deLocale,
|
|
|
|
plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
|
|
|
|
initialView: "dayGridMonth",
|
|
|
|
headerToolbar: {
|
|
|
|
left: "dayGridMonth,timeGridWeek",
|
|
|
|
center: "title",
|
|
|
|
right: "prev,today,next",
|
|
|
|
},
|
|
|
|
eventDisplay: "block",
|
|
|
|
weekends: true,
|
|
|
|
editable: false,
|
|
|
|
selectable: false,
|
|
|
|
selectMirror: false,
|
|
|
|
dayMaxEvents: true,
|
|
|
|
weekNumbers: true,
|
|
|
|
displayEventTime: true,
|
|
|
|
nowIndicator: true,
|
|
|
|
weekText: "KW",
|
|
|
|
allDaySlot: false,
|
|
|
|
events: this.formattedItems,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchCalendars();
|
|
|
|
},
|
|
|
|
methods: {
|
2024-12-05 15:37:10 +00:00
|
|
|
...mapActions(useModalStore, ["openModal"]),
|
2024-12-04 18:00:24 +00:00
|
|
|
fetchCalendars() {
|
|
|
|
this.$http
|
|
|
|
.get("/public/calendar?output=json")
|
|
|
|
.then((result) => {
|
|
|
|
this.calendars = result.data;
|
|
|
|
})
|
|
|
|
.catch((err) => {});
|
|
|
|
},
|
2024-12-05 15:37:10 +00:00
|
|
|
openLinkModal(e: any) {
|
|
|
|
this.openModal(markRaw(defineAsyncComponent(() => import("@/components/public/calendar/CalendarLinkModal.vue"))));
|
|
|
|
},
|
2024-12-04 18:00:24 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|