From 9234253c972f58663400de4ad4ab99dc1b01dbc4 Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Fri, 28 Nov 2025 10:26:26 +0530 Subject: [PATCH] fixed perfoma amt and delivery charge validation --- src/components/purchase/ManagePurchase.jsx | 1 - .../purchase/PurchasePartyDetails.jsx | 17 +++++------------ .../purchase/PurchasePaymentDetails.jsx | 2 +- src/components/purchase/PurchaseSchema.jsx | 8 ++++---- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/components/purchase/ManagePurchase.jsx b/src/components/purchase/ManagePurchase.jsx index 7e470c33..1c76017e 100644 --- a/src/components/purchase/ManagePurchase.jsx +++ b/src/components/purchase/ManagePurchase.jsx @@ -120,7 +120,6 @@ const ManagePurchase = ({ onClose, purchaseId }) => { CreateInvoice(formData); } }; - return (
{ {/* Organization */}
- {/* */} + { labelKey="name" useFetchHook={useGlobaleOrganizations} hookParams={[ITEMS_PER_PAGE,1]} - errors={errors?.organizationId} + errors={errors.supplierId} /> )} /> - {errors?.supplierId && ( -
{errors.supplierId.message}
- )} +
{/* Billing Address */} @@ -209,8 +202,8 @@ const PurchasePartyDetails = () => { diff --git a/src/components/purchase/PurchasePaymentDetails.jsx b/src/components/purchase/PurchasePaymentDetails.jsx index b39f8d0e..0d461248 100644 --- a/src/components/purchase/PurchasePaymentDetails.jsx +++ b/src/components/purchase/PurchasePaymentDetails.jsx @@ -93,7 +93,7 @@ const PurchasePaymentDetails = () => { id="transportCharges" type="number" className="form-control form-control-md" - {...register("transportCharges")} + {...register("transportCharges",{ valueAsNumber: true })} /> {errors?.transportCharges && ( diff --git a/src/components/purchase/PurchaseSchema.jsx b/src/components/purchase/PurchaseSchema.jsx index 83fd88f8..9322bdc5 100644 --- a/src/components/purchase/PurchaseSchema.jsx +++ b/src/components/purchase/PurchaseSchema.jsx @@ -49,7 +49,7 @@ export const PurchaseSchema = z.object({ proformaInvoiceNumber: z.string().nullable(), proformaInvoiceDate: z.coerce.date().nullable(), - proformaInvoiceAmount: z.number().optional(), + proformaInvoiceAmount: z.coerce.number().optional(), invoiceNumber: z.string().nullable(), invoiceDate: z.coerce.date().nullable(), @@ -66,7 +66,7 @@ export const PurchaseSchema = z.object({ transportCharges: z.number().nullable(), description: z.string().min(1, { message: "Description is required" }), - attachments: z.array(AttachmentSchema([], 25)).optional(), + // attachments: z.array(AttachmentSchema([], 25)).optional(), }); // deliveryChallanNo: z @@ -88,7 +88,7 @@ export const defaultPurchaseValue = { proformaInvoiceNumber: null, proformaInvoiceDate: null, - proformaInvoiceAmount: null, + proformaInvoiceAmount: 0, invoiceNumber: null, invoiceDate: null, @@ -105,7 +105,7 @@ export const defaultPurchaseValue = { transportCharges: null, description: "", - attachments: [], + // attachments: [], }; export const getStepFields = (stepIndex) => {