Add safety badges for expired products

- 🗑️ Buttare (red): perishable items (latticini, carne, pesce, frutta,
  verdura) expired >2 days, or any items expired >6 months
- 👀 Controlla (yellow): semi-perishable (pane, surgelati) within 30 days,
  or long-shelf items 1-6 months past, or fresh items just expired in frigo
-  OK (green): long-shelf items (pasta, conserve, condimenti, cereali,
  snack) within 30 days of TMC date
- Tooltip on hover explains the safety recommendation
- Added p.category to expired items SQL query
- Safety logic uses mapToLocalCategory + location + days expired
This commit is contained in:
dadaloop82
2026-03-10 12:25:23 +00:00
parent eb46f44eba
commit cc9fd2cbed
3 changed files with 90 additions and 7 deletions
+33
View File
@@ -310,6 +310,39 @@ body {
color: #fff;
}
/* Safety badges for expired items */
.alert-item-badges {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 4px;
flex-shrink: 0;
}
.safety-badge {
font-size: 0.72rem;
font-weight: 700;
padding: 3px 8px;
border-radius: 12px;
white-space: nowrap;
cursor: help;
}
.safety-badge.safety-danger {
background: #dc3545;
color: #fff;
}
.safety-badge.safety-warning {
background: #ffc107;
color: #333;
}
.safety-badge.safety-ok {
background: #28a745;
color: #fff;
}
/* ===== SECTION CARD ===== */
.section-card {
background: var(--bg-card);