Includes room interior with floor, walls, glass you can see through, and all uncommitted production changes that were running live. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
2.9 KiB
TypeScript
74 lines
2.9 KiB
TypeScript
import { z } from "zod/v4";
|
|
|
|
// ── Step 1: Product ──────────────────────────────────────────────
|
|
export const doorTypes = ["taats", "scharnier", "paneel"] as const;
|
|
export const gridTypes = [
|
|
"geen", "2-vlak", "3-vlak", "4-vlak", "6-vlak", "8-vlak",
|
|
"kruis", "ongelijk-3", "boerderij", "herenhuis",
|
|
] as const;
|
|
|
|
export const productSchema = z.object({
|
|
doorType: z.enum(doorTypes),
|
|
gridType: z.enum(gridTypes),
|
|
doorConfig: z.enum(["enkele", "dubbele"]),
|
|
sidePanel: z.enum(["geen", "links", "rechts", "beide"]),
|
|
});
|
|
|
|
// ── Step 2: Dimensions ──────────────────────────────────────────
|
|
export const dimensionsSchema = z.object({
|
|
height: z
|
|
.number({ error: "Vul een geldige hoogte in" })
|
|
.min(1800, "Minimaal 1800mm")
|
|
.max(3000, "Maximaal 3000mm"),
|
|
width: z
|
|
.number({ error: "Vul een geldige breedte in" })
|
|
.min(300, "Minimaal 300mm")
|
|
.max(3000, "Maximaal 3000mm"),
|
|
});
|
|
|
|
// ── Step 3: Options ─────────────────────────────────────────────
|
|
export const finishTypes = ["zwart", "brons", "grijs", "goud", "beige", "ral"] as const;
|
|
export const glassColorTypes = ["helder", "grijs", "brons", "mat-blank", "mat-brons", "mat-zwart"] as const;
|
|
export const handleTypes = [
|
|
"beugelgreep", "hoekgreep", "maangreep", "ovaalgreep", "klink", "u-greep", "geen",
|
|
] as const;
|
|
export const frameSizes = [20, 30, 40] as const;
|
|
|
|
export const optionsSchema = z.object({
|
|
finish: z.enum(finishTypes),
|
|
glassColor: z.enum(glassColorTypes),
|
|
handle: z.enum(handleTypes),
|
|
frameSize: z.enum(["20", "30", "40"]).transform(Number),
|
|
});
|
|
|
|
// ── Step 4: Extras ──────────────────────────────────────────────
|
|
export const extrasSchema = z.object({
|
|
extraOptions: z.array(z.string()).optional(),
|
|
});
|
|
|
|
// ── Step 5: Contact ─────────────────────────────────────────────
|
|
export const contactSchema = z.object({
|
|
name: z.string().min(2, "Vul uw naam in"),
|
|
email: z.string().email("Vul een geldig e-mailadres in"),
|
|
phone: z.string().min(10, "Vul een geldig telefoonnummer in"),
|
|
note: z.string().optional(),
|
|
});
|
|
|
|
// ── Combined (used on final submission) ─────────────────────────
|
|
export const quoteSchema = productSchema
|
|
.merge(dimensionsSchema)
|
|
.merge(optionsSchema)
|
|
.merge(extrasSchema)
|
|
.merge(contactSchema);
|
|
|
|
export type QuoteData = z.infer<typeof quoteSchema>;
|
|
|
|
// Per-step schemas for step-by-step validation
|
|
export const stepSchemas = [
|
|
productSchema,
|
|
dimensionsSchema,
|
|
optionsSchema,
|
|
extrasSchema,
|
|
contactSchema,
|
|
] as const;
|