diff --git a/frontend/app.js b/frontend/app.js index 26896f8..4cec52b 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -502,6 +502,11 @@ function setupEventListeners() { const dispenseQuantityInput = document.getElementById('dispenseQuantity'); if (dispenseQuantityInput) { + // Prevent accidental value changes when users scroll while focused. + dispenseQuantityInput.addEventListener('wheel', (event) => { + event.preventDefault(); + }, { passive: false }); + dispenseQuantityInput.addEventListener('input', () => { const mode = getSelectedDispenseMode(); if (mode !== 'subunit') { @@ -524,6 +529,14 @@ function setupEventListeners() { }); } + const dispensePackCountInput = document.getElementById('dispensePackCount'); + if (dispensePackCountInput) { + // Prevent accidental value changes when users scroll while focused. + dispensePackCountInput.addEventListener('wheel', (event) => { + event.preventDefault(); + }, { passive: false }); + } + // Close modal when clicking outside window.addEventListener('click', (e) => { if (e.target.classList.contains('modal')) { @@ -1279,7 +1292,7 @@ function renderDispenseBatchAllocationRows(activeBatches) { : 0; const allocationLabel = mode === 'pack' ? 'Allocate Packs' : 'Allocate'; const allocationMax = mode === 'pack' ? availableFullPacks : getBatchAvailableDispenseQuantity(batch, mode, selectedPack); - const allocationStep = mode === 'pack' ? 1 : 0.1; + const allocationStep = mode === 'pack' ? '1' : '1.0'; const batchAvailabilityNote = mode === 'pack' ? (selectedPack && batchMatchesSelectedPack(batch, selectedPack) && availableFullPacks <= 0 ? 'No full packs available in this batch' @@ -1324,6 +1337,11 @@ function renderDispenseBatchAllocationRows(activeBatches) { }).join(''); batchInfoContent.querySelectorAll('.dispense-batch-allocation').forEach(input => { + // Prevent accidental value changes when users scroll while focused. + input.addEventListener('wheel', (event) => { + event.preventDefault(); + }, { passive: false }); + input.addEventListener('input', updateDispenseAllocationSummary); }); } diff --git a/frontend/index.html b/frontend/index.html index e4f0c3b..10b8707 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -176,7 +176,7 @@