Files
anouma/collections/Offers.ts
T
maro 45261a0461 Initial commit: ANOUMA website with Payload CMS, WebRTC meetings, and booking system
- 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
2026-08-25 16:40:51 +02:00

128 lines
3.2 KiB
TypeScript

import type { CollectionConfig } from "payload";
import { isAdmin, publishedOrAdmin } from "@/access";
import { slugField } from "@/fields/slug";
// Groups the 7 individual offers for the mega menu and the /angebote
// overview page (Kindergruppen bundles Erdenkinder + Mädchenkreis, Singkreise
// bundles the three singing circles — matching the site's navigation).
export const OFFER_CATEGORIES = [
{ label: "Prozessbegleitung", value: "prozessbegleitung" },
{ label: "Doula-Begleitung", value: "doula-begleitung" },
{ label: "Kindergruppen", value: "kindergruppen" },
{ label: "Singkreise", value: "singkreise" },
] as const;
export const Offers: CollectionConfig = {
slug: "offers",
labels: {
singular: "Angebot",
plural: "Angebote",
},
admin: {
useAsTitle: "title",
defaultColumns: ["title", "category", "order", "_status"],
group: "Inhalte",
description: "Die Angebote von Anouma — erscheinen im Menü und auf /angebote.",
},
defaultSort: "order",
versions: {
drafts: true,
},
access: {
read: publishedOrAdmin,
create: isAdmin,
update: isAdmin,
delete: isAdmin,
},
fields: [
{
name: "title",
type: "text",
label: "Titel",
required: true,
},
slugField(),
{
name: "shortDescription",
type: "textarea",
label: "Kurzbeschreibung",
required: true,
admin: {
description: "Kurzer Satz für Karten, Menü und Übersicht.",
},
},
{
name: "description",
type: "richText",
label: "Beschreibung",
required: true,
},
{
name: "image",
type: "upload",
relationTo: "media",
label: "Bild",
},
{
name: "category",
type: "select",
label: "Kategorie",
required: true,
options: [...OFFER_CATEGORIES],
},
{
name: "order",
type: "number",
label: "Reihenfolge",
defaultValue: 0,
admin: {
position: "sidebar",
description: "Kleinere Zahl erscheint zuerst.",
},
},
{
name: "visibility",
type: "select",
label: "Sichtbarkeit",
required: true,
defaultValue: "public",
options: [
{ label: "Öffentlich (Menü, Übersicht)", value: "public" },
{ label: "Privat (nur über direkten Link/Buchung)", value: "private" },
],
admin: {
position: "sidebar",
description: "Private Angebote wie „Einzelbegleitung“ erscheinen nicht im Menü oder auf /angebote.",
},
},
{
name: "bookable",
type: "checkbox",
label: "Buchbar",
defaultValue: false,
admin: {
position: "sidebar",
description: "Aktiviert die Terminbuchung mit Kalenderauswahl auf der Angebotsseite.",
},
},
{
type: "row",
fields: [
{
name: "price",
type: "text",
label: "Preis bzw. Preistext",
admin: { width: "50%", description: "z. B. „80 €“ oder „auf Anfrage“." },
},
{
name: "durationMinutes",
type: "number",
label: "Dauer (Minuten)",
min: 5,
admin: { width: "50%", condition: (data) => Boolean(data?.bookable) },
},
],
},
],
};