diff --git a/api/index.php b/api/index.php index 94584c0..7b167e9 100644 --- a/api/index.php +++ b/api/index.php @@ -857,6 +857,12 @@ PROMPT; $ing['product_id'] = (int)$bestMatch['product_id']; $ing['location'] = $bestMatch['location']; $ing['available_qty'] = $bestMatch['quantity'] . ' ' . $bestMatch['unit']; + if (!empty($bestMatch['brand'])) { + $ing['brand'] = $bestMatch['brand']; + } + if (!empty($bestMatch['expiry_date'])) { + $ing['expiry_date'] = $bestMatch['expiry_date']; + } } } } diff --git a/assets/css/style.css b/assets/css/style.css index 37742d6..4fc9fc1 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -2088,6 +2088,12 @@ body { opacity: 0.5; } +.recipe-ing-detail { + color: var(--text-muted); + font-size: 0.78rem; + line-height: 1.3; +} + /* ===== AI IDENTIFICATION RESULTS ===== */ .ai-identified-card { background: var(--bg-light); diff --git a/assets/js/app.js b/assets/js/app.js index 1e43f31..cfd11ad 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -2728,7 +2728,22 @@ function renderRecipe(r) { const qtyNum = ing.qty_number || 0; const loc = (ing.location || 'dispensa').replace(/'/g, "\\'"); html += `
  • `; - html += `${ing.name}: ${ing.qty} โœ…`; + html += `${ing.name}${ing.brand ? ' (' + ing.brand + ')' : ''}: ${ing.qty} โœ…`; + // Detail line: location + expiry + let details = []; + const locLabels = { 'frigo': '๐ŸงŠ Frigo', 'freezer': '๐ŸงŠ Freezer', 'dispensa': '๐Ÿ—„๏ธ Dispensa' }; + details.push(locLabels[ing.location] || ('๐Ÿ“ ' + ing.location)); + if (ing.expiry_date) { + const exp = new Date(ing.expiry_date); + const now = new Date(); now.setHours(0,0,0,0); + const diffDays = Math.round((exp - now) / 86400000); + if (diffDays < 0) details.push(`โ›” Scaduto da ${Math.abs(diffDays)}g`); + else if (diffDays <= 3) details.push(`๐Ÿ”ด Scade tra ${diffDays}g`); + else if (diffDays <= 7) details.push(`๐ŸŸก Scade tra ${diffDays}g`); + else details.push(`๐Ÿ“… ${exp.toLocaleDateString('it-IT')}`); + } + if (details.length) html += `
    ${details.join(' ยท ')}`; + html += `
    `; html += ``; html += `
  • `; } else { diff --git a/data/dispensa.db b/data/dispensa.db index 2d7597f..89649c4 100644 Binary files a/data/dispensa.db and b/data/dispensa.db differ