]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
правка отображения и скрытия подкатегорий и категорий
authormarina <m.zozirova@gmail.com>
Mon, 23 Jun 2025 13:52:57 +0000 (16:52 +0300)
committermarina <m.zozirova@gmail.com>
Mon, 23 Jun 2025 13:52:57 +0000 (16:52 +0300)
erp24/web/js/autoplannogramma/autoplannogramma.js

index a0f3a1b2262e165ad6362ae3cc194e2fc2b1a21f..e4caabafd708f209f98483ea223d268fb8e6630f 100644 (file)
@@ -66,6 +66,12 @@ $('.subcategory .list-group-item').on('click', function (e) {
     const $row = $link.closest('tr');
     const $nextRow = $row.next();
 
+    const subcategoryLabel = $link.closest('td.subcategory-cell').find('span.subcategory-label').text();
+    if (subcategoryLabel.includes('нет данных')) {
+        alert('Нет планограммы для выбранного периода');
+        return;
+    }
+    
     if ($nextRow.hasClass('inserted-row')) {
         if ($nextRow.hasClass('d-none')) {
             $('tr.inserted-row').each(function () {
@@ -107,11 +113,6 @@ $('.subcategory .list-group-item').on('click', function (e) {
         success: function (response) {
             $row.nextAll('tr.inserted-row').remove();
 
-            if (!response || !Array.isArray(response) || response.length === 0) {
-                alert('Нет планограммы для выбранного периода');
-                return;
-            }
-
             const fragment = document.createDocumentFragment();
 
             response.forEach(item => {