From: marina Date: Mon, 23 Jun 2025 15:20:49 +0000 (+0300) Subject: правка отображения и скрытия подкатегорий и категорий X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=ea839231d221203f3a4570bb195e4fcc01fb5b86;p=erp24_rep%2Fyii-erp24%2F.git правка отображения и скрытия подкатегорий и категорий --- diff --git a/erp24/views/auto-plannogramma/index.php b/erp24/views/auto-plannogramma/index.php index a2460b40..9ee91af0 100644 --- a/erp24/views/auto-plannogramma/index.php +++ b/erp24/views/auto-plannogramma/index.php @@ -219,7 +219,7 @@ $this->registerJsFile('/js/autoplannogramma/autoplannogramma.js', ['position' => - + { const tr = $('').addClass('inserted-row'); - const subcategoryTd = $(` - - - ${item.name || ''} - - - `); + + + ${item.name || ''} + + + `); tr.append(subcategoryTd); const valuesMap = new Map(item.values?.map(val => [ @@ -141,7 +147,6 @@ $('.subcategory .list-group-item').on('click', function (e) { $('table thead th').each(function (index) { const $th = $(this); const storeId = $th.data('store-id'); - if (storeId === undefined) return; const isVisible = $(`table tbody tr:first td:eq(${index})`).is(':visible'); @@ -152,28 +157,27 @@ $('.subcategory .list-group-item').on('click', function (e) { const encodedTooltip = $('
').text(tooltipTitle).html(); const td = $(` - -
- - -
- - `); - + +
+ + +
+ + `); tr.append(td); }); @@ -181,10 +185,7 @@ $('.subcategory .list-group-item').on('click', function (e) { }); $row.after(fragment); - - $('[data-bs-toggle="tooltip"]').tooltip({ - customClass: 'custom-tooltip' - }); + $('[data-bs-toggle="tooltip"]').tooltip({customClass: 'custom-tooltip'}); }, error: function (xhr) { alert('Ошибка: ' + (xhr.responseText || 'Неизвестная ошибка сервера')); @@ -203,13 +204,24 @@ $('.category .list-group-item').on('click', function () { $('.loader-overlay').removeClass('d-none'); + $('tr.subcategory-row').each(function () { + const $span = $(this).find('.list-group-item[data-category][data-subcategory]').first(); + const rowCategory = $span.data('category'); + + if (rowCategory === category) { + $(this).removeClass('d-none'); + } else { + $(this).addClass('d-none'); + } + }); + $.get('/auto-plannogramma/get-subcategories', {category, year, week}, function (subcategories) { const subMap = {}; subcategories.forEach(sub => { subMap[sub.name] = sub.hasdata; }); - $(`span.list-group-item[data-category="${category}"]`).each(function () { + $(`.subcategory-cell span.list-group-item[data-category="${category}"]`).each(function () { const $span = $(this); const subName = $span.data('subcategory');