From ed89e74b9415bd78e60fbf60554e7b14dd157e0e Mon Sep 17 00:00:00 2001 From: dadaloop82 Date: Wed, 6 May 2026 05:22:49 +0000 Subject: [PATCH] fix: split Bimby/Cookeo appliances, add missing i18n keys, improve use_all dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .env: split 'Bimby/Moulinex Cookeo' into 'Bimby' and 'Moulinex Cookeo' - translations (it/en/de): add use_all_confirm_*, throw_all_confirm_*, confirm.cancel, confirm.proceed, location.dispensa/frigo/freezer - app.js: when ANY opened package exists, always show disambiguation dialog ('solo questa confezione?' vs 'tutto?') instead of silently finishing one — was previously showing dialog only for 2+ opened packages --- assets/js/app.js | 13 ++----------- translations/de.json | 17 +++++++++++++++-- translations/en.json | 17 +++++++++++++++-- translations/it.json | 17 +++++++++++++++-- 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index e0fb003..3e0e0e6 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -7234,21 +7234,12 @@ async function _doSubmitUseAll() { const currentLoc = document.getElementById('use-location')?.value || '__all__'; const items = _useCurrentItems.filter(i => parseFloat(i.quantity) > 0); - const openedAtCurrentLoc = items.find(i => i.location === currentLoc && _isOpenedInventoryItem(i)); const allOpened = items.filter(_isOpenedInventoryItem); let useLocation; - if (openedAtCurrentLoc) { - // Opened package at the currently selected location → finish only the opened item. - // The PHP backend fetches fractional (opened) rows first, so use_all on a specific - // location will clear the opened row and leave sealed packages untouched. - useLocation = currentLoc; - } else if (allOpened.length === 1) { - // One opened package somewhere else → almost certainly this is what the user means - useLocation = allOpened[0].location; - } else if (allOpened.length > 1) { - // Multiple opened packages at different locations → ask the user + if (allOpened.length >= 1) { + // One or more opened packages → always ask the user what they mean showLoading(false); _showUseAllDisambiguation(allOpened, items); return; diff --git a/translations/de.json b/translations/de.json index a160243..e0bc773 100644 --- a/translations/de.json +++ b/translations/de.json @@ -243,7 +243,13 @@ "toast_opened_finished": "🔓 Geöffnete Packung von {name} aufgebraucht!", "disambiguation_hint": "Was meinst du mit \"alles aufgebraucht\"?", "disambiguation_all": "🗑️ ALLES verbraucht ({qty})", - "error_exceeds_stock": "⚠️ Du kannst nicht mehr verwenden als du verfügbar hast!" + "error_exceeds_stock": "⚠️ Du kannst nicht mehr verwenden als du verfügbar hast!", + "use_all_confirm_title": "✅ Alles aufbrauchen", + "use_all_confirm_msg": "Bestätige, dass du das Produkt vollständig aufgebraucht hast:", + "use_all_confirm_btn": "✅ Ja, aufgebraucht", + "throw_all_confirm_title": "🗑️ Alles entsorgen", + "throw_all_confirm_msg": "Möchtest du wirklich das gesamte Produkt entsorgen?", + "throw_all_confirm_btn": "🗑️ Ja, entsorgen" }, "product": { "title_new": "Neues Produkt", @@ -746,7 +752,14 @@ }, "confirm": { "remove_item": "Möchtest du dieses Produkt wirklich aus dem Bestand entfernen?", - "kiosk_exit": "Kioskmodus verlassen?" + "kiosk_exit": "Kioskmodus verlassen?", + "cancel": "Abbrechen", + "proceed": "Bestätigen" + }, + "location": { + "dispensa": "Vorratskammer", + "frigo": "Kühlschrank", + "freezer": "Gefrierschrank" }, "edit": { "title": "{name} bearbeiten", diff --git a/translations/en.json b/translations/en.json index 4ee1f33..1c75e25 100644 --- a/translations/en.json +++ b/translations/en.json @@ -242,7 +242,13 @@ "toast_opened_finished": "🔓 Opened package of {name} finished!", "disambiguation_hint": "What do you mean by \"all done\"?", "disambiguation_all": "🗑️ Finish EVERYTHING ({qty})", - "error_exceeds_stock": "⚠️ You cannot use more than you have available!" + "error_exceeds_stock": "⚠️ You cannot use more than you have available!", + "use_all_confirm_title": "✅ Finish everything", + "use_all_confirm_msg": "Confirm that you have finished the product:", + "use_all_confirm_btn": "✅ Yes, finished", + "throw_all_confirm_title": "🗑️ Discard everything", + "throw_all_confirm_msg": "Do you really want to throw away the whole product?", + "throw_all_confirm_btn": "🗑️ Yes, discard" }, "product": { "title_new": "New Product", @@ -745,7 +751,14 @@ }, "confirm": { "remove_item": "Do you really want to remove this product from inventory?", - "kiosk_exit": "Exit kiosk mode?" + "kiosk_exit": "Exit kiosk mode?", + "cancel": "Cancel", + "proceed": "Confirm" + }, + "location": { + "dispensa": "Pantry", + "frigo": "Fridge", + "freezer": "Freezer" }, "edit": { "title": "Edit {name}", diff --git a/translations/it.json b/translations/it.json index 32757e4..8e38271 100644 --- a/translations/it.json +++ b/translations/it.json @@ -242,7 +242,13 @@ "toast_opened_finished": "🔓 Confezione aperta di {name} finita!", "disambiguation_hint": "Cosa intendi con \"finito tutto\"?", "disambiguation_all": "🗑️ Finito TUTTO ({qty})", - "error_exceeds_stock": "⚠️ Non puoi usare più di quanto hai disponibile!" + "error_exceeds_stock": "⚠️ Non puoi usare più di quanto hai disponibile!", + "use_all_confirm_title": "✅ Finisci tutto", + "use_all_confirm_msg": "Conferma che hai finito tutto il prodotto:", + "use_all_confirm_btn": "✅ Sì, finito", + "throw_all_confirm_title": "🗑️ Butta tutto", + "throw_all_confirm_msg": "Vuoi davvero buttare via tutto il prodotto?", + "throw_all_confirm_btn": "🗑️ Sì, butta" }, "product": { "title_new": "Nuovo Prodotto", @@ -745,7 +751,14 @@ }, "confirm": { "remove_item": "Vuoi davvero rimuovere questo prodotto dall'inventario?", - "kiosk_exit": "Uscire dalla modalità kiosk?" + "kiosk_exit": "Uscire dalla modalità kiosk?", + "cancel": "Annulla", + "proceed": "Conferma" + }, + "location": { + "dispensa": "Dispensa", + "frigo": "Frigo", + "freezer": "Freezer" }, "edit": { "title": "Modifica {name}",