made required for the quantity and bags

This commit is contained in:
suryacp23 2026-07-22 11:53:50 +05:30
parent cbc9aab4c7
commit f7efd4d9cc

View File

@ -132,7 +132,10 @@ export function SmartGridField({
for (const col of visibleColumns) { 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 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 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]) { if (isRequired && !newRow[col.id]) {
newErrors[col.id] = 'This field is required'; newErrors[col.id] = 'This field is required';
@ -283,7 +286,10 @@ export function SmartGridField({
const isCatSelected = catColId ? !!newRow[catColId] : false; 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 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 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') { if (col.data_type === 'select' || col.data_type === 'multiselect') {
const allOpts = col.properties?.options || []; const allOpts = col.properties?.options || [];