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"
},