Feature: разделители в поле Цена, убраны стрелки в Цена и Количество
Made-with: Cursor
This commit is contained in:
@@ -17,6 +17,7 @@ class CustomerOrderItemForm(forms.ModelForm):
|
||||
model = CustomerOrderItem
|
||||
fields = ("product", "price", "currency", "quantity")
|
||||
widgets = {
|
||||
"price": forms.TextInput(attrs={"inputmode": "decimal", "class": "ws-price-input"}),
|
||||
"quantity": forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "style": "width: 4ch"}),
|
||||
}
|
||||
|
||||
@@ -26,6 +27,7 @@ class SupplierOrderItemForm(forms.ModelForm):
|
||||
model = SupplierOrderItem
|
||||
fields = ("product", "price", "currency", "quantity")
|
||||
widgets = {
|
||||
"price": forms.TextInput(attrs={"inputmode": "decimal", "class": "ws-price-input"}),
|
||||
"quantity": forms.NumberInput(attrs={"size": 3, "min": 0, "max": 99, "style": "width: 4ch"}),
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,17 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Убрать стрелки вверх/вниз у поля Количество (Цена — text, без стрелок) */
|
||||
.ws-table-items .ws-col-qty input[type="number"] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.ws-table-items .ws-col-qty input[type="number"]::-webkit-outer-spin-button,
|
||||
.ws-table-items .ws-col-qty input[type="number"]::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ws-table-items .ws-col-currency select {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,24 @@
|
||||
});
|
||||
});
|
||||
|
||||
form.addEventListener('focusin', function(e) {
|
||||
if (e.target.name && e.target.name.indexOf('-price') !== -1) {
|
||||
var n = parseNum(e.target.value);
|
||||
e.target.value = (e.target.value.trim() === '' || isNaN(n)) ? '' : n.toFixed(2);
|
||||
}
|
||||
});
|
||||
form.addEventListener('focusout', function(e) {
|
||||
if (e.target.name && e.target.name.indexOf('-price') !== -1) {
|
||||
if (e.target.value.trim() === '') return;
|
||||
var n = parseNum(e.target.value);
|
||||
e.target.value = isNaN(n) ? '' : formatNum(n);
|
||||
}
|
||||
});
|
||||
|
||||
updateRowAmounts();
|
||||
form.querySelectorAll('input[name$="-price"]').forEach(function(input) {
|
||||
if (input.value && input.value.trim() !== '') input.value = formatNum(parseNum(input.value));
|
||||
});
|
||||
|
||||
function reindexRows() {
|
||||
var prefix = getPrefix();
|
||||
|
||||
@@ -136,7 +136,24 @@
|
||||
});
|
||||
});
|
||||
|
||||
form.addEventListener('focusin', function(e) {
|
||||
if (e.target.name && e.target.name.indexOf('-price') !== -1) {
|
||||
var n = parseNum(e.target.value);
|
||||
e.target.value = (e.target.value.trim() === '' || isNaN(n)) ? '' : n.toFixed(2);
|
||||
}
|
||||
});
|
||||
form.addEventListener('focusout', function(e) {
|
||||
if (e.target.name && e.target.name.indexOf('-price') !== -1) {
|
||||
if (e.target.value.trim() === '') return;
|
||||
var n = parseNum(e.target.value);
|
||||
e.target.value = isNaN(n) ? '' : formatNum(n);
|
||||
}
|
||||
});
|
||||
|
||||
updateRowAmounts();
|
||||
form.querySelectorAll('input[name$="-price"]').forEach(function(input) {
|
||||
if (input.value && input.value.trim() !== '') input.value = formatNum(parseNum(input.value));
|
||||
});
|
||||
|
||||
function reindexRows() {
|
||||
var prefix = getPrefix();
|
||||
|
||||
Reference in New Issue
Block a user