From 3901113e76267bf9b5e83ee0473eca4440373c31 Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Sat, 18 Apr 2026 19:12:07 +0000 Subject: [PATCH] fix: Storico nav icon, recipe title in transaction notes and log display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - index.html: replace broken byte with ๐Ÿ“‹ emoji in Storico nav button - submitRecipeUse: pass 'Ricetta: ' as notes to inventory_use API so every ingredient use is linked to the recipe in the DB - loadLog: render recipe note as small italic line ๐Ÿณ below log-detail row - style.css: add .log-recipe-note style (0.75rem, muted, italic) --- assets/css/style.css | 7 +++++++ assets/js/app.js | 9 +++++++-- index.html | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 2108892..9efb0c8 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -3905,6 +3905,13 @@ body { margin-left: 4px; } +.log-recipe-note { + font-size: 0.75rem; + color: var(--text-muted); + margin-top: 2px; + font-style: italic; +} + .btn-log-undo { flex-shrink: 0; background: none; diff --git a/assets/js/app.js b/assets/js/app.js index 6eb308d..e1d8b2e 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -8112,7 +8112,9 @@ async function loadLog(more = false) { const locLabels = { 'frigo': '๐ŸงŠ Frigo', 'freezer': 'โ„๏ธ Freezer', 'dispensa': '๐Ÿ—„๏ธ Dispensa' }; const locStr = t.type === 'bring' ? '' : (locLabels[loc] || ('๐Ÿ“ ' + loc)); const isAnnotation = (t.notes || '').includes('[Annullato]'); - const notes = t.notes && !isAnnotation ? ` ยท ${t.notes}` : ''; + const isRecipeNote = !isAnnotation && (t.notes || '').startsWith('Ricetta:'); + const notes = t.notes && !isAnnotation && !isRecipeNote ? ` ยท ${t.notes}` : ''; + const recipeNote = isRecipeNote ? `<div class="log-recipe-note">๐Ÿณ ${escapeHtml(t.notes)}</div>` : ''; const undone = t.undone == 1 || isAnnotation; // Can undo if within 24h, not already undone, not a bring entry, not a counter-transaction @@ -8124,6 +8126,7 @@ async function loadLog(more = false) { html += `<div class="log-info">`; html += `<div class="log-product"><strong>${escapeHtml(t.name)}</strong>${brand}${undone ? ' <span class="log-undone-badge">Annullato</span>' : ''}</div>`; html += `<div class="log-detail">${typeLabel} ${t.type !== 'bring' ? (t.quantity + ' ' + (t.unit || '')) + ' ยท ' : ''}${locStr}${notes} ยท ${timeStr}</div>`; + html += recipeNote; html += `</div>`; if (canUndo) { html += `<button class="btn-log-undo" onclick="undoTransactionEntry(${t.id}, '${escapeHtml(t.type)}', '${escapeHtml(t.name || '')}')" title="Annulla questa operazione">โ†ฉ</button>`; @@ -8769,11 +8772,13 @@ async function submitRecipeUse(useAll) { btn.textContent = 'โณ...'; try { + const recipeTitle = _cachedRecipe?.recipe?.title || ''; const result = await api('inventory_use', {}, 'POST', { product_id: productId, quantity: qty, use_all: useAll, - location: location + location: location, + notes: recipeTitle ? `Ricetta: ${recipeTitle}` : '', }); if (result.success) { diff --git a/index.html b/index.html index aae6762..a7a7a17 100644 --- a/index.html +++ b/index.html @@ -1144,7 +1144,7 @@ <span class="nav-label" data-i18n="nav.shopping">Spesa</span> </button> <button class="nav-btn" onclick="showPage('log')" data-page="log"> - <span class="nav-icon">๏ฟฝ</span> + <span class="nav-icon">๐Ÿ“‹</span> <span class="nav-label" data-i18n="nav.log">Storico</span> </button> <button class="nav-btn" onclick="showPage('settings')" data-page="settings">