From 628548a50972b10f64c0201eb9622d48c0c9816f Mon Sep 17 00:00:00 2001 From: suryacp23 Date: Thu, 16 Jul 2026 12:51:19 +0530 Subject: [PATCH] new form --- .../forms/fields/SmartGridField.tsx | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/components/forms/fields/SmartGridField.tsx b/src/components/forms/fields/SmartGridField.tsx index 431717e..51ab648 100644 --- a/src/components/forms/fields/SmartGridField.tsx +++ b/src/components/forms/fields/SmartGridField.tsx @@ -22,7 +22,15 @@ export function SmartGridField({ const [editingIdx, setEditingIdx] = useState(null); const visibleColumns = columns.filter(c => { - return true; // Temporarily show all columns for debugging + const isOrderDetails = label.toLowerCase().includes('order'); + if (isOrderDetails) { + const n = (c.name || '').toLowerCase(); + const id = (c.id || '').toLowerCase(); + // Show only Category, Name, and Bags + return n.includes('category') || n.includes('name') || n.includes('bags') || + id.includes('category') || id.includes('name') || id.includes('bags'); + } + return true; }); const removeRow = (idx: number) => { @@ -202,12 +210,15 @@ export function SmartGridField({ )} - - - setIsModalOpen(false)} title={editingIdx !== null ? "Edit Row" : "Add Row"} width="sm"> -
{ e.preventDefault(); e.stopPropagation(); submitNewRow(); }} className="flex flex-col gap-4"> +
+

+ {editingIdx !== null ? ( + <> Edit Row + ) : ( + <>Add New Item + )} +

+
{visibleColumns.map(col => { const val = newRow[col.id]; if (col.data_type === 'select' || col.data_type === 'multiselect') { @@ -261,12 +272,19 @@ export function SmartGridField({ /> ); })} -
- - + +
+ {editingIdx !== null && ( + + )} +
- - +
+
); }