diff --git a/myproject/pos/static/pos/js/terminal.js b/myproject/pos/static/pos/js/terminal.js index 0b1f92b..c2f4e1b 100644 --- a/myproject/pos/static/pos/js/terminal.js +++ b/myproject/pos/static/pos/js/terminal.js @@ -1171,8 +1171,9 @@ async function openEditKitModal(kitId) { document.getElementById('createTempKitModalLabel').textContent = 'Редактирование витринного букета'; document.getElementById('confirmCreateTempKit').textContent = 'Сохранить изменения'; - // Показываем кнопку "Разобрать" в режиме редактирования + // Показываем кнопку "Разобрать" и скрываем поле "Количество букетов" в режиме редактирования document.getElementById('disassembleKitBtn').style.display = 'block'; + document.getElementById('showcaseKitQuantityBlock').style.display = 'none'; // Открываем модальное окно const modal = new bootstrap.Modal(document.getElementById('createTempKitModal')); @@ -1579,7 +1580,7 @@ document.getElementById('disassembleKitBtn').addEventListener('click', async () } }); -// Вспомогательная функция для получения CSRF токена +// Вспомогательная функция для получения CSRF токена (единая версия) function getCookie(name) { let cookieValue = null; if (document.cookie && document.cookie !== '') { @@ -1595,11 +1596,15 @@ function getCookie(name) { return cookieValue; } +// Алиас для обратной совместимости +const getCsrfToken = () => getCookie('csrftoken'); + // Сброс режима редактирования при закрытии модального окна document.getElementById('createTempKitModal').addEventListener('hidden.bs.modal', function() { // Очищаем tempCart (изолированное состояние модалки) tempCart.clear(); + // Сброс режима редактирования при закрытии модального окна if (isEditMode) { // Сбрасываем режим редактирования isEditMode = false; @@ -1609,8 +1614,9 @@ document.getElementById('createTempKitModal').addEventListener('hidden.bs.modal' document.getElementById('createTempKitModalLabel').textContent = 'Создать витринный букет из корзины'; document.getElementById('confirmCreateTempKit').innerHTML = ' Создать и зарезервировать'; - // Скрываем кнопку "Разобрать" + // Скрываем кнопку "Разобрать" и показываем поле "Количество букетов" document.getElementById('disassembleKitBtn').style.display = 'none'; + document.getElementById('showcaseKitQuantityBlock').style.display = 'block'; } }); @@ -1833,21 +1839,6 @@ async function handleCheckoutSubmit(paymentsData) { } } -function getCookie(name) { - let cookieValue = null; - if (document.cookie && document.cookie !== '') { - const cookies = document.cookie.split(';'); - for (let i = 0; i < cookies.length; i++) { - const cookie = cookies[i].trim(); - if (cookie.substring(0, name.length + 1) === (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; -} - // ===== ОБРАБОТЧИКИ ДЛЯ РАБОТЫ С КЛИЕНТОМ ===== // Кнопка "Выбрать клиента" в корзине @@ -1958,22 +1949,7 @@ document.addEventListener('click', async (e) => { } }); -// Вспомогательная функция для получения CSRF токена -function getCsrfToken() { - const name = 'csrftoken'; - let cookieValue = null; - if (document.cookie && document.cookie !== '') { - const cookies = document.cookie.split(';'); - for (let i = 0; i < cookies.length; i++) { - const cookie = cookies[i].trim(); - if (cookie.substring(0, name.length + 1) === (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; -} + // Обработчик поиска с debounce const searchInput = document.getElementById('searchInput'); diff --git a/myproject/pos/templates/pos/terminal.html b/myproject/pos/templates/pos/terminal.html index d705893..ae3687c 100644 --- a/myproject/pos/templates/pos/terminal.html +++ b/myproject/pos/templates/pos/terminal.html @@ -98,22 +98,6 @@
На витрину -
- -
-
- -
-
- -
-
- -
-
- -
-
+
@@ -170,8 +150,8 @@
- -
+ +
Будет создано указанное количество одинаковых букетов на витрину