diff --git a/HISTORY.md b/HISTORY.md index c009313..7c59ee6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,18 @@ # История изменений ERP WaterSurf +## 2025-02-25 22:45 UTC – Поле «Цена»: ввод с клавиатуры сохраняется + +**Проблема**: В табличной части заказа в поле «Цена» сохранялось только изменение стрелками вверх/вниз, введённое с клавиатуры значение не сохранялось. + +**Причина**: При blur в поле подставлялось отформатированное значение с пробелами («1 851 635.00»). Для `input type="number"` такие значения недопустимы, браузер сбрасывал поле. + +**Решение**: Форматирование с пробелами убрано из самого поля «Цена». Разделитель разрядов остаётся только в ячейке «Стоимость» (обновляется по input). Обработчики blur/focus для поля цены и начальное форматирование при загрузке удалены в order_form.html и supplier_order_form.html. Перед отправкой формы по-прежнему выполняется удаление пробелов из значений цены. + +**Изменения**: documents/order_form.html, documents/supplier_order_form.html. + +--- + ## 2025-02-25 22:40 UTC – Убрана горизонтальная полоса прокрутки в таблице товаров **Проблема**: В табличной части заказа по-прежнему отображалась горизонтальная полоса прокрутки. diff --git a/app/templates/documents/order_form.html b/app/templates/documents/order_form.html index 7debfdb..bd630f8 100644 --- a/app/templates/documents/order_form.html +++ b/app/templates/documents/order_form.html @@ -124,27 +124,12 @@ form.addEventListener('input', updateRowAmounts); - form.querySelectorAll('#order-items input[name$="-price"]').forEach(function(input) { - input.addEventListener('blur', function() { - var v = parseNum(this.value); - if (!isNaN(v) && this.value.trim() !== '') this.value = formatNum(v).replace(',', '.'); - }); - input.addEventListener('focus', function() { - this.value = String(this.value).replace(/\s/g, '').replace(',', '.'); - }); - }); form.addEventListener('submit', function() { form.querySelectorAll('input[name$="-price"]').forEach(function(input) { input.value = String(input.value).replace(/\s/g, '').replace(',', '.'); }); }); - document.querySelectorAll('#order-items input[name$="-price"]').forEach(function(input) { - if (input.value && input.value.trim() !== '') { - var v = parseNum(input.value); - input.value = formatNum(v).replace(',', '.'); - } - }); updateRowAmounts(); document.getElementById('add-order-row').addEventListener('click', function() { @@ -170,13 +155,6 @@ }); var amountCell = clone.querySelector('.row-amount'); if (amountCell) amountCell.textContent = '—'; - clone.querySelector('input[name$="-price"]')?.addEventListener('blur', function() { - var v = parseNum(this.value); - if (!isNaN(v) && this.value.trim() !== '') this.value = formatNum(v).replace(',', '.'); - }); - clone.querySelector('input[name$="-price"]')?.addEventListener('focus', function() { - this.value = String(this.value).replace(/\s/g, '').replace(',', '.'); - }); tbody.appendChild(clone); totalInput.value = nextIndex + 1; }); diff --git a/app/templates/documents/supplier_order_form.html b/app/templates/documents/supplier_order_form.html index 0980a4a..3256a98 100644 --- a/app/templates/documents/supplier_order_form.html +++ b/app/templates/documents/supplier_order_form.html @@ -130,27 +130,12 @@ form.addEventListener('input', updateRowAmounts); - form.querySelectorAll('#supplier-order-items input[name$="-price"]').forEach(function(input) { - input.addEventListener('blur', function() { - var v = parseNum(this.value); - if (!isNaN(v) && this.value.trim() !== '') this.value = formatNum(v).replace(',', '.'); - }); - input.addEventListener('focus', function() { - this.value = String(this.value).replace(/\s/g, '').replace(',', '.'); - }); - }); form.addEventListener('submit', function() { form.querySelectorAll('input[name$="-price"]').forEach(function(input) { input.value = String(input.value).replace(/\s/g, '').replace(',', '.'); }); }); - document.querySelectorAll('#supplier-order-items input[name$="-price"]').forEach(function(input) { - if (input.value && input.value.trim() !== '') { - var v = parseNum(input.value); - input.value = formatNum(v).replace(',', '.'); - } - }); updateRowAmounts(); document.getElementById('add-supplier-order-row').addEventListener('click', function() { @@ -176,13 +161,6 @@ }); var amountCell = clone.querySelector('.row-amount'); if (amountCell) amountCell.textContent = '—'; - clone.querySelector('input[name$="-price"]')?.addEventListener('blur', function() { - var v = parseNum(this.value); - if (!isNaN(v) && this.value.trim() !== '') this.value = formatNum(v).replace(',', '.'); - }); - clone.querySelector('input[name$="-price"]')?.addEventListener('focus', function() { - this.value = String(this.value).replace(/\s/g, '').replace(',', '.'); - }); tbody.appendChild(clone); totalInput.value = nextIndex + 1; });