fix: Storico nav icon, recipe title in transaction notes and log display

- index.html: replace broken byte with 📋 emoji in Storico nav button
- submitRecipeUse: pass 'Ricetta: <title>' 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)
This commit is contained in:
dadaloop82
2026-04-18 19:12:07 +00:00
parent 2edd5a6ebd
commit 3901113e76
3 changed files with 15 additions and 3 deletions
+7
View File
@@ -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;
+7 -2
View File
@@ -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) {
+1 -1
View File
@@ -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">