feat: keep qty=0 instead of auto-delete, ask user to confirm via banner

- useFromInventory: replace DELETE with UPDATE qty=0 when stock hits 0
  (both normal path and use-all-locations path)
- listInventory: add WHERE quantity > 0 so qty=0 rows are invisible in
  the regular inventory list
- New API actions: inventory_finished_items (query) and
  inventory_confirm_finished (delete after user confirms)
- Banner: new 'finished' type (priority 600, above anomalies)
  Shows: '{name} — è finito?' with two buttons
  'Sì, è finito' → permanently deletes the qty=0 row
  'No, ne ho ancora' → navigates to add-inventory form
- i18n: banner_finished_* and toast.product_finished_confirmed (it/en/de)
- DB migration: restored 75 auto-deleted products (last 30 days) as
  qty=0 inventory rows so they appear in the banner queue
This commit is contained in:
dadaloop82
2026-04-27 05:41:38 +00:00
parent 37299e60c9
commit 5df0be1661
5 changed files with 118 additions and 7 deletions
+6 -1
View File
@@ -105,7 +105,11 @@
"banner_expiring_today": "Scade oggi!",
"banner_expiring_tomorrow": "Scade domani",
"banner_expiring_days": "Scade tra {days} giorni",
"banner_expiring_action_use": "Usa ora"
"banner_expiring_action_use": "Usa ora",
"banner_finished_title": "è finito?",
"banner_finished_detail": "Ho registrato che {name} ha toccato quota zero. È davvero finito o hai ancora delle scorte?",
"banner_finished_action_yes": "Sì, è finito",
"banner_finished_action_no": "No, ne ho ancora"
},
"inventory": {
"title": "Dispensa",
@@ -426,6 +430,7 @@
"finished_to_bring": "🛒 Prodotto finito → aggiunto a Bring!",
"thrown_away": "🗑️ {name} buttato!",
"thrown_away_partial": "🗑️ Buttato {qty} {unit} di {name}",
"product_finished_confirmed": "✅ Rimosso — riaggiungi quando ne ricompri",
"appliance_added": "Elettrodomestico aggiunto",
"item_added": "{name} aggiunto"
},