added other materials tab

This commit is contained in:
xCyanGrizzly
2026-02-18 21:55:39 +01:00
parent ec04e1bd0b
commit 32683ecf5e
14 changed files with 1272 additions and 7 deletions

View File

@@ -0,0 +1,20 @@
import { z } from "zod/v4";
import { SUPPLY_CATEGORIES } from "@/lib/constants";
export const supplySchema = z.object({
name: z.string().min(1, "Name is required").max(128),
brand: z.string().min(1, "Brand is required").max(64),
category: z.enum(SUPPLY_CATEGORIES),
color: z.string().max(64).optional().or(z.literal("")),
colorHex: z.string().regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color").optional().or(z.literal("")),
totalAmount: z.coerce.number().positive("Total amount must be positive"),
usedAmount: z.coerce.number().min(0).default(0),
unit: z.string().min(1, "Unit is required").max(16),
vendorId: z.string().optional().or(z.literal("")),
locationId: z.string().optional().or(z.literal("")),
purchaseDate: z.string().optional().or(z.literal("")),
cost: z.coerce.number().min(0).optional(),
notes: z.string().max(1024).optional(),
});
export type SupplyInput = z.output<typeof supplySchema>;