- Next.js 16 App Router site with the ANOUMA design system - Payload CMS (PostgreSQL) for offers, events, posts and page content - WebRTC video-call system with custom signaling server - SMTP email reminders and booking-request notifications - Customer accounts, calendar-based availability, and booking workflow
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import type { CollectionConfig } from "payload";
|
|
import { isAdmin } from "@/access";
|
|
|
|
export const AvailabilityOverrides: CollectionConfig = {
|
|
slug: "availability-overrides",
|
|
labels: {
|
|
singular: "Ausnahme",
|
|
plural: "Ausnahmen",
|
|
},
|
|
admin: {
|
|
useAsTitle: "date",
|
|
defaultColumns: ["date", "type", "reason"],
|
|
group: "Buchungen",
|
|
description: "Einzelne Abweichungen von den wiederkehrenden Verfügbarkeiten — Urlaub, Feiertage, Krankheit oder Sonderöffnungszeiten.",
|
|
},
|
|
access: {
|
|
read: () => true,
|
|
create: isAdmin,
|
|
update: isAdmin,
|
|
delete: isAdmin,
|
|
},
|
|
fields: [
|
|
{
|
|
name: "date",
|
|
type: "date",
|
|
label: "Datum",
|
|
required: true,
|
|
admin: { date: { pickerAppearance: "dayOnly", displayFormat: "dd.MM.yyyy" } },
|
|
},
|
|
{
|
|
name: "type",
|
|
type: "select",
|
|
label: "Art",
|
|
required: true,
|
|
defaultValue: "unavailable",
|
|
options: [
|
|
{ label: "Nicht verfügbar (ganzer Tag)", value: "unavailable" },
|
|
{ label: "Abweichende Uhrzeiten", value: "custom-hours" },
|
|
],
|
|
},
|
|
{
|
|
type: "row",
|
|
admin: { condition: (data) => data?.type === "custom-hours" },
|
|
fields: [
|
|
{
|
|
name: "startTime",
|
|
type: "date",
|
|
label: "Start",
|
|
admin: { date: { pickerAppearance: "timeOnly", displayFormat: "HH:mm" }, width: "50%" },
|
|
},
|
|
{
|
|
name: "endTime",
|
|
type: "date",
|
|
label: "Ende",
|
|
admin: { date: { pickerAppearance: "timeOnly", displayFormat: "HH:mm" }, width: "50%" },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "reason",
|
|
type: "select",
|
|
label: "Grund",
|
|
options: [
|
|
{ label: "Urlaub", value: "urlaub" },
|
|
{ label: "Feiertag", value: "feiertag" },
|
|
{ label: "Krankheit", value: "krankheit" },
|
|
{ label: "Sonderöffnungszeit", value: "sonderoeffnungszeit" },
|
|
{ label: "Sonstiges", value: "sonstiges" },
|
|
],
|
|
},
|
|
],
|
|
};
|