fix: TTS only on Rileggi btn; use-all deducts from all locations

Cooking mode TTS:
- Removed auto-speak from renderCookingStep() entirely
- TTS now fires ONLY when user presses 'Rileggi' (replayCookingTTS)
- Timer-expiry TTS unchanged (still speaks when a cooking timer expires)

submitUseAll fix:
- Changed location from selected-location to '__all__'
- 'Usato TUTTO / Finito' means the product is completely consumed;
  using a specific location could fail with a 404 if the async
  loadUseInventoryInfo() hadn't yet updated the selector (race condition)
- The __all__ path in PHP removes inventory across every location
This commit is contained in:
dadaloop82
2026-04-06 10:23:03 +00:00
parent 4e8b586201
commit b47dcb4fac
+3 -3
View File
@@ -4044,7 +4044,7 @@ async function submitUseAll() {
const result = await api('inventory_use', {}, 'POST', {
product_id: currentProduct.id,
use_all: true,
location: document.getElementById('use-location').value,
location: '__all__',
});
showLoading(false);
if (result.success) {
@@ -6934,8 +6934,8 @@ function renderCookingStep() {
// Timer: detect duration in step text and show suggestion
setupCookingTimerSuggestion(cleanStep);
// Speak step
if (_cookingTTS) speakCookingStep(cleanStep);
// TTS: only speak when explicitly requested via "Rileggi" button
// (auto-speak removed — use replayCookingTTS() to trigger manually)
}
function _buildTtsRequest(text, s) {