20260316e: Fix quick recipe + use from opened packages first
- Quick recipe: prompt now specifies 1 persona, excludes freezer products - USE form: auto-selects location with opened package as default (deducts from already-opened packages before sealed ones) - Move-after-use modal verified working (shows after partial use)
This commit is contained in:
+10
-3
@@ -936,7 +936,7 @@ function quickRecipeSuggestion() {
|
|||||||
// Navigate to chat and auto-send a prompt about expiring products
|
// Navigate to chat and auto-send a prompt about expiring products
|
||||||
showPage('chat');
|
showPage('chat');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.getElementById('chat-input').value = 'Suggeriscimi una ricetta veloce usando i prodotti che scadono prima!';
|
document.getElementById('chat-input').value = 'Suggeriscimi una ricetta veloce PER UNA PERSONA usando i prodotti che scadono prima! Ignora i prodotti in freezer (hanno scadenze molto lunghe), concentrati su frigo e dispensa.';
|
||||||
sendChatMessage();
|
sendChatMessage();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
@@ -3341,8 +3341,15 @@ async function loadUseInventoryInfo() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-select the first available location and show only relevant location buttons
|
// Auto-select the location with an opened package first (use from opened before sealed)
|
||||||
const firstLoc = items[0].location;
|
const openedItem = items.find(i => {
|
||||||
|
const q = parseFloat(i.quantity);
|
||||||
|
const dq = parseFloat(i.default_quantity) || 0;
|
||||||
|
if (i.unit === 'conf' && dq > 0) return q !== Math.floor(q);
|
||||||
|
if (dq > 0) return Math.abs(q - Math.round(q / dq) * dq) > dq * 0.02;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
const firstLoc = openedItem ? openedItem.location : items[0].location;
|
||||||
document.getElementById('use-location').value = firstLoc;
|
document.getElementById('use-location').value = firstLoc;
|
||||||
|
|
||||||
// Build location buttons only for locations where the product exists
|
// Build location buttons only for locations where the product exists
|
||||||
|
|||||||
+1
-1
@@ -911,6 +911,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="assets/js/app.js?v=20260316d"></script>
|
<script src="assets/js/app.js?v=20260316e"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user