diff --git a/myproject/pos/static/pos/css/terminal.css b/myproject/pos/static/pos/css/terminal.css
index e313b08..35d4cc4 100644
--- a/myproject/pos/static/pos/css/terminal.css
+++ b/myproject/pos/static/pos/css/terminal.css
@@ -32,12 +32,20 @@ body {
flex-grow: 1;
}
+/* 5 колонок для товаров и категорий на экранах от 1100px */
+@media (min-width: 1100px) {
+ .col-lg-custom-5 {
+ flex: 0 0 20%;
+ max-width: 20%;
+ }
+}
+
/* Стили для корзины */
.cart-item {
display: flex;
align-items: center;
- gap: 0.5rem;
- padding: 0.35rem 0;
+ gap: 0.25rem;
+ padding: 0.25rem 0;
border-bottom: 1px solid #e9ecef;
}
@@ -46,6 +54,25 @@ body {
min-width: 0;
}
+.item-name-price .fw-semibold {
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ line-height: 1.3;
+}
+
+.item-name-price .text-muted {
+ margin-top: 0.15rem;
+}
+
+/* Цена и единица измерения на одной строке */
+.price-unit-row {
+ display: flex;
+ align-items: center;
+ gap: 0.35rem;
+}
+
.multiply-sign {
font-weight: bold;
color: #6c757d;
@@ -54,12 +81,12 @@ body {
}
.qty-input {
- width: 50px;
- padding: 0.25rem 0.5rem;
+ width: 45px;
+ padding: 0.15rem 0.35rem;
border: 1px solid #dee2e6;
border-radius: 4px;
text-align: center;
- font-size: 0.9rem;
+ font-size: 0.85rem;
flex-shrink: 0;
}
@@ -75,23 +102,23 @@ body {
.item-total {
font-weight: 600;
- font-size: 0.95rem;
+ font-size: 0.85rem;
color: #212529;
- min-width: 60px;
+ min-width: 50px;
text-align: right;
flex-shrink: 0;
}
.cart-item .btn-link {
- font-size: 1.5rem;
+ font-size: 1.2rem;
line-height: 1;
- width: 40px;
- height: 40px;
+ width: 32px;
+ height: 32px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
- margin-left: 0.25rem;
+ margin-left: 0.15rem;
}
.cart-item .btn-link:hover {
@@ -99,6 +126,16 @@ body {
border-radius: 4px;
}
+/* Кнопки +/- компактнее */
+.cart-item .btn-sm {
+ padding: 0.15rem 0.35rem;
+ font-size: 0.875rem;
+}
+
+.cart-item .btn-sm i {
+ font-size: 1em;
+}
+
.product-card {
cursor: pointer;
user-select: none;
@@ -174,22 +211,28 @@ body {
.product-stock {
font-size: 0.8rem;
color: #6c757d;
- font-style: italic;
+ margin-top: auto;
+ margin-bottom: 0.15rem;
}
.product-sku {
- font-size: 0.75rem;
+ font-size: 0.65rem;
color: #adb5bd;
- margin-top: auto;
display: flex;
justify-content: space-between;
align-items: center;
+ flex-wrap: nowrap;
+ gap: 0.5rem;
}
.product-price {
font-size: 0.85rem;
font-weight: 600;
color: #212529;
+ border: 1px solid #dee2e6;
+ border-radius: 6px;
+ padding: 2px 8px;
+ background: #f8f9fa;
}
/* Карточки категорий */
@@ -246,7 +289,7 @@ body {
top: 0;
right: 0;
bottom: 0;
- width: 33.333%; /* 4/12 колонок */
+ width: 41.667%; /* 5/12 колонок */
overflow-y: auto;
padding: 1rem;
padding-right: 1.5rem;
@@ -318,30 +361,15 @@ body {
/* Адаптивность для элементов корзины на маленьких экранах */
@media (max-width: 991.98px) {
.cart-item {
- flex-wrap: wrap;
- gap: 0.5rem;
+ align-items: flex-start;
}
-
- .item-name-price {
- width: 100%;
- order: 1;
- }
-
+
.multiply-sign {
display: none;
}
-
- .cart-item > div:has(.d-flex.align-items-center) {
- order: 2;
- }
-
- .item-total {
- order: 3;
- margin-left: auto;
- }
-
- .cart-item .btn-link {
- order: 4;
+
+ .item-name-price .fw-semibold {
+ -webkit-line-clamp: 1;
}
}
@@ -524,3 +552,27 @@ body {
.products-scrollable {
-webkit-overflow-scrolling: touch;
}
+
+/* ============================================================
+ КОМПАКТНАЯ КНОПКА ВЫБОРА КЛИЕНТА
+ ============================================================ */
+#customerSelectBtn {
+ min-width: 160px;
+ max-width: 200px;
+ height: 38px;
+ padding: 0.25rem 0.75rem;
+ gap: 0.5rem;
+}
+
+#customerSelectBtn i {
+ font-size: 1rem;
+ flex-shrink: 0;
+}
+
+#customerSelectBtnText {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+/* На мобильных - такой же вид с текстом */
diff --git a/myproject/products/static/products/js/inline-price-edit.js b/myproject/products/static/products/js/inline-price-edit.js
new file mode 100644
index 0000000..14137a9
--- /dev/null
+++ b/myproject/products/static/products/js/inline-price-edit.js
@@ -0,0 +1,277 @@
+/**
+ * Inline Price Editing Module
+ * Переиспользуемый модуль для редактирования цен товаров прямо на странице
+ * Используется на страницах: products_list.html, catalog.html
+ */
+
+(function() {
+ 'use strict';
+
+ /**
+ * Нормализует ввод цены: заменяет запятую на точку
+ * @param {string} value - введенное значение
+ * @returns {string} - нормализованное значение
+ */
+ function normalizePrice(value) {
+ if (typeof value === 'string') {
+ return value.replace(',', '.');
+ }
+ return value;
+ }
+
+ /**
+ * Форматирует число для отображения (с запятой как разделителем)
+ * @param {string|number} value - значение
+ * @returns {string} - отформатированное значение с запятой
+ */
+ function formatPrice(value) {
+ return parseFloat(value).toFixed(2).replace('.', ',');
+ }
+
+ /**
+ * Получает CSRF токен из DOM или cookies
+ * @returns {string} - CSRF токен
+ */
+ function getCsrfToken() {
+ // Сначала пытаемся найти токен в DOM (из {% csrf_token %})
+ const csrfInput = document.querySelector('[name=csrfmiddlewaretoken]');
+ if (csrfInput) {
+ return csrfInput.value;
+ }
+
+ // Fallback: пытаемся прочитать из cookie
+ const cookies = document.cookie.split(';');
+ for (let cookie of cookies) {
+ const [key, value] = cookie.trim().split('=');
+ if (key === 'csrftoken') {
+ return decodeURIComponent(value);
+ }
+ }
+
+ return '';
+ }
+
+ /**
+ * Обновляет отображение цен для товара
+ * @param {number} productId - ID товара
+ * @param {string} price - основная цена
+ * @param {string|null} salePrice - цена со скидкой
+ */
+ function updatePriceDisplay(productId, price, salePrice) {
+ // Находим все контейнеры с ценами для этого товара
+ const priceContainers = document.querySelectorAll(
+ `.editable-price[data-product-id="${productId}"]`
+ );
+
+ priceContainers.forEach(container => {
+ const parentContainer = container.closest('.price-edit-container, td');
+ if (!parentContainer) return;
+
+ // Формируем новый HTML
+ let newHTML = '';
+
+ if (salePrice) {
+ // Есть скидочная цена
+ newHTML = `
+
${formatPrice(price)} руб.
+
+ ${formatPrice(salePrice)} руб.
+
+ `;
+ } else {
+ // Только обычная цена
+ newHTML = `
+
+ ${formatPrice(price)} руб.
+
+ `;
+ }
+
+ parentContainer.innerHTML = newHTML;
+ });
+ }
+
+ /**
+ * Отправляет обновление цены на сервер
+ * @param {number} productId - ID товара
+ * @param {string} field - поле (price или sale_price)
+ * @param {string|null} value - новое значение
+ * @returns {Promise