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
+1 -1
View File
@@ -524,7 +524,7 @@ function getStats(PDO $db): void {
// Expired
$expired = $db->query("
SELECT i.*, p.name, p.brand
SELECT i.*, p.name, p.brand, p.category
FROM inventory i JOIN products p ON i.product_id = p.id
WHERE i.expiry_date IS NOT NULL AND i.expiry_date < date('now')
ORDER BY i.expiry_date ASC