diff --git a/assets/css/style.css b/assets/css/style.css index dfaf11e..029f453 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -2609,6 +2609,15 @@ body { border-radius: 8px; line-height: 1.3; } +.stat-price-total { + display: block; + font-size: 0.62rem; + font-weight: 600; + color: #15803d; + margin-top: 2px; + white-space: nowrap; + line-height: 1.2; +} /* ===== PRODUCT PREVIEW ===== */ .product-preview, .product-preview-small { diff --git a/assets/js/app.js b/assets/js/app.js index 8f4fedc..e238cfa 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -9001,6 +9001,7 @@ async function fetchAllPrices(forceRefresh = false) { if (totalEl) totalEl.textContent = pricesFound > 0 ? `ca. ${sym}${runningTotal.toFixed(2)}` : '–'; if (fetchBtn) fetchBtn.disabled = false; if (refreshBtn) { refreshBtn.disabled = false; refreshBtn.textContent = '🔄'; } + _updateDashboardPriceTotal(); } } @@ -9228,6 +9229,29 @@ function _updateSmartUrgencyBadge() { } } +function _updateDashboardPriceTotal() { + const el = document.getElementById('stat-price-total'); + if (!el) return; + const s = getSettings(); + if (!s.price_enabled || !shoppingItems.length) { el.style.display = 'none'; return; } + const sym = _currencySymbol(s.price_currency || 'EUR'); + const items = _buildPricePayload(); + let total = 0, count = 0; + for (const item of items) { + const e = _cachedPrices[item.name]; + if (e && e._qty === item.quantity && e._unit === item.unit && e.estimated_total != null) { + total += e.estimated_total; + count++; + } + } + if (count > 0) { + el.textContent = `ca. ${sym}${total.toFixed(2)}`; + el.style.display = ''; + } else { + el.style.display = 'none'; + } +} + /** * Sync the on_bring flag for every smartShoppingItem against the current shoppingItems list. * The server cache can be up to 10 min old so on_bring may be stale — this corrects it @@ -9579,6 +9603,7 @@ async function loadShoppingCount() { } } catch { /* ignore */ } } + _updateDashboardPriceTotal(); } /** diff --git a/index.html b/index.html index 970a153..22bbaba 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ EverShelf - + @@ -120,6 +120,7 @@ - Spesa + @@ -1461,6 +1462,6 @@ - + diff --git a/translations/de.json b/translations/de.json index 687121d..8deca3f 100644 --- a/translations/de.json +++ b/translations/de.json @@ -440,7 +440,7 @@ "use_data_no_barcode": "✅ KI-Daten verwenden (ohne Barcode)" }, "log": { - "title": "� Verlauf", + "title": "📒 Verlauf", "type_added": "Hinzugefügt", "type_waste": "Entsorgt", "type_used": "Verwendet", diff --git a/translations/it.json b/translations/it.json index 7bf0f2b..b6344d2 100644 --- a/translations/it.json +++ b/translations/it.json @@ -440,7 +440,7 @@ "use_data_no_barcode": "✅ Usa dati AI (senza barcode)" }, "log": { - "title": "� Storico", + "title": "📒 Storico", "type_added": "Aggiunto", "type_waste": "Buttato", "type_used": "Usato",