]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Изменение порядка месяцев в фильтрацию таблицы планов
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Thu, 1 Aug 2024 12:18:12 +0000 (12:18 +0000)
committerMarina Zozirova <marina.zozirova@erp-flowers.ru>
Thu, 1 Aug 2024 12:18:12 +0000 (12:18 +0000)
erp24/forms/timetable/TabelSearchForm.php
erp24/views/timetable/plan.php

index 1acbf3f311e818756eed395d5447029ee965d9f4..53147b2ff0c2206e75fd87c17d34bad13363f1b2 100755 (executable)
@@ -32,8 +32,8 @@ class TabelSearchForm extends Model
             [['adminGroupId'], 'in', 'range' => array_keys(AdminGroup::groupsWithShift())],
             [['start', 'end'], 'date', 'format' => 'php:Y-m-d'],
             [['status'], 'in' ,'range' => array_keys(Timetable::statuses())],
-            [['start'], 'default', 'value' => date('Y-m-01', strtotime('next month midnight'))],
-            [['end'], 'default', 'value' => date('Y-m-t', strtotime('next month midnight'))],
+            [['start'], 'default', 'value' => date('Y-m-01', strtotime('this month midnight'))],
+            [['end'], 'default', 'value' => date('Y-m-t', strtotime('this month midnight'))],
         ];
     }
 
index 0d0e52900092a3fb158ea277a1c7d7fee3bb3c02..7a8b053332fd0f4b54241ec49ab95e84ee34a8bb 100755 (executable)
@@ -94,8 +94,10 @@ $this->registerJsVar('settings', [
             <div class="row selectgroup selectgroup-pills">
                 <div class="col-12">
                 Выбор месяца:
-                <?php $selectedDate = new DateTime($tabelForm->start) ?>
-                <?php for ($date = new DateTime(); $date < new DateTime('+12 month'); $date->modify('+1 month')) { ?>
+                <?php $currentMonth = new DateTime() ?>
+                <?php $selectedDate = isset($tabelForm->start) ? new DateTime($tabelForm->start) : $currentMonth;  ?>
+
+                <?php for ($date = (clone $currentMonth)->modify('-1 month'); $date < new DateTime('+12 month'); $date->modify('+1 month')) { ?>
                 <?php $selectedAttribute = $date->format('Y-m') === $selectedDate->format('Y-m') ? ' checked' : '' ?>
                     <label><input
                                 class="selectgroup-input"