Terminanmeldung mit Plätzen und Warteliste (0.31.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 5m10s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 5m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m42s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m35s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m36s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m27s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m19s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
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:
Friederich Loheide 2026-09-27 12:37:28 +00:00
parent 33a76458af
commit b293d2e05a
139 changed files with 1030 additions and 336 deletions

View file

@ -15,6 +15,7 @@ defineProps({
<h3 class="line-clamp-2 text-sm leading-snug font-semibold group-hover:underline">{{ event.title }}</h3>
<p class="mt-0.5 text-xs text-muted-foreground">{{ formatEventRange(event) }}</p>
<p v-if="event.location" class="truncate text-xs text-muted-foreground">{{ event.location }}</p>
<span v-if="event.registration_enabled" class="mt-1 inline-block rounded bg-brand-soft px-1.5 py-0.5 text-[11px] font-medium text-brand-text">Mit Anmeldung</span>
</div>
</Link>
</template>

View file

@ -41,6 +41,11 @@ const form = useForm({
description: e?.description ?? '',
image_path: e?.image_path ?? null,
is_published: e?.is_published ?? true,
registration_enabled: e?.registration_enabled ?? false,
capacity: e?.capacity ?? '',
waitlist: e?.waitlist ?? true,
registration_deadline: e?.registration_deadline ?? '',
participants_public: e?.participants_public ?? false,
audience: e?.audience ?? {},
});
@ -137,6 +142,39 @@ function remove() {
<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="Anmeldung">
<label class="flex items-center justify-between gap-3 text-sm">
<span>
<span class="font-medium">Anmeldung erforderlich</span>
<span class="block text-xs text-muted-foreground">Mitarbeitende melden sich im Portal oder in der App an.</span>
</span>
<Switch v-model="form.registration_enabled" />
</label>
<div v-if="form.registration_enabled" class="mt-4 grid gap-4 border-t pt-4">
<FormField id="ev-capacity" label="Plätze" :error="form.errors.capacity" hint="Leer lassen für unbegrenzt.">
<Input id="ev-capacity" v-model="form.capacity" type="number" min="1" inputmode="numeric" />
</FormField>
<label v-if="form.capacity" class="flex items-center justify-between gap-3 text-sm">
<span>
<span class="font-medium">Warteliste</span>
<span class="block text-xs text-muted-foreground">Wird ein Platz frei, rückt die nächste Person automatisch nach.</span>
</span>
<Switch v-model="form.waitlist" />
</label>
<FormField id="ev-deadline" label="Anmeldeschluss (optional)" :error="form.errors.registration_deadline" hint="Ohne Angabe bis zum Beginn.">
<Input id="ev-deadline" v-model="form.registration_deadline" type="datetime-local" />
</FormField>
<label class="flex items-center justify-between gap-3 text-sm">
<span>
<span class="font-medium">Teilnehmende zeigen</span>
<span class="block text-xs text-muted-foreground">Angemeldete sehen, wer noch kommt.</span>
</span>
<Switch v-model="form.participants_public" />
</label>
<p v-if="e?.registrations" class="text-[13px] text-muted-foreground">Bisher {{ e.registrations }} {{ e.registrations === 1 ? 'Anmeldung' : 'Anmeldungen' }} – die Liste steht beim Termin.</p>
</div>
</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" />

View file

@ -1,19 +1,49 @@
<script setup>
import { watch } from 'vue';
import { Link, usePage } from '@inertiajs/vue3';
import { ArrowLeft, CalendarPlus, Clock, MapPin, PencilLine, Video } from '@lucide/vue';
import { computed, ref, watch } from 'vue';
import { Link, router, useForm, usePage } from '@inertiajs/vue3';
import { ArrowLeft, CalendarCheck, CalendarPlus, Clock, Download, Hourglass, LoaderCircle, MapPin, PencilLine, Trash2, Users, 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';
import AppLayout from '@/layouts/AppLayout.vue';
import { formatEventRange } from '@/lib/format';
import { Textarea } from '@/components/ui/textarea';
import PersonAvatar from '@/components/PersonAvatar.vue';
import { formatDate, formatEventRange, formatShortDate, formatTime } from '@/lib/format';
defineProps({
const props = defineProps({
event: { type: Object, required: true },
editUrl: { type: String, default: null },
canManage: { type: Boolean, default: false },
registration: { type: Object, default: null },
participants: { type: Array, default: null },
});
// Anmeldung
const reg = computed(() => props.registration);
const regForm = useForm({ note: props.registration?.note ?? '' });
const showNote = ref(false);
const full = computed(() => reg.value && reg.value.free === 0);
function register() {
regForm.post(`/termine/${props.event.id}/anmeldung`, { preserveScroll: true, onSuccess: () => (showNote.value = false) });
}
function unregister() {
if (window.confirm('Wirklich abmelden? Ihr Platz geht an die nächste Person.')) {
router.delete(`/termine/${props.event.id}/anmeldung`, { preserveScroll: true });
}
}
function removeParticipant(participant) {
if (window.confirm(`Anmeldung von ${participant.name} entfernen?`)) {
router.delete(`/termine/${props.event.id}/anmeldungen/${participant.id}`, { preserveScroll: true });
}
}
const confirmedList = computed(() => (props.participants ?? []).filter((p) => p.status === 'confirmed'));
const waitingList = computed(() => (props.participants ?? []).filter((p) => p.status === 'waitlist'));
const page = usePage();
watch(() => page.props.flash.status, (status) => status && toast.success(status), { immediate: true });
</script>
@ -69,6 +99,86 @@ watch(() => page.props.flash.status, (status) => status && toast.success(status)
<a :href="`/termine/${event.id}/kalender.ics`"><CalendarPlus /> In meinen Kalender</a>
</Button>
</Panel>
<!-- Anmeldung -->
<Panel v-if="reg" title="Anmeldung" class="self-start lg:col-start-3">
<div class="grid gap-4 text-sm">
<div v-if="reg.capacity" class="grid gap-1.5">
<div class="flex items-baseline justify-between">
<span class="text-muted-foreground">Belegt</span>
<span class="font-medium tabular-nums">{{ reg.confirmed }} von {{ reg.capacity }}</span>
</div>
<div class="h-2 overflow-hidden rounded-full bg-muted">
<div class="h-full rounded-full bg-brand" :style="{ width: `${Math.min(100, (reg.confirmed / reg.capacity) * 100)}%` }" />
</div>
<span v-if="reg.waiting" class="text-xs text-muted-foreground">{{ reg.waiting }} auf der Warteliste</span>
</div>
<p v-else class="text-muted-foreground">{{ reg.confirmed }} {{ reg.confirmed === 1 ? 'Person ist' : 'Personen sind' }} angemeldet.</p>
<div v-if="reg.status === 'confirmed'" class="flex items-start gap-2.5 rounded-md bg-brand-soft p-3 text-brand-text">
<CalendarCheck class="mt-0.5 size-4 shrink-0" />
<span><span class="font-semibold">Sie sind angemeldet.</span><span v-if="reg.note" class="block text-[13px] opacity-80">Anmerkung: {{ reg.note }}</span></span>
</div>
<div v-else-if="reg.status === 'waitlist'" class="flex items-start gap-2.5 rounded-md bg-muted p-3">
<Hourglass class="mt-0.5 size-4 shrink-0 text-muted-foreground" />
<span><span class="font-semibold">Warteliste, Platz {{ reg.position }}.</span><span class="block text-[13px] text-muted-foreground">Wird ein Platz frei, rücken Sie automatisch nach und bekommen Bescheid.</span></span>
</div>
<p v-if="reg.deadline && reg.open" class="text-xs text-muted-foreground">Anmeldeschluss: {{ formatDate(reg.deadline) }}, {{ formatTime(reg.deadline) }} Uhr</p>
<template v-if="reg.open && !reg.status">
<div v-if="showNote" class="grid gap-1.5">
<label for="reg-note" class="text-[13px] font-medium">Anmerkung (optional)</label>
<Textarea id="reg-note" v-model="regForm.note" rows="2" maxlength="500" placeholder="z. B. vegetarisch, Begleitung …" />
</div>
<p v-if="regForm.errors.registration" class="text-[13px] text-destructive">{{ regForm.errors.registration }}</p>
<Button v-if="!full || reg.waitlist" :disabled="regForm.processing" class="w-full" @click="register">
<LoaderCircle v-if="regForm.processing" class="animate-spin" />
{{ full ? 'Auf die Warteliste' : 'Jetzt anmelden' }}
</Button>
<p v-else class="font-medium">Leider ausgebucht.</p>
<button v-if="!showNote && (!full || reg.waitlist)" type="button" class="text-[13px] text-muted-foreground hover:text-foreground hover:underline" @click="showNote = true">Anmerkung hinzufügen</button>
</template>
<p v-else-if="!reg.open && !reg.status" class="text-muted-foreground">Die Anmeldung ist geschlossen.</p>
<Button v-if="reg.status && new Date(event.starts_at) > new Date()" variant="ghost" size="sm" class="justify-self-start text-destructive hover:text-destructive" @click="unregister">
{{ reg.status === 'waitlist' ? 'Von der Warteliste nehmen' : 'Abmelden' }}
</Button>
</div>
</Panel>
<!-- Teilnehmende -->
<Panel v-if="participants" :title="canManage ? 'Teilnehmende' : 'Wer kommt?'" class="lg:col-span-2 lg:row-start-2">
<template v-if="canManage" #actions>
<Button variant="outline" size="sm" as-child><a :href="`/termine/${event.id}/teilnehmende.csv`"><Download /> Liste (CSV)</a></Button>
</template>
<p v-if="!participants.length" class="text-sm text-muted-foreground">Noch keine Anmeldungen.</p>
<ul v-if="confirmedList.length" class="-mx-5 divide-y border-y">
<li v-for="p in confirmedList" :key="p.id" class="flex items-center gap-3 px-5 py-2">
<PersonAvatar :person="p" class="size-8" />
<div class="min-w-0 flex-1 text-sm">
<Link :href="`/personen/${p.user_id}`" class="font-medium hover:underline">{{ p.name }}</Link>
<p v-if="canManage && (p.department || p.note)" class="truncate text-xs text-muted-foreground">{{ [p.department, p.note].filter(Boolean).join(' · ') }}</p>
</div>
<span v-if="canManage" class="text-xs text-muted-foreground tabular-nums">{{ formatShortDate(p.date) }}</span>
<Button v-if="canManage" variant="ghost" size="icon" class="size-7 text-muted-foreground hover:text-destructive" :aria-label="`${p.name} entfernen`" @click="removeParticipant(p)"><Trash2 class="size-3.5" /></Button>
</li>
</ul>
<template v-if="canManage && waitingList.length">
<h3 class="mt-5 mb-2 flex items-center gap-1.5 text-xs font-semibold tracking-wider text-muted-foreground uppercase"><Users class="size-3.5" /> Warteliste</h3>
<ol class="-mx-5 divide-y border-y">
<li v-for="(p, i) in waitingList" :key="p.id" class="flex items-center gap-3 px-5 py-2">
<span class="w-5 text-right text-xs text-muted-foreground tabular-nums">{{ i + 1 }}.</span>
<PersonAvatar :person="p" class="size-8" />
<div class="min-w-0 flex-1 text-sm">
<span class="font-medium">{{ p.name }}</span>
<p v-if="p.department || p.note" class="truncate text-xs text-muted-foreground">{{ [p.department, p.note].filter(Boolean).join(' · ') }}</p>
</div>
<Button variant="ghost" size="icon" class="size-7 text-muted-foreground hover:text-destructive" :aria-label="`${p.name} entfernen`" @click="removeParticipant(p)"><Trash2 class="size-3.5" /></Button>
</li>
</ol>
</template>
</Panel>
</div>
</div>
</AppLayout>