From 40d67f338c87abbaa7b78527c674c40605a0df91 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Wed, 30 Jul 2025 10:33:46 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=BE=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?utf8?q?=D0=B2=D0=BA=D0=B0=20=D0=B4=D0=B0=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...ducts1cNomenclatureActualityController.php | 1 - .../index.php | 36 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/erp24/controllers/Products1cNomenclatureActualityController.php b/erp24/controllers/Products1cNomenclatureActualityController.php index b1af12b3..c7a3f3ca 100644 --- a/erp24/controllers/Products1cNomenclatureActualityController.php +++ b/erp24/controllers/Products1cNomenclatureActualityController.php @@ -140,7 +140,6 @@ class Products1cNomenclatureActualityController extends Controller } } - // 4.4) Подставляем в провайдер $dataProvider->query = $query; } diff --git a/erp24/views/products1c-nomenclature-actuality/index.php b/erp24/views/products1c-nomenclature-actuality/index.php index 270e4f26..8b900703 100644 --- a/erp24/views/products1c-nomenclature-actuality/index.php +++ b/erp24/views/products1c-nomenclature-actuality/index.php @@ -148,7 +148,13 @@ $months = monthList();
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) ?>
@@ -158,7 +164,13 @@ $months = monthList();
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) ?>
@@ -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'); -- 2.39.5