diff --git a/myproject/pos/static/pos/js/terminal.js b/myproject/pos/static/pos/js/terminal.js index 925242c..6a3beed 100644 --- a/myproject/pos/static/pos/js/terminal.js +++ b/myproject/pos/static/pos/js/terminal.js @@ -189,17 +189,18 @@ function renderProducts() { stock.style.color = '#856404'; stock.style.fontWeight = 'bold'; } else if (item.type === 'product' && item.available_qty !== undefined && item.reserved_qty !== undefined) { - // Для обычных товаров показываем остатки: X(-Y) + // Для обычных товаров показываем остатки: FREE(-RESERVED) + // FREE = доступно для продажи (available - reserved) const available = parseFloat(item.available_qty) || 0; const reserved = parseFloat(item.reserved_qty) || 0; const free = available - reserved; // Создаём элементы для стилизации разных размеров - const availableSpan = document.createElement('span'); - availableSpan.textContent = available; - availableSpan.style.fontSize = '1.1em'; - availableSpan.style.fontWeight = 'bold'; - availableSpan.style.fontStyle = 'normal'; + const freeSpan = document.createElement('span'); + freeSpan.textContent = free; + freeSpan.style.fontSize = '1.1em'; + freeSpan.style.fontWeight = 'bold'; + freeSpan.style.fontStyle = 'normal'; // Отображаем резерв только если он есть if (reserved > 0) { @@ -209,10 +210,10 @@ function renderProducts() { reservedSpan.style.marginLeft = '3px'; reservedSpan.style.fontStyle = 'normal'; - stock.appendChild(availableSpan); + stock.appendChild(freeSpan); stock.appendChild(reservedSpan); } else { - stock.appendChild(availableSpan); + stock.appendChild(freeSpan); } // Цветовая индикация: красный если свободных остатков нет или отрицательные