]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Простановка дат
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 30 Jul 2025 07:33:46 +0000 (10:33 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 30 Jul 2025 07:33:46 +0000 (10:33 +0300)
erp24/controllers/Products1cNomenclatureActualityController.php
erp24/views/products1c-nomenclature-actuality/index.php

index b1af12b3e229445c0cb04015aebfd53d33424497..c7a3f3ca40074dc20c9f8d19d3aa5b45922a97e4 100644 (file)
@@ -140,7 +140,6 @@ class Products1cNomenclatureActualityController extends Controller
                 }
             }
 
-            // 4.4) Подставляем в провайдер
             $dataProvider->query = $query;
         }
 
index 270e4f266e7f1479bbb721adbe992a2909fde4f1..8b9007037d5c214b56bc9b0ab3717709eb6b55ac 100644 (file)
@@ -148,7 +148,13 @@ $months = monthList();
             <div class="mb-3">
                 <div class="d-flex justify-content-between">
                     <?= $formFilter->field($filter, 'date_from', ['options' => ['class' => 'w-100']])
-                        ->dropDownList($months, ['prompt' => 'Выбрать дату от', 'id' => 'filter-date-from'])
+                        ->dropDownList($months,
+                            [
+                                'prompt' => 'Выбрать дату от',
+                                'id' => 'filter-date-from',
+                                'class' => ''
+                            ]
+                        )
                         ->label(false) ?>
                     <div class="mb-4 ms-1 d-flex justify-content-center align-items-center  clear-btn" data-target="filter-date-from" >
                         <i class="fa fa-times"></i>
@@ -158,7 +164,13 @@ $months = monthList();
             <div>
                 <div class="d-flex justify-content-between">
                     <?= $formFilter->field($filter, 'date_to', ['options' => ['class' => 'w-100']])
-                        ->dropDownList($months, ['prompt' => 'Выбрать дату до', 'id' => 'filter-date-to'])
+                        ->dropDownList($months,
+                            [
+                                'prompt' => 'Выбрать дату до',
+                                'id' => 'filter-date-to',
+                                'class' => ''
+                            ]
+                        )
                         ->label(false) ?>
                     <div class="mb-4 ms-1 d-flex justify-content-center align-items-center  clear-btn" data-target="filter-date-to" >
                         <i class="fa fa-times"></i>
@@ -239,11 +251,11 @@ $months = monthList();
                     return Html::hiddenInput("actuality[$i][guid]", $m->id)
                         . Html::tag('div',
                             Html::dropDownList("actuality[$i][from]", $from, $months, [
-                                'class'=>'form-select form-select-sm me-1',
+                                'class'=>'form-select from-month form-select-sm me-1',
                                 'prompt'=>'от'
                             ])
                             . Html::dropDownList("actuality[$i][to]", $to, $months, [
-                                'class'=>'form-select form-select-sm',
+                                'class'=>'form-select to-month form-select-sm',
                                 'prompt'=>'до'
                             ]),
                             ['class'=>'d-flex align-items-center']
@@ -295,6 +307,22 @@ $('.from-month').on('change', function(){
         to.val(from);
     }
 });
+
+    $('#filter-date-from').on('change', function(){
+        var from = $(this).val();
+        var to = $('#filter-date-to');
+        to.find('option').each(function(){
+            var val = $(this).val();
+            if (val === '' || val >= from) {
+                $(this).show();
+            } else {
+                $(this).hide();
+            }
+        });
+        if (to.val() && to.val() < from) {
+            to.val(from);
+        }
+    });
 $('.clear-btn').on('click', function(){
     var target = $(this).data('target');
     $('#' + target).val(null).trigger('change');