diff --git a/src/collections/consultations/Interests.ts b/src/collections/consultations/Interests.ts new file mode 100644 index 0000000..a1a997f --- /dev/null +++ b/src/collections/consultations/Interests.ts @@ -0,0 +1,16 @@ +import type { CollectionConfig } from "payload"; + +export const Interests: CollectionConfig = { + slug: "interests", + fields: [ + { + name: "interest", + type: "text", + required: true, + }, + ], + admin: { + group: "Consultation", + description: "This is the procedure interests that can be selected when request a consultation", + }, +}; diff --git a/src/collections/consultations/consultation-datetime.ts b/src/collections/consultations/consultation-datetime.ts new file mode 100644 index 0000000..0057ed0 --- /dev/null +++ b/src/collections/consultations/consultation-datetime.ts @@ -0,0 +1,63 @@ +import type { GlobalConfig } from "payload"; + +export const ConsultationDateTime: GlobalConfig = { + slug: "consultation-datetime", + label: "Consultation Date & Time", + fields: [ + { + name: "day", + type: "group", + fields: [ + { + type: "checkbox", + name: "monday", + }, + { + type: "checkbox", + name: "tuesday", + }, + { + type: "checkbox", + name: "wednesday", + }, + { + type: "checkbox", + name: "thursday", + }, + { + type: "checkbox", + name: "friday", + }, + { + type: "checkbox", + name: "saturday", + }, + ], + }, + { + name: "time", + type: "array", + fields: [ + { + name: "name", + type: "text", + required: true, + }, + { + name: "start", + type: "text", + required: true, + }, + { + name: "end", + type: "text", + required: true, + }, + ], + }, + ], + admin: { + group: "Consultation", + description: "Date and time available for consultation", + }, +}; diff --git a/src/payload.config.ts b/src/payload.config.ts index 53753dd..5c61d93 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -10,6 +10,8 @@ import sharp from "sharp"; import { Users } from "./collections/Users"; import { Media } from "./collections/Media"; import { Blogs } from "./collections/Blogs"; +import { Interests } from "./collections/consultations/Interests"; +import { ConsultationDateTime } from "./collections/consultations/consultation-datetime"; const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename); @@ -21,7 +23,8 @@ export default buildConfig({ baseDir: path.resolve(dirname), }, }, - collections: [Users, Media, Blogs], + collections: [Users, Media, Blogs, Interests], + globals: [ConsultationDateTime], secret: process.env.PAYLOAD_SECRET || "", typescript: { outputFile: path.resolve(dirname, "payload-types.ts"),