diff --git a/assets/js/app.js b/assets/js/app.js index cfd11ad..a2f89dd 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -2690,6 +2690,16 @@ async function useRecipeIngredient(idx, productId, location, qtyNumber, btn) { } btn.textContent = 'โ๏ธ Scalato'; btn.classList.add('btn-used'); + + // Persist used state in cached recipe + try { + const cached = JSON.parse(localStorage.getItem('cachedRecipe') || 'null'); + if (cached && cached.recipe && cached.recipe.ingredients && cached.recipe.ingredients[idx]) { + cached.recipe.ingredients[idx].used = true; + localStorage.setItem('cachedRecipe', JSON.stringify(cached)); + } + } catch (e) { /* ignore */ } + showToast('๐ฆ Ingrediente scalato dalla dispensa!', 'success'); } else { btn.disabled = false; @@ -2727,7 +2737,8 @@ function renderRecipe(r) { if (ing.from_pantry && ing.product_id) { const qtyNum = ing.qty_number || 0; const loc = (ing.location || 'dispensa').replace(/'/g, "\\'"); - html += `