From baa716b8ff20e73e363c69162b9b72cc864a56a7 Mon Sep 17 00:00:00 2001 From: "Najjar\\NajjarV02" Date: Fri, 5 Jun 2026 14:36:23 +0400 Subject: [PATCH] feat(dashboard): allow both vendor and employee on payment made Remove the mutual-exclusion validation and update the field descriptions so a payment-made can be linked to a vendor and an employee at the same time. Previously selecting both raised a validation error. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../modules/payment-mades/payment-made-form.tsx | 4 ++-- .../modules/payment-mades/payment-made.schema.ts | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/apps/dashboard/modules/payment-mades/payment-made-form.tsx b/apps/dashboard/modules/payment-mades/payment-made-form.tsx index de338ea..a50920d 100644 --- a/apps/dashboard/modules/payment-mades/payment-made-form.tsx +++ b/apps/dashboard/modules/payment-mades/payment-made-form.tsx @@ -268,14 +268,14 @@ export function PaymentMadeForm({ resourceId, initialData, onSuccess, billId, ex name="vendor" label="Vendor" required={vendorRequired} - description="Select either a vendor or an employee." + description="Select a vendor, an employee, or both." /> api.employees.list()} mapOption={mapEmployeeOption} diff --git a/apps/dashboard/modules/payment-mades/payment-made.schema.ts b/apps/dashboard/modules/payment-mades/payment-made.schema.ts index a993fd9..c2ca8e3 100644 --- a/apps/dashboard/modules/payment-mades/payment-made.schema.ts +++ b/apps/dashboard/modules/payment-mades/payment-made.schema.ts @@ -66,19 +66,6 @@ const paymentMadeFormSchema = z.object({ message: "Vendor or employee is required", }) } - - if (hasVendor && hasEmployee) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - path: ["vendor"], - message: "Select either a vendor or an employee, not both", - }) - ctx.addIssue({ - code: z.ZodIssueCode.custom, - path: ["employee"], - message: "Select either a vendor or an employee, not both", - }) - } }) type PaymentMadeFormValues = z.infer