From 36090382c1cf458953958da852aee44b51017cd7 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Tue, 13 Jan 2026 13:21:08 +0300 Subject: [PATCH] =?UTF-8?q?feat(products):=20=D1=83=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D1=88=D0=B8=D1=82=D1=8C=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84?= =?UTF-8?q?=D0=B5=D0=B9=D1=81=20=D0=BC=D0=B0=D1=81=D1=81=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=81=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D1=81=20Recommerce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Добавить секцию маркетинговых флагов в модалку синхронизации - Добавить кнопки "Выбрать все" для групп полей - Улучшить UX отображения списка товаров Co-Authored-By: Claude Opus 4.5 --- .../static/products/js/batch-selection.js | 18 ++- .../static/products/js/recommerce-sync.js | 25 +++ .../includes/recommerce_sync_modal.html | 129 ++++++++++----- .../templates/products/products_list.html | 150 ++++++++++++------ myproject/products/views/product_views.py | 42 +++++ 5 files changed, 269 insertions(+), 95 deletions(-) diff --git a/myproject/products/static/products/js/batch-selection.js b/myproject/products/static/products/js/batch-selection.js index d24316a..ae80906 100644 --- a/myproject/products/static/products/js/batch-selection.js +++ b/myproject/products/static/products/js/batch-selection.js @@ -12,7 +12,7 @@ // DOM elements const selectAllCheckbox = document.getElementById('select-all-checkbox'); const batchActionsBtn = document.getElementById('batch-actions-btn'); - const batchActionsDropdown = document.getElementById('batch-actions-dropdown'); + const batchActionsWrapper = document.getElementById('batch-actions-wrapper'); let selectionCountSpan = document.getElementById('selection-count'); /** @@ -138,17 +138,23 @@ const shouldEnable = count > 0; if (batchActionsBtn) { batchActionsBtn.disabled = !shouldEnable; - + + // Управляем подсказкой через data-атрибут + if (batchActionsWrapper) { + if (shouldEnable) { + batchActionsWrapper.removeAttribute('data-hint'); + } else { + batchActionsWrapper.setAttribute('data-hint', 'true'); + } + } + // Если в кнопке нет span#selection-count, значит текст был изменён - восстанавливаем if (!batchActionsBtn.querySelector('#selection-count')) { batchActionsBtn.innerHTML = ` Действия над выбранными (${count})`; selectionCountSpan = document.getElementById('selection-count'); } } - if (batchActionsDropdown) { - batchActionsDropdown.disabled = !shouldEnable; - } - + // Показываем/скрываем dropdown для выбора всех const selectAllDropdown = document.getElementById('select-all-dropdown-group'); if (selectAllDropdown) { diff --git a/myproject/products/static/products/js/recommerce-sync.js b/myproject/products/static/products/js/recommerce-sync.js index 90f9201..138e2b7 100644 --- a/myproject/products/static/products/js/recommerce-sync.js +++ b/myproject/products/static/products/js/recommerce-sync.js @@ -62,6 +62,11 @@ document.addEventListener('DOMContentLoaded', function() { if (document.getElementById('syncContent').checked) options.fields.push('content'); if (document.getElementById('syncImages').checked) options.fields.push('images'); + // Маркетинговые флаги + if (document.getElementById('syncIsNew')?.checked) options.fields.push('is_new'); + if (document.getElementById('syncIsPopular')?.checked) options.fields.push('is_popular'); + if (document.getElementById('syncIsSpecial')?.checked) options.fields.push('is_special'); + // Блокируем кнопку startBtn.disabled = true; const originalText = startBtn.innerHTML; @@ -125,4 +130,24 @@ document.addEventListener('DOMContentLoaded', function() { } return cookieValue; } + + // Кнопки "Выбрать все" для групп полей + document.getElementById('toggleBasicFields')?.addEventListener('click', function() { + const check = !this.dataset.allSelected || this.dataset.allSelected === 'false'; + this.dataset.allSelected = check; + this.textContent = check ? 'Снять все' : 'Выбрать все'; + document.getElementById('syncPrice').checked = check; + document.getElementById('syncStock').checked = check; + document.getElementById('syncContent').checked = check; + document.getElementById('syncImages').checked = check; + }); + + document.getElementById('toggleMarketingFields')?.addEventListener('click', function() { + const check = !this.dataset.allSelected || this.dataset.allSelected === 'false'; + this.dataset.allSelected = check; + this.textContent = check ? 'Снять все' : 'Выбрать все'; + document.getElementById('syncIsNew').checked = check; + document.getElementById('syncIsPopular').checked = check; + document.getElementById('syncIsSpecial').checked = check; + }); }); \ No newline at end of file diff --git a/myproject/products/templates/products/includes/recommerce_sync_modal.html b/myproject/products/templates/products/includes/recommerce_sync_modal.html index ddd9139..e6022a5 100644 --- a/myproject/products/templates/products/includes/recommerce_sync_modal.html +++ b/myproject/products/templates/products/includes/recommerce_sync_modal.html @@ -1,6 +1,6 @@