From 11a703d274ea3e5c495bbf4441c452b2c2981c34 Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Thu, 19 Mar 2026 13:18:35 +0000 Subject: [PATCH] 20260319a: Auto-refresh recipe archive after save, Bring spec uses product name not brand --- api/index.php | 4 ++-- assets/js/app.js | 11 +++++------ data/dispensa.db | Bin 217088 -> 221184 bytes index.html | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/api/index.php b/api/index.php index 0c2ea96..33659dc 100644 --- a/api/index.php +++ b/api/index.php @@ -742,8 +742,8 @@ function useFromInventory(PDO $db): void { // Already on the list, skip adding $addedToBring = false; } else { - // Build specification from brand - $spec = $product['brand'] ? $product['brand'] : ''; + // Build specification from product name (variant info, not brand) + $spec = $product['name'] ? $product['name'] : ''; $body = http_build_query([ 'uuid' => $listUUID, 'purchase' => $bringName, diff --git a/assets/js/app.js b/assets/js/app.js index 3512314..0d1ab5c 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -3497,7 +3497,6 @@ function isLowStock(totalRemaining, unit, defaultQty) { function showLowStockBringPrompt(result, afterCallback) { const name = result.product_name || currentProduct?.name || ''; - const brand = result.product_brand || currentProduct?.brand || ''; const unit = result.product_unit || currentProduct?.unit || 'pz'; const defaultQty = result.product_default_qty || parseFloat(currentProduct?.default_quantity) || 0; const totalRemaining = result.total_remaining; @@ -3517,19 +3516,18 @@ function showLowStockBringPrompt(result, afterCallback) { remainLabel = `${Number.isInteger(totalRemaining) ? totalRemaining : totalRemaining.toFixed(1)} ${unitLabels[unit] || unit}`; } - // Build specification from brand for Bring - const spec = brand || ''; + // Build specification from product name (not brand) for Bring + const spec = name || ''; window._lowStockAfterCallback = afterCallback; window._lowStockSpec = spec; - const brandNote = brand ? ` (${escapeHtml(brand)})` : ''; document.getElementById('modal-content').innerHTML = `
-

${escapeHtml(name)}${brandNote} sta per finire — rimangono solo ${remainLabel}.

+

${escapeHtml(name)} sta per finire — rimangono solo ${remainLabel}.

Vuoi aggiungerlo alla lista della spesa?

- +