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": "Läuft heute ab!",
"banner_expiring_tomorrow": "Läuft morgen ab",
"banner_expiring_days": "Läuft in {days} Tagen ab",
"banner_expiring_action_use": "Jetzt verwenden"
"banner_expiring_action_use": "Jetzt verwenden",
"banner_finished_title": "aufgebraucht?",
"banner_finished_detail": "Ich habe vermerkt, dass {name} auf null gesunken ist. Ist es wirklich leer, oder hast du noch welches?",
"banner_finished_action_yes": "Ja, aufgebraucht",
"banner_finished_action_no": "Nein, ich habe noch welches"
},
"inventory": {
"title": "Vorrat",
@@ -426,6 +430,7 @@
"finished_to_bring": "🛒 Produkt aufgebraucht → zu Bring! hinzugefügt",
"thrown_away": "🗑️ {name} weggeworfen!",
"thrown_away_partial": "🗑️ {qty} {unit} von {name} weggeworfen",
"product_finished_confirmed": "✅ Entfernt — wieder hinzufügen, wenn du nachkaufst",
"appliance_added": "Gerät hinzugefügt",
"item_added": "{name} hinzugefügt"
},
+6 -1
View File
@@ -105,7 +105,11 @@
"banner_expiring_today": "Expires today!",
"banner_expiring_tomorrow": "Expires tomorrow",
"banner_expiring_days": "Expires in {days} days",
"banner_expiring_action_use": "Use now"
"banner_expiring_action_use": "Use now",
"banner_finished_title": "finished?",
"banner_finished_detail": "I recorded that {name} reached zero stock. Is it really gone, or do you still have some?",
"banner_finished_action_yes": "Yes, it's done",
"banner_finished_action_no": "No, I still have some"
},
"inventory": {
"title": "Pantry",
@@ -426,6 +430,7 @@
"finished_to_bring": "🛒 Product finished → added to Bring!",
"thrown_away": "🗑️ {name} thrown away!",
"thrown_away_partial": "🗑️ Thrown away {qty} {unit} of {name}",
"product_finished_confirmed": "✅ Removed — add it again when you restock",
"appliance_added": "Appliance added",
"item_added": "{name} added"
},
+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"
},