diff --git a/api/orders/listForKDS.cfm b/api/orders/listForKDS.cfm index 65daded..c73b855 100644 --- a/api/orders/listForKDS.cfm +++ b/api/orders/listForKDS.cfm @@ -126,7 +126,8 @@ i.IsCheckedByDefault, i.IsInvertedGroup, i.StationID, - parent.Name AS ItemParentName + parent.Name AS ItemParentName, + COALESCE(parent.IsInvertedGroup, 0) AS ParentIsInvertedGroup FROM OrderLineItems oli INNER JOIN Items i ON i.ID = oli.ItemID LEFT JOIN Items parent ON parent.ID = i.ParentItemID @@ -149,15 +150,20 @@ "ItemParentName": qLineItems.ItemParentName, "IsCheckedByDefault": qLineItems.IsCheckedByDefault, "IsInvertedGroup": qLineItems.IsInvertedGroup, + "ParentIsInvertedGroup": qLineItems.ParentIsInvertedGroup, "StationID": qLineItems.StationID, "StatusID": val(qLineItems.StatusID) })> + + - - + + + + + diff --git a/kds/kds.js b/kds/kds.js index 9370d81..15f4da4 100644 --- a/kds/kds.js +++ b/kds/kds.js @@ -408,20 +408,21 @@ function renderAllModifiers(modifiers, allItems) { function collectLeafModifiers(mods, depth = 0) { mods.forEach(mod => { // Inverted groups: show removed defaults with "NO" prefix instead of listing all selected defaults - if (mod.IsInvertedGroup || mod.ISINVERTEDGROUP) { + // Check both the item itself (if group header is in order) and proxy (first child carries the data) + const isInverted = mod.IsInvertedGroup || mod.ISINVERTEDGROUP || mod.IsInvertedGroupProxy || mod.ISINVERTEDGROUPPROXY; + if (isInverted) { const removed = mod.RemovedDefaults || mod.REMOVEDDEFAULTS || []; if (removed.length > 0) { + const groupName = mod.ItemParentName || mod.Name; removed.forEach(name => { - leafModifiers.push({ mod: { Name: 'NO ' + name, ItemParentName: mod.Name }, path: [] }); + leafModifiers.push({ mod: { Name: 'NO ' + name, ItemParentName: groupName }, path: [] }); }); } return; } - // Skip default modifiers only inside non-inverted groups - // (Inverted groups are already handled above with "NO" prefix) - // For regular groups, show all selected modifiers including defaults - + // Skip default modifiers inside inverted groups — handled above with "NO" prefix + if (mod.IsCheckedByDefault && (mod.ParentIsInvertedGroup || mod.PARENTISINVERTEDGROUP)) return; const children = allItems.filter(item => item.ParentOrderLineItemID === mod.OrderLineItemID); if (children.length === 0) {