Fix: поле Цена сохраняет ввод с клавиатуры (убрано форматирование в input type=number)

Made-with: Cursor
This commit is contained in:
2026-02-26 12:34:58 +00:00
parent b0649c997f
commit 7673a12027
3 changed files with 12 additions and 44 deletions

View File

@@ -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 Убрана горизонтальная полоса прокрутки в таблице товаров
**Проблема**: В табличной части заказа по-прежнему отображалась горизонтальная полоса прокрутки.

View File

@@ -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;
});

View File

@@ -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;
});