fix(pos): restrict quantity editing for showcase kits in cart edit modal
For showcase kits (showcase_kit type), the quantity field is now disabled in the cart item edit modal since these are pre-assembled physical items with reservations. Price editing remains available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
// Для витринных комплектов не меняем количество
|
||||
if (!isShowcaseKit) {
|
||||
item.qty = rndQty(newQty, 3);
|
||||
}
|
||||
item.price_overridden = Math.abs(newPrice - basePrice) > 0.01;
|
||||
|
||||
window.cart.set(editingCartKey, item);
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
<label for="editModalQuantity" class="form-label fw-semibold">Количество</label>
|
||||
<input type="number" class="form-control" id="editModalQuantity"
|
||||
min="0.001" step="0.001" value="1">
|
||||
<div id="editModalQtyHint" class="text-muted small mt-1" style="display: none;">
|
||||
<i class="bi bi-info-circle"></i> Количество нельзя изменить для витринного комплекта (собранный товар с резервами)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Итого -->
|
||||
|
||||
Reference in New Issue
Block a user