Termine im Portal bearbeiten (0.23.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m53s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m42s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m13s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m10s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m46s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m35s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m54s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m53s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m53s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m42s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m13s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m10s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m46s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m35s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m54s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m53s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
80a0f20447
commit
d7d09d6b9a
142 changed files with 917 additions and 315 deletions
|
|
@ -0,0 +1,45 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Plus } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import EventDateBlock from '../components/EventDateBlock.vue';
|
||||
|
||||
/**
|
||||
* „Redaktion → Termine“: kommende und kürzlich vergangene Termine.
|
||||
*/
|
||||
const props = defineProps({
|
||||
events: { type: Array, required: true },
|
||||
});
|
||||
|
||||
const showPast = ref(false);
|
||||
const list = computed(() => props.events.filter((event) => showPast.value || !event.is_past));
|
||||
const pastCount = computed(() => props.events.filter((event) => event.is_past).length);
|
||||
const time = new Intl.DateTimeFormat('de-DE', { weekday: 'short', day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' });
|
||||
const day = new Intl.DateTimeFormat('de-DE', { weekday: 'short', day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Panel title="Termine">
|
||||
<template #actions>
|
||||
<Button size="sm" variant="outline" as-child><Link href="/redaktion/termine/neu"><Plus /> Neuer Termin</Link></Button>
|
||||
</template>
|
||||
<ul v-if="list.length" class="-mx-5 divide-y border-t">
|
||||
<li v-for="event in list" :key="event.id" class="flex items-center gap-3 px-5 py-2.5" :class="{ 'opacity-60': event.is_past }">
|
||||
<EventDateBlock :date="event.starts_at" class="w-11 shrink-0 py-1 text-xs" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<Link :href="event.edit_url" class="block truncate text-sm font-medium hover:underline">{{ event.title }}</Link>
|
||||
<p class="truncate text-xs text-muted-foreground">
|
||||
{{ event.all_day ? `${day.format(new Date(event.starts_at))} · ganztägig` : `${time.format(new Date(event.starts_at))} Uhr` }}<template v-if="event.location"> · {{ event.location }}</template>
|
||||
</p>
|
||||
</div>
|
||||
<span v-if="!event.is_published" class="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground">Entwurf</span>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="text-sm text-muted-foreground">Keine anstehenden Termine.</p>
|
||||
<button v-if="pastCount" type="button" class="mt-3 text-[13px] text-muted-foreground hover:text-foreground hover:underline" @click="showPast = !showPast">
|
||||
{{ showPast ? 'Vergangene ausblenden' : `Vergangene der letzten 30 Tage zeigen (${pastCount})` }}
|
||||
</button>
|
||||
</Panel>
|
||||
</template>
|
||||
161
plugins-core/events/resources/js/pages/Editor.vue
Normal file
161
plugins-core/events/resources/js/pages/Editor.vue
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Link, router, useForm } from '@inertiajs/vue3';
|
||||
import { ArrowLeft, ImagePlus, LoaderCircle, Save, Trash2, Users, X } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import AudienceEditor from '@/components/AudienceEditor.vue';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import RichTextEditor from '@/components/RichTextEditor.vue';
|
||||
import MediaPickerHost from '@/components/media/MediaPickerHost.vue';
|
||||
import { uploadWithProgress } from '@/components/media/api';
|
||||
import { useMediaPicker } from '@/components/media/useMediaPicker';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
||||
/**
|
||||
* Termin anlegen oder bearbeiten (Redaktion im Portal).
|
||||
*/
|
||||
const props = defineProps({
|
||||
event: { type: Object, default: null },
|
||||
audienceOptions: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const nextHour = () => {
|
||||
const date = new Date();
|
||||
date.setHours(date.getHours() + 1, 0, 0, 0);
|
||||
|
||||
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, 16);
|
||||
};
|
||||
|
||||
const e = props.event;
|
||||
const form = useForm({
|
||||
title: e?.title ?? '',
|
||||
all_day: e?.all_day ?? false,
|
||||
starts_at: e?.starts_at ?? nextHour(),
|
||||
ends_at: e?.ends_at ?? '',
|
||||
location: e?.location ?? '',
|
||||
online_url: e?.online_url ?? '',
|
||||
description: e?.description ?? '',
|
||||
image_path: e?.image_path ?? null,
|
||||
is_published: e?.is_published ?? true,
|
||||
audience: e?.audience ?? {},
|
||||
});
|
||||
|
||||
const previewUrl = ref(e?.image_url ?? null);
|
||||
|
||||
// Ganztägig: nur Datum bearbeiten
|
||||
const dateType = computed(() => (form.all_day ? 'date' : 'datetime-local'));
|
||||
watch(() => form.all_day, (allDay) => {
|
||||
form.starts_at = allDay ? form.starts_at.slice(0, 10) : `${form.starts_at.slice(0, 10)}T09:00`;
|
||||
form.ends_at = form.ends_at ? (allDay ? form.ends_at.slice(0, 10) : `${form.ends_at.slice(0, 10)}T17:00`) : '';
|
||||
});
|
||||
|
||||
const upload = (file, onProgress) => uploadWithProgress('/redaktion/termine/bilder', file, { onProgress });
|
||||
const picker = useMediaPicker({ upload, contextLabel: 'Bei diesem Termin', contextPaths: () => [form.image_path].filter(Boolean) });
|
||||
|
||||
async function chooseImage() {
|
||||
const items = await picker.pick({ title: 'Titelbild wählen' });
|
||||
|
||||
if (items?.[0]) {
|
||||
form.image_path = items[0].path;
|
||||
previewUrl.value = items[0].url;
|
||||
}
|
||||
}
|
||||
|
||||
const restricted = computed(() => Object.values(form.audience ?? {}).some((values) => values?.length));
|
||||
|
||||
function submit() {
|
||||
const options = { preserveScroll: true };
|
||||
e ? form.put(`/redaktion/termine/${e.id}`, options) : form.post('/redaktion/termine', options);
|
||||
}
|
||||
|
||||
function remove() {
|
||||
if (window.confirm(`Termin „${e.title}“ löschen?`)) {
|
||||
router.delete(`/redaktion/termine/${e.id}`);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout :title="e ? `Bearbeiten: ${e.title}` : 'Neuer Termin'">
|
||||
<PageHeader :title="e ? 'Termin bearbeiten' : 'Neuer Termin'" :breadcrumbs="[{ label: 'Termine', href: '/termine' }]">
|
||||
<template #actions>
|
||||
<Button v-if="e" variant="ghost" class="text-destructive hover:text-destructive" @click="remove"><Trash2 /> Löschen</Button>
|
||||
<Button :disabled="form.processing" @click="submit"><LoaderCircle v-if="form.processing" class="animate-spin" /><Save v-else /> Speichern</Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<form class="grid grid-cols-1 items-start gap-6 lg:grid-cols-[minmax(0,1fr)_20rem]" @submit.prevent="submit">
|
||||
<div class="grid min-w-0 gap-6">
|
||||
<Panel>
|
||||
<div class="grid gap-5">
|
||||
<FormField id="ev-title" label="Titel" :error="form.errors.title">
|
||||
<Input id="ev-title" v-model="form.title" maxlength="160" placeholder="z. B. Sommerfest 2026" class="text-base" />
|
||||
</FormField>
|
||||
|
||||
<label class="flex items-center gap-3 text-sm font-medium">
|
||||
<Switch v-model="form.all_day" /> Ganztägig
|
||||
</label>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<FormField id="ev-start" label="Beginn" :error="form.errors.starts_at">
|
||||
<Input id="ev-start" v-model="form.starts_at" :type="dateType" />
|
||||
</FormField>
|
||||
<FormField id="ev-end" label="Ende (optional)" :error="form.errors.ends_at">
|
||||
<Input id="ev-end" v-model="form.ends_at" :type="dateType" :min="form.starts_at" />
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<FormField id="ev-location" label="Ort" :error="form.errors.location">
|
||||
<Input id="ev-location" v-model="form.location" maxlength="255" placeholder="z. B. Kantine, Haus A" />
|
||||
</FormField>
|
||||
<FormField id="ev-online" label="Online-Link" :error="form.errors.online_url">
|
||||
<Input id="ev-online" v-model="form.online_url" type="url" maxlength="500" placeholder="https://…" />
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
<FormField id="ev-description" label="Beschreibung" :error="form.errors.description">
|
||||
<RichTextEditor v-model="form.description" bordered min-height="12rem" placeholder="Worum geht es? Programm, Anmeldung, Mitbringen …" />
|
||||
</FormField>
|
||||
</div>
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6">
|
||||
<Panel title="Veröffentlichung">
|
||||
<label class="flex items-center justify-between gap-3 text-sm">
|
||||
<span>
|
||||
<span class="font-medium">Veröffentlicht</span>
|
||||
<span class="block text-xs text-muted-foreground">Sonst nur für die Redaktion sichtbar.</span>
|
||||
</span>
|
||||
<Switch v-model="form.is_published" />
|
||||
</label>
|
||||
<Link v-if="e?.url && e.is_published" :href="e.url" class="mt-3 inline-flex items-center gap-1 text-[13px] text-brand-text hover:underline"><ArrowLeft class="size-3.5" /> Zum Termin</Link>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Titelbild">
|
||||
<div v-if="form.image_path" class="relative overflow-hidden rounded-md border">
|
||||
<img :src="previewUrl" alt="" class="aspect-video w-full object-cover" />
|
||||
<button type="button" class="absolute top-2 right-2 grid size-7 place-items-center rounded-full bg-black/60 text-white hover:bg-black/80" aria-label="Bild entfernen" @click="form.image_path = null"><X class="size-4" /></button>
|
||||
</div>
|
||||
<Button type="button" variant="outline" class="w-full" :class="{ 'mt-3': form.image_path }" @click="chooseImage"><ImagePlus /> {{ form.image_path ? 'Anderes Bild' : 'Bild wählen oder hochladen' }}</Button>
|
||||
<p v-if="form.errors.image_path" class="mt-2 text-[13px] text-destructive">{{ form.errors.image_path }}</p>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Wer sieht den Termin?">
|
||||
<p class="-mt-1 mb-3 flex items-start gap-2 text-[13px] text-muted-foreground">
|
||||
<Users class="mt-0.5 size-4 shrink-0" />
|
||||
{{ restricted ? 'Nur Personen, die mindestens eine Angabe erfüllen.' : 'Alle – oder unten eingrenzen.' }}
|
||||
</p>
|
||||
<AudienceEditor v-model="form.audience" :options="audienceOptions" exclude-hint="Sehen den Termin nie – auch wenn oben etwas passt." />
|
||||
</Panel>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<MediaPickerHost :picker="picker" />
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { CalendarDays, MapPin, Video } from '@lucide/vue';
|
||||
import { computed, watch } from 'vue';
|
||||
import { Link, usePage } from '@inertiajs/vue3';
|
||||
import { CalendarDays, MapPin, Plus, Video } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import EmptyState from '@/components/EmptyState.vue';
|
||||
import EventDateBlock from '../components/EventDateBlock.vue';
|
||||
import DashboardSidebar from '@/components/DashboardSidebar.vue';
|
||||
|
|
@ -12,8 +14,12 @@ import { formatEventRange, formatMonthYear } from '@/lib/format';
|
|||
const props = defineProps({
|
||||
events: { type: Object, required: true },
|
||||
sidebar: { type: Array, default: () => [] },
|
||||
canManage: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
|
||||
// Nach Monaten gruppieren – laufende Termine erscheinen im aktuellen Monat.
|
||||
const groups = computed(() => {
|
||||
const result = [];
|
||||
|
|
@ -37,7 +43,11 @@ const groups = computed(() => {
|
|||
|
||||
<template>
|
||||
<AppLayout title="Termine">
|
||||
<PageHeader title="Termine" description="Veranstaltungen, Fortbildungen und Treffen." />
|
||||
<PageHeader title="Termine" description="Veranstaltungen, Fortbildungen und Treffen.">
|
||||
<template v-if="canManage" #actions>
|
||||
<Button as-child><Link href="/redaktion/termine/neu"><Plus /> Neuer Termin</Link></Button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
|
||||
<div class="grid gap-6 lg:grid-cols-12">
|
||||
<div class="min-w-0" :class="sidebar.length ? 'lg:col-span-8 xl:col-span-9' : 'lg:col-span-12'">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { ArrowLeft, CalendarPlus, Clock, MapPin, Video } from '@lucide/vue';
|
||||
import { watch } from 'vue';
|
||||
import { Link, usePage } from '@inertiajs/vue3';
|
||||
import { ArrowLeft, CalendarPlus, Clock, MapPin, PencilLine, Video } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import EventDateBlock from '../components/EventDateBlock.vue';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
|
|
@ -9,15 +11,22 @@ import { formatEventRange } from '@/lib/format';
|
|||
|
||||
defineProps({
|
||||
event: { type: Object, required: true },
|
||||
editUrl: { type: String, default: null },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppLayout :title="event.title">
|
||||
<div class="mx-auto max-w-4xl">
|
||||
<Link href="/termine" class="mb-6 inline-flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground">
|
||||
<ArrowLeft class="size-4" /> Alle Termine
|
||||
</Link>
|
||||
<div class="mb-6 flex items-center justify-between gap-3">
|
||||
<Link href="/termine" class="inline-flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground">
|
||||
<ArrowLeft class="size-4" /> Alle Termine
|
||||
</Link>
|
||||
<Button v-if="editUrl" variant="outline" size="sm" as-child><Link :href="editUrl"><PencilLine /> Bearbeiten</Link></Button>
|
||||
</div>
|
||||
|
||||
<div class="flex items-start gap-4">
|
||||
<EventDateBlock :date="event.starts_at" class="w-16 py-2" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue