feat: add CMS inquiries and group bookings
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import type { CollectionConfig } from "payload";
|
||||
import { isAdmin, isAdminFieldLevel } from "@/access";
|
||||
|
||||
export const Conversations: CollectionConfig = {
|
||||
slug: "conversations",
|
||||
labels: {
|
||||
singular: "Anfrage",
|
||||
plural: "Anfragen",
|
||||
},
|
||||
admin: {
|
||||
useAsTitle: "subject",
|
||||
defaultColumns: ["subject", "name", "email", "status", "lastMessageAt"],
|
||||
group: "Kommunikation",
|
||||
description: "Kontakt- und Terminanfragen als durchsuchbare Konversationen.",
|
||||
},
|
||||
access: {
|
||||
read: isAdmin,
|
||||
create: () => false,
|
||||
update: isAdmin,
|
||||
delete: isAdmin,
|
||||
},
|
||||
timestamps: true,
|
||||
fields: [
|
||||
{
|
||||
name: "subject",
|
||||
type: "text",
|
||||
label: "Betreff",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: "row",
|
||||
fields: [
|
||||
{ name: "name", type: "text", label: "Name", required: true, admin: { width: "50%" } },
|
||||
{ name: "email", type: "email", label: "E-Mail", required: true, admin: { width: "50%" } },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
type: "select",
|
||||
label: "Art",
|
||||
required: true,
|
||||
defaultValue: "contact",
|
||||
options: [
|
||||
{ label: "Kontakt", value: "contact" },
|
||||
{ label: "Terminanfrage", value: "appointment" },
|
||||
{ label: "Gruppenangebot", value: "group" },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
type: "select",
|
||||
label: "Status",
|
||||
required: true,
|
||||
defaultValue: "open",
|
||||
options: [
|
||||
{ label: "Offen", value: "open" },
|
||||
{ label: "Wartet auf Antwort", value: "waiting" },
|
||||
{ label: "Erledigt", value: "closed" },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "customer",
|
||||
type: "relationship",
|
||||
relationTo: "customers",
|
||||
label: "Kundenkonto",
|
||||
admin: { position: "sidebar", readOnly: true },
|
||||
},
|
||||
{
|
||||
name: "threadKey",
|
||||
type: "text",
|
||||
label: "E-Mail-Thread-Schlüssel",
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true,
|
||||
defaultValue: () => randomUUID(),
|
||||
access: { read: isAdminFieldLevel, update: () => false },
|
||||
admin: { position: "sidebar", readOnly: true },
|
||||
},
|
||||
{
|
||||
name: "lastMessageAt",
|
||||
type: "date",
|
||||
label: "Letzte Nachricht",
|
||||
index: true,
|
||||
admin: { position: "sidebar", readOnly: true },
|
||||
},
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user