From f7efd4d9cc4672db65d69575aa64da368665122e Mon Sep 17 00:00:00 2001 From: suryacp23 Date: Wed, 22 Jul 2026 11:53:50 +0530 Subject: [PATCH] made required for the quantity and bags --- src/components/forms/fields/SmartGridField.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/forms/fields/SmartGridField.tsx b/src/components/forms/fields/SmartGridField.tsx index ef04f59..912664d 100644 --- a/src/components/forms/fields/SmartGridField.tsx +++ b/src/components/forms/fields/SmartGridField.tsx @@ -132,7 +132,10 @@ export function SmartGridField({ for (const col of visibleColumns) { const isProductName = col.id === 'product_name' || col.name === 'Product Name' || col.mapped_workflow_field === 'product_name' || getBaseId(col.id) === 'product_name'; const isBags = col.id === 'bags' || col.name === 'Bags' || col.mapped_workflow_field === 'bags' || getBaseId(col.id) === 'bags'; - const isRequired = col.mandatory || (isCatSelected && (isProductName || isBags)); + const isQuantity = col.id === 'quantity' || col.name === 'Quantity' || getBaseId(col.id) === 'quantity' || + col.id === 'actual_potential' || col.name === 'Actual Potential' || getBaseId(col.id) === 'actual_potential' || + col.id === 'store_potential' || col.name === 'Store Potential' || getBaseId(col.id) === 'store_potential'; + const isRequired = col.mandatory || (isCatSelected && (isProductName || isBags || isQuantity)); if (isRequired && !newRow[col.id]) { newErrors[col.id] = 'This field is required'; @@ -283,7 +286,10 @@ export function SmartGridField({ const isCatSelected = catColId ? !!newRow[catColId] : false; const isProductName = col.id === 'product_name' || col.name === 'Product Name' || col.mapped_workflow_field === 'product_name' || getBaseId(col.id) === 'product_name'; const isBags = col.id === 'bags' || col.name === 'Bags' || col.mapped_workflow_field === 'bags' || getBaseId(col.id) === 'bags'; - const isRequired = col.mandatory || (isCatSelected && (isProductName || isBags)); + const isQuantity = col.id === 'quantity' || col.name === 'Quantity' || getBaseId(col.id) === 'quantity' || + col.id === 'actual_potential' || col.name === 'Actual Potential' || getBaseId(col.id) === 'actual_potential' || + col.id === 'store_potential' || col.name === 'Store Potential' || getBaseId(col.id) === 'store_potential'; + const isRequired = col.mandatory || (isCatSelected && (isProductName || isBags || isQuantity)); if (col.data_type === 'select' || col.data_type === 'multiselect') { const allOpts = col.properties?.options || [];