- settings/company: show success toast on save (2.1) - inspection templates: add explicit Save button (2.6) - parts: label price fields with AED currency (3.1) - service groups: add parts/services picker to packages (3.3) - vehicles: add insurance (has_insurance + insurance type) field (4.2) - appointments: add calendar view with list/calendar toggle (5.1) - job card check-in: require department (5.4) - job card payments: refresh job card/invoice queries so PAID shows (5.6) - vendors: add phone + address fields (6.1) - bill payments: surface real vendor/employee validation errors (6.4) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { z } from "zod"
|
|
|
|
export const relationFieldSchema = z
|
|
.object({ value: z.string(), label: z.string() })
|
|
.nullable()
|
|
|
|
const packagePartSchema = z.object({
|
|
id: z.union([z.string(), z.number()]).optional(),
|
|
part: relationFieldSchema,
|
|
quantity: z.coerce.number().min(0).optional(),
|
|
rate: z.coerce.number().min(0).optional(),
|
|
})
|
|
|
|
const packageServiceSchema = z.object({
|
|
id: z.union([z.string(), z.number()]).optional(),
|
|
service: relationFieldSchema,
|
|
rate: z.coerce.number().min(0).optional(),
|
|
hours: z.coerce.number().min(0).optional(),
|
|
})
|
|
|
|
export const serviceGroupFormSchema = z.object({
|
|
shop_type: relationFieldSchema,
|
|
inventory_category: relationFieldSchema,
|
|
unit_type: relationFieldSchema,
|
|
department: relationFieldSchema,
|
|
service_name: z.string().min(1, "Service name is required"),
|
|
code: z.string().optional(),
|
|
service_description: z.string().optional(),
|
|
selling_price: z.coerce.number().min(0).optional(),
|
|
selling_chart_of_account: z.string().optional(),
|
|
show_as_lump_sum: z.boolean().optional(),
|
|
mark_as_recommended: z.boolean().optional(),
|
|
set_packaged_pricing: z.boolean().optional(),
|
|
is_active: z.boolean().optional(),
|
|
// ── Package contents ──
|
|
parts: z.array(packagePartSchema).optional(),
|
|
services: z.array(packageServiceSchema).optional(),
|
|
})
|
|
|
|
export type ServiceGroupFormValues = z.infer<typeof serviceGroupFormSchema>
|