From 61f023f41bea8ab906d22148eede680ce32d9b8b Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 6 Jun 2025 09:28:08 +0300 Subject: [PATCH] =?utf8?q?ERP-360=20=D0=A1=D0=B1=D0=BE=D1=80=D0=BA=D0=B0?= =?utf8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B=20=D0=B0?= =?utf8?q?=D0=B2=D1=82=D0=BE=D0=BF=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../AutoPlannogrammaController.php | 8 +-- erp24/views/auto-plannogramma/index.php | 9 ++-- .../js/autoplannogramma/autoplannogramma.js | 50 +++++++------------ 3 files changed, 25 insertions(+), 42 deletions(-) diff --git a/erp24/controllers/AutoPlannogrammaController.php b/erp24/controllers/AutoPlannogrammaController.php index eab7c55b..bfeea6e6 100644 --- a/erp24/controllers/AutoPlannogrammaController.php +++ b/erp24/controllers/AutoPlannogrammaController.php @@ -119,11 +119,11 @@ class AutoPlannogrammaController extends BaseController ->where(['s.visible' => CityStore::IS_VISIBLE]); $fields = [ - 'city' => 's.city_id', - 'storeType' => 's.type_id', + 'city' => 'p.address_city', + 'store_type' => 'p.store_type', 'territorialManager' => 's.territorial_manager_id', - 'region' => 's.region_id', - 'district' => 's.district_id', + 'region' => 'p.address_region', + 'district' => 'p.address_district', 'bushChefFlorist' => 's.bush_chef_florist_id', ]; diff --git a/erp24/views/auto-plannogramma/index.php b/erp24/views/auto-plannogramma/index.php index daf2cd11..8039f1ae 100644 --- a/erp24/views/auto-plannogramma/index.php +++ b/erp24/views/auto-plannogramma/index.php @@ -171,12 +171,11 @@ $this->registerJsFile('/js/autoplannogramma/autoplannogramma.js', ['position' => 'btn btn-success ms-1']) ?> - - - - $storeName): ?> + + 'writing-mode: sideways-lr; text-align: center; white-space: nowrap; - font-weight: bold; transform-origin: left bottom; padding-right: 7%;' + font-weight: bold; transform-origin: left bottom; padding-right: 7%;' ]) ?> diff --git a/erp24/web/js/autoplannogramma/autoplannogramma.js b/erp24/web/js/autoplannogramma/autoplannogramma.js index 530477c8..39cadd73 100644 --- a/erp24/web/js/autoplannogramma/autoplannogramma.js +++ b/erp24/web/js/autoplannogramma/autoplannogramma.js @@ -155,6 +155,7 @@ $('#autoplannogramma').on('click', '.reject-btn', function () { } }); +// Получение значений фильтров function getFilterData() { return { year: $('#year').val(), @@ -169,48 +170,31 @@ function getFilterData() { }; } -// Скрываем ячейки магазинов, не подходящих по фильтру +// Применение фильтра магазинов function applyStoreFilter() { - const filterData = getFilterData(); + $.get('/auto-plannogramma/get-visible-stores', getFilterData(), function (response) { + const allowedStoreIds = (response.store_ids || []).map(String); - $.ajax({ - url: '/auto-plannogramma/get-visible-stores', - type: 'GET', - data: filterData, - success: function (response) { - const allowedStoreIds = response.store_ids.map(id => String(id)); - - $('td[data-store-id], th[data-store-id]').each(function () { - const storeId = $(this).data('store-id').toString(); - if (!allowedStoreIds.includes(storeId)) { - $(this).hide(); // скрываем - } else { - $(this).show(); // показываем нужное - } - }); - }, - error: function (xhr) { - console.error('Ошибка при фильтрации магазинов:', xhr.responseText); - } + $('td[data-store-id], th[data-store-id]').each(function () { + const storeId = String($(this).data('store-id')); + $(this).toggle(allowedStoreIds.includes(storeId)); + }); + }).fail(function (xhr) { + console.error('Ошибка при фильтрации магазинов:', xhr.responseText); }); } -// Показываем всё обратно при сбросе +// Сброс фильтров и отображение всех ячеек function resetStoreFilter() { - $('td[data-store-id], th[data-store-id]').show(); // показываем все -} - -// Вешаем события -$('.btn-apply').on('click', function () { - applyStoreFilter(); -}); - -$('.btn-reset').on('click', function () { // Сброс значений фильтров $('#year, #city, #store-type, #territorial-manger, #polnogramma-type, #week, #region, #bush_chef_florist, #district').val(''); + // Показ всех ячеек + $('td[data-store-id], th[data-store-id]').show(); +} - resetStoreFilter(); -}); +// Обработчики событий +$('.btn-apply').on('click', applyStoreFilter); +$('.btn-reset').on('click', resetStoreFilter); -- 2.39.5