diff --git a/myproject/pos/static/pos/js/cart-item-editor.js b/myproject/pos/static/pos/js/cart-item-editor.js index efc7352..86694f3 100644 --- a/myproject/pos/static/pos/js/cart-item-editor.js +++ b/myproject/pos/static/pos/js/cart-item-editor.js @@ -38,6 +38,9 @@ editingCartKey = cartKey; basePrice = parseFloat(item.price) || 0; + // Проверяем, является ли товар витринным комплектом + const isShowcaseKit = item.type === 'showcase_kit'; + // Заполнение полей document.getElementById('editModalProductName').textContent = item.name || '—'; @@ -48,6 +51,17 @@ document.getElementById('editModalPrice').value = roundPrice(basePrice); document.getElementById('editModalQuantity').value = item.qty || 1; + // Для витринных комплектов блокируем изменение количества + const qtyInput = document.getElementById('editModalQuantity'); + const qtyHint = document.getElementById('editModalQtyHint'); + if (isShowcaseKit) { + qtyInput.disabled = true; + qtyHint.style.display = 'block'; + } else { + qtyInput.disabled = false; + qtyHint.style.display = 'none'; + } + // Бейдж единицы измерения const unitBadge = document.getElementById('editModalUnitBadge'); if (item.unit_name) { @@ -99,8 +113,13 @@ // Используем roundQuantity из terminal.js const rndQty = typeof roundQuantity === 'function' ? roundQuantity : (v, d) => Math.round(v * Math.pow(10, d)) / Math.pow(10, d); + const isShowcaseKit = item.type === 'showcase_kit'; + item.price = newPrice; - item.qty = rndQty(newQty, 3); + // Для витринных комплектов не меняем количество + if (!isShowcaseKit) { + item.qty = rndQty(newQty, 3); + } item.price_overridden = Math.abs(newPrice - basePrice) > 0.01; window.cart.set(editingCartKey, item); diff --git a/myproject/pos/templates/pos/components/edit_cart_item_modal.html b/myproject/pos/templates/pos/components/edit_cart_item_modal.html index 87a8d23..58f0ce8 100644 --- a/myproject/pos/templates/pos/components/edit_cart_item_modal.html +++ b/myproject/pos/templates/pos/components/edit_cart_item_modal.html @@ -42,6 +42,9 @@ +