mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 12:43:24 +00:00
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { z } from "zod";
|
|
import {
|
|
WORK_ORDER_PRIORITY_OPTIONS,
|
|
WORK_ORDER_STATUS_OPTIONS,
|
|
} from "@/domain/work-orders/types/work-order";
|
|
|
|
export const workOrderFormSchema = z.object({
|
|
internalWONumber: z.string(),
|
|
workOrderNumber: z.string(),
|
|
title: z.string().min(1, "Title is required"),
|
|
locationId: z.string().min(1, "Location is required"),
|
|
priority: z
|
|
.string()
|
|
.min(1, "Priority is required")
|
|
.refine(
|
|
(value) =>
|
|
WORK_ORDER_PRIORITY_OPTIONS.includes(value as (typeof WORK_ORDER_PRIORITY_OPTIONS)[number]),
|
|
"Priority is required",
|
|
),
|
|
status: z.enum(WORK_ORDER_STATUS_OPTIONS),
|
|
createdDate: z.string().min(1, "Created date is required"),
|
|
dueDate: z.string(),
|
|
scheduledDate: z.string(),
|
|
completedDate: z.string(),
|
|
assignedTo: z.string(),
|
|
description: z.string(),
|
|
po: z.string(),
|
|
tt: z.string(),
|
|
problem: z.string(),
|
|
trade: z.string(),
|
|
subTrade: z.string(),
|
|
vendorNTE: z.string(),
|
|
source: z.string(),
|
|
contactIds: z.array(z.number()).optional(),
|
|
categoryIds: z.array(z.number()).optional(),
|
|
});
|
|
|
|
export type WorkOrderFormSchemaValues = z.infer<typeof workOrderFormSchema>;
|