change: enable calendar entry details for public

This commit is contained in:
Julian Krauser 2025-01-20 12:43:18 +01:00
parent c40b53b200
commit 5bcb76a60e
3 changed files with 105 additions and 1 deletions

View file

@ -0,0 +1,97 @@
<template>
<div class="relative w-full md:max-w-md">
<div class="flex flex-col items-center">
<p class="text-xl font-medium">Termin</p>
</div>
<br />
<div class="flex flex-col gap-4 py-2">
<div>
<label for="title">Terminart</label>
<input type="text" id="title" readonly :value="data.type?.type" />
</div>
<div>
<label for="title">Titel</label>
<input type="text" id="title" readonly :value="data.title" />
</div>
<div>
<label for="content">Beschreibung</label>
<textarea id="content" class="h-18" readonly :value="data.content"></textarea>
</div>
<div v-if="data.allDay" class="flex flex-row gap-2 items-center">Der Termin findet ganztägig statt.</div>
<div v-if="data.allDay == false" class="flex flex-row gap-2">
<div class="w-full">
<label for="starttime">Startzeit</label>
<input type="datetime-local" id="starttime" readonly :value="formatForDateTimeLocalInput(data.starttime)" />
</div>
<div class="w-full">
<label for="endtime">Endzeit</label>
<input
ref="endtime"
type="datetime-local"
id="endtime"
readonly
:value="formatForDateTimeLocalInput(data.endtime)"
/>
</div>
</div>
<div v-else class="flex flex-row gap-2">
<div class="w-full">
<label for="startdate">Startdatum</label>
<input type="date" id="startdate" readonly :value="formatForDateInput(data.starttime)" />
</div>
<div class="w-full">
<label for="enddate">Enddatum</label>
<input ref="enddate" type="date" id="enddate" readonly :value="formatForDateInput(data.endtime)" />
</div>
</div>
<div>
<label for="location">Ort</label>
<input type="text" id="location" readonly :value="data.location" />
</div>
</div>
<div class="flex flex-row justify-end">
<div class="flex flex-row gap-4 py-2">
<button primary-outline @click="closeModal">schließen</button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
import { mapState, mapActions } from "pinia";
import { useModalStore } from "@/stores/modal";
import Spinner from "@/components/Spinner.vue";
</script>
<script lang="ts">
export default defineComponent({
computed: {
...mapState(useModalStore, ["data"]),
},
methods: {
...mapActions(useModalStore, ["closeModal"]),
formatForDateTimeLocalInput(utcDateString: string) {
const localDate = new Date(utcDateString);
const year = localDate.getFullYear();
const month = String(localDate.getMonth() + 1).padStart(2, "0");
const day = String(localDate.getDate()).padStart(2, "0");
const hours = String(localDate.getHours()).padStart(2, "0");
const minutes = String(localDate.getMinutes()).padStart(2, "0");
return `${year}-${month}-${day}T${hours}:${minutes}`;
},
formatForDateInput(utcDateString: string) {
const localDate = new Date(utcDateString);
const year = localDate.getFullYear();
const month = String(localDate.getMonth() + 1).padStart(2, "0");
const day = String(localDate.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
},
},
});
</script>

View file

@ -63,7 +63,7 @@ export const useNavigationStore = defineStore("navigation", {
{ {
key: "settings", key: "settings",
title: "Einstellungen", title: "Einstellungen",
levelDefault: "qualification", levelDefault: "award",
} as topLevelNavigationModel, } as topLevelNavigationModel,
] ]
: []), : []),

View file

@ -73,6 +73,7 @@ export default defineComponent({
weekText: "KW", weekText: "KW",
allDaySlot: false, allDaySlot: false,
events: this.formattedItems, events: this.formattedItems,
eventClick: this.eventClick,
}; };
}, },
}, },
@ -92,6 +93,12 @@ export default defineComponent({
openLinkModal(e: any) { openLinkModal(e: any) {
this.openModal(markRaw(defineAsyncComponent(() => import("@/components/public/calendar/CalendarLinkModal.vue")))); this.openModal(markRaw(defineAsyncComponent(() => import("@/components/public/calendar/CalendarLinkModal.vue"))));
}, },
eventClick(e: any) {
this.openModal(
markRaw(defineAsyncComponent(() => import("@/components/public/calendar/ShowCalendarEntryModal.vue"))),
this.calendars.find((c) => c.id == e.event.id)
);
},
}, },
}); });
</script> </script>