From: Vladimir Fomichev Date: Wed, 30 Jul 2025 07:33:46 +0000 (+0300) Subject: Простановка дат X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=40d67f338c87abbaa7b78527c674c40605a0df91;p=erp24_rep%2Fyii-erp24%2F.git Простановка дат --- 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');