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:
@@ -3905,6 +3905,13 @@ body {
|
|||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.log-recipe-note {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin-top: 2px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-log-undo {
|
.btn-log-undo {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
background: none;
|
background: none;
|
||||||
|
|||||||
+7
-2
@@ -8112,7 +8112,9 @@ async function loadLog(more = false) {
|
|||||||
const locLabels = { 'frigo': '🧊 Frigo', 'freezer': '❄️ Freezer', 'dispensa': '🗄️ Dispensa' };
|
const locLabels = { 'frigo': '🧊 Frigo', 'freezer': '❄️ Freezer', 'dispensa': '🗄️ Dispensa' };
|
||||||
const locStr = t.type === 'bring' ? '' : (locLabels[loc] || ('📍 ' + loc));
|
const locStr = t.type === 'bring' ? '' : (locLabels[loc] || ('📍 ' + loc));
|
||||||
const isAnnotation = (t.notes || '').includes('[Annullato]');
|
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;
|
const undone = t.undone == 1 || isAnnotation;
|
||||||
|
|
||||||
// Can undo if within 24h, not already undone, not a bring entry, not a counter-transaction
|
// 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-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-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 += `<div class="log-detail">${typeLabel} ${t.type !== 'bring' ? (t.quantity + ' ' + (t.unit || '')) + ' · ' : ''}${locStr}${notes} · ${timeStr}</div>`;
|
||||||
|
html += recipeNote;
|
||||||
html += `</div>`;
|
html += `</div>`;
|
||||||
if (canUndo) {
|
if (canUndo) {
|
||||||
html += `<button class="btn-log-undo" onclick="undoTransactionEntry(${t.id}, '${escapeHtml(t.type)}', '${escapeHtml(t.name || '')}')" title="Annulla questa operazione">↩</button>`;
|
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 = '⏳...';
|
btn.textContent = '⏳...';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const recipeTitle = _cachedRecipe?.recipe?.title || '';
|
||||||
const result = await api('inventory_use', {}, 'POST', {
|
const result = await api('inventory_use', {}, 'POST', {
|
||||||
product_id: productId,
|
product_id: productId,
|
||||||
quantity: qty,
|
quantity: qty,
|
||||||
use_all: useAll,
|
use_all: useAll,
|
||||||
location: location
|
location: location,
|
||||||
|
notes: recipeTitle ? `Ricetta: ${recipeTitle}` : '',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|||||||
+1
-1
@@ -1144,7 +1144,7 @@
|
|||||||
<span class="nav-label" data-i18n="nav.shopping">Spesa</span>
|
<span class="nav-label" data-i18n="nav.shopping">Spesa</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="nav-btn" onclick="showPage('log')" data-page="log">
|
<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>
|
<span class="nav-label" data-i18n="nav.log">Storico</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="nav-btn" onclick="showPage('settings')" data-page="settings">
|
<button class="nav-btn" onclick="showPage('settings')" data-page="settings">
|
||||||
|
|||||||
Reference in New Issue
Block a user