34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { z } from "zod"
|
|
|
|
const relationFieldSchema = z
|
|
.object({ value: z.string(), label: z.string() })
|
|
.nullable()
|
|
|
|
const APPOINTMENT_STATUS_OPTIONS = [
|
|
{ value: "requested", label: "Requested" },
|
|
{ value: "confirmed", label: "Confirmed" },
|
|
{ value: "in_progress", label: "In Progress" },
|
|
{ value: "completed", label: "Completed" },
|
|
{ value: "cancelled", label: "Cancelled" },
|
|
]
|
|
|
|
const appointmentFormSchema = z.object({
|
|
title: z.string().min(1, "Title is required"),
|
|
date: z.string().min(1, "Date is required"),
|
|
from_time: z.string().min(1, "Start time is required"),
|
|
to_time: z.string().min(1, "End time is required"),
|
|
customer: relationFieldSchema,
|
|
vehicle: relationFieldSchema,
|
|
service_writer: relationFieldSchema,
|
|
technician: relationFieldSchema,
|
|
department: relationFieldSchema,
|
|
job_card: relationFieldSchema,
|
|
notes: z.string().optional(),
|
|
status: z.string().optional(),
|
|
})
|
|
|
|
type AppointmentFormValues = z.infer<typeof appointmentFormSchema>
|
|
|
|
export { appointmentFormSchema, relationFieldSchema, APPOINTMENT_STATUS_OPTIONS }
|
|
export type { AppointmentFormValues }
|