Commit Graph

1066 Commits

Author SHA1 Message Date
dadaloop82 3f4d1bd194 Aggiunta ricerca rapida per nome prodotto (frutta/verdura sfusa) 2026-03-10 13:04:53 +00:00
dadaloop82 24dd88b5cf Add daily automatic database backup to GitHub
- Remove data/ from .gitignore (keep WAL/SHM excluded)
- Add backup.sh script: commits and pushes DB changes daily
- Cron job at 3:00 AM: /var/www/html/dispensa/backup.sh
- Include initial database snapshot
2026-03-10 12:38:20 +00:00
dadaloop82 c6c000bbc2 Make expired/expiring items clickable for edit/delete
- Tap on any expired or expiring item opens the detail modal
- From the modal: edit quantity/location/expiry, delete, or use
- Same behavior as regular inventory items
- Added showAlertItemDetail() function (loads inventory then shows modal)
- Visual feedback on tap (scale + highlight)
2026-03-10 12:27:53 +00:00
dadaloop82 cc9fd2cbed 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
2026-03-10 12:25:23 +00:00
dadaloop82 eb46f44eba AI product identification with Gemini + dashboard layout fix
AI Identification:
- Rewrite analyzeWithAI() to use Gemini API for real image analysis
- Auto-start analysis immediately after taking photo (no manual button)
- Gemini identifies product name, brand, category from photo
- Reverse search on Open Food Facts to find matching barcoded products
- User can select a match to import full product data with barcode
- Or save product directly without barcode
- New API endpoint: gemini_identify with OFF reverse search

Dashboard:
- Move 🚫 Scaduti section to TOP of dashboard
- Show only top 4 soonest expiring items below
- Limit API query to 4 results
2026-03-10 12:20:57 +00:00
dadaloop82 b548f2fe66 Fix expiring section: show soonest 10 items instead of 7-day window
- Change query from 7-day threshold to soonest 10 items with expiry
- Section now always visible when items have expiry dates
- Improved badges: OGGI, Domani, N giorni, Ng, ~N mesi
- Color coding: red (today), orange (≤7d), yellow (≤30d), grey (>30d)
- Renamed section to 'Prossime Scadenze'
2026-03-10 12:15:08 +00:00
dadaloop82 0e2287d1e3 Replace scan button in nav with AI recipe generator
- Remove camera/scan button from bottom nav (scan stays in header)
- Add 🍳 Ricetta button with prominent styling in bottom nav
- Auto-detect meal type based on time of day (colazione/pranzo/cena)
- Ask number of persons (default 1)
- Generate recipe via Gemini AI using pantry ingredients
- Prioritize expiring/expired items in recipe suggestions
- Focus on healthy, balanced meals
- Full recipe with ingredients list and step-by-step procedure
- Show prep/cook time, tags, nutrition notes, expiry warnings
- Mark ingredients as from pantry () or extra (🛒)
2026-03-10 12:12:09 +00:00
dadaloop82 c015b5b623 Fix category mapping: use product name for ambiguous OF tags
- Rewrite mapToLocalCategory() to accept product name as 2nd param
- Add guessCategoryFromName() for Italian product name-based detection
- Handle 'plant-based-foods-and-beverages' tag via name guessing
  (was incorrectly matching beverage regex for pasta, pane, etc.)
- Handle 'sweeteners' tag → condimenti
- Move generic beverage regex to last position with plant-based exclusion
- Update all 9 call sites to pass product name
2026-03-10 12:03:06 +00:00
dadaloop82 dd48685fb7 Group inventory by category, allow editing unknown products
- Add mapToLocalCategory() to map Open Food Facts tags (en:plant-based-foods...) to local categories (pasta, bevande, etc.)
- Add CATEGORY_LABELS for nice Italian display names with emoji icons
- Dashboard: items within each location section are now grouped by category with headers and count badges
- Inventory list: items grouped by category with collapsible headers
- renderGroupedByCategory() shared between dashboard and inventory views
- All CATEGORY_ICONS lookups now use mapToLocalCategory for consistent display
- When scanning returns 'Prodotto sconosciuto' or product has missing info: show inline edit form with name, brand, category fields on the action page
- saveEditedProductInfo() saves changes to DB and refreshes the action page
- New CSS: .cat-group-header, .cat-group-count, .edit-unknown-card styles
2026-03-10 11:59:15 +00:00
dadaloop82 26cc00d994 Fix overlay blocking nav, add header scan button, fix qty defaults, improve expiry UI
- Toast: add pointer-events:none when hidden to prevent invisible overlay blocking bottom nav
- Header: add prominent camera/scan button (📷) in top-right corner with pulse animation
- Product defaults: auto-fix products saved with 'pz/1' that have weight info in notes (re-detects unit/qty from Peso field and updates DB)
- Expiry sections: show relative days ('3 giorni', 'Domani', 'Scaduto da 5 giorni') instead of absolute dates
- Inventory list + dashboard items: use relative expiry labels
- New CSS: alert-item cards with badges, expiring/expired color-coded badges
- Added daysUntilExpiry() utility function
2026-03-10 11:53:44 +00:00
dadaloop82 0104b422e4 Fix Usa and Modifica buttons in product detail modal
- quickUse: add try/catch error handling, loading state, weight_info extraction, loadUseInventoryInfo() call
- editInventoryItem: replace modal content in-place instead of close/reopen pattern (avoids animation race condition), add error feedback when item not found
2026-03-10 11:41:48 +00:00
dadaloop82 df193f982d Fix: quantità predefinita ora mostra il peso della confezione
- Scansionando un prodotto, la quantità default è il peso/volume reale
  (es. Passata → 700g, Ichnusa → 660ml, Cracker → 500g)
- Multi-pack calcolano il totale (6x200ml → 1200ml)
- Aggiornati tutti i prodotti esistenti nel database
2026-03-10 11:27:37 +00:00
dadaloop82 c735cacf37 Aggiunto campo per inserire codice a barre manualmente
- Nuovo campo numerico nella pagina scansione per digitare il barcode
- Supporto tasto Invio per ricerca rapida
- Validazione: solo numeri, 4-14 cifre
- Riusa lo stesso flusso della scansione automatica (onBarcodeDetected)
2026-03-10 11:25:41 +00:00
dadaloop82 1bbecd7cc9 Fix: prodotti riconosciuti ora hanno unità predefinita 'pz' (pezzi) invece di grammi
- detectUnitAndQuantity ora restituisce unit='pz' per prodotti confezionati
  (es. 500g → 1 pz, non 1 g; 6x200ml → 1 pz, non 6 ml)
- Il peso della confezione viene mostrato come info separata
- Corretti prodotti esistenti nel DB con unità/quantità sbagliate
- Corrette quantità inventario (690 pz passata → 1 pz, ecc.)
- Estratto weight_info dalle note quando prodotto viene riscansionato dal DB locale
2026-03-10 11:24:26 +00:00
dadaloop82 706c8aeae0 Fix: camera scadenza più piccola con zoom 2x, quantità non si resetta più, nomi prodotti in lingua corretta
- Ridotto il frame della camera scadenza a 180px con zoom 2x e crop centrale
- Fix: premere 'Appena comprato' / 'Ce l'avevo già' non modifica più la quantità
- Fix: nomi prodotti in script non-latino vengono sostituiti con alternative leggibili
- Corretto nome prodotto 'Celozrnný toastový chléb' → 'Sandwich American Style'
- Migliorato ordine fallback nomi: product_name_it → generic_name_it → product_name
2026-03-10 11:20:43 +00:00
dadaloop82 70ee253a07 Initial commit: Dispensa - home pantry management app
Features:
- Barcode scanning (QuaggaJS) + Open Food Facts API lookup
- Inventory management with locations (Frigo, Freezer, Dispensa)
- Product database with Italian product suggestions
- Expiry date estimation by category
- AI expiry date reading via Gemini Vision API
- Flexible unit of measure (pz, conf, g, kg, ml, L)
- Nutriscore/NOVA/Ecoscore/allergens display
- Mobile-first PWA with offline support
- SQLite backend with PHP REST API
2026-03-10 10:52:18 +00:00