feat(scale): auto-fill use-quantity live from scale reading

- _scaleAutoFillUse(): converts and fills use-quantity on stable readings
- _scaleLatestWeight pre-fills when use page opens (after unit is known)
- oninput on use-quantity pauses auto-fill when user types manually
- showUseForm() resets paused flag so next opening resumes auto-fill
- Small 'live' hint text shown while auto-filling, hidden when overridden
This commit is contained in:
dadaloop82
2026-04-15 21:06:12 +00:00
parent 6f5bc15734
commit d26229800c
2 changed files with 35 additions and 2 deletions
+4 -2
View File
@@ -293,9 +293,11 @@
<p id="use-partial-hint">Oppure specifica la quantità usata:</p>
<div class="qty-control">
<button type="button" class="qty-btn" id="use-qty-minus" onclick="adjustUseQty(-1)"></button>
<input type="number" id="use-quantity" value="1" min="0.1" step="any" class="qty-input">
<input type="number" id="use-quantity" value="1" min="0.1" step="any" class="qty-input"
oninput="_scaleAutoFillPaused=true; var h=document.getElementById('scale-autofill-hint'); if(h) h.style.display='none';">
<button type="button" class="qty-btn" id="use-qty-plus" onclick="adjustUseQty(1)">+</button>
</div>
<small id="scale-autofill-hint" style="display:none; color: var(--color-accent, #7c3aed); margin-top:4px; display:none">⚖️ Lettura live dalla bilancia</small>
<button type="submit" class="btn btn-large btn-warning full-width mt-2">📤 Usa questa quantità</button>
</div>
</div>
@@ -1237,6 +1239,6 @@
</div>
</div>
<script src="assets/js/app.js?v=20260415c"></script>
<script src="assets/js/app.js?v=20260415d"></script>
</body>
</html>