Skip to content

Commit 640b1c8

Browse files
fixed error
1 parent 0fa6047 commit 640b1c8

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/QueryFiltersWidget.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
use skeeks\cms\queryfilters\filters\StringFilterField;
1515
use skeeks\cms\widgets\AjaxSelectModel;
1616
use skeeks\cms\widgets\DualSelect;
17-
use skeeks\cms\widgets\formInputs\daterange\DaterangeInputWidget;
17+
use skeeks\cms\widgets\formInputs\selectTree\SelectTreeInputWidget;
1818
use skeeks\yii2\config\ConfigBehavior;
1919
use skeeks\yii2\config\ConfigTrait;
2020
use skeeks\yii2\config\DynamicConfigModel;
2121
use skeeks\yii2\config\storages\ConfigDbModelStorage;
22-
use skeeks\yii2\form\fields\TextField;
2322
use skeeks\yii2\form\fields\WidgetField;
2423
use yii\base\Model;
2524
use yii\base\Widget;
@@ -177,8 +176,8 @@ public function getFilteredAvailableFields($fields, $callableData)
177176
{
178177
$result = [];
179178

180-
$autoFilters = (array) ArrayHelper::getValue($callableData, 'callAttributes.autoFilters');
181-
$disableAutoFilters = (array) ArrayHelper::getValue($callableData, 'callAttributes.disableAutoFilters');
179+
$autoFilters = (array)ArrayHelper::getValue($callableData, 'callAttributes.autoFilters');
180+
$disableAutoFilters = (array)ArrayHelper::getValue($callableData, 'callAttributes.disableAutoFilters');
182181

183182
foreach ($fields as $key => $value) {
184183
if (is_array($autoFilters) && $autoFilters && !in_array($key, $autoFilters)) {
@@ -289,14 +288,14 @@ protected function _initDynamycFields()
289288
}
290289

291290

292-
293291
return $this;
294292
}
295293

296294
/**
297295
* @return $this
298296
*/
299-
protected function _initSearchFilter() {
297+
protected function _initSearchFilter()
298+
{
300299

301300
if ($this->search_param_name === false) {
302301
return $this;
@@ -314,7 +313,7 @@ protected function _initSearchFilter() {
314313
'label' => 'Поиск',
315314
'elementOptions' => [
316315
'autocomplete' => 'off',
317-
'placeholder' => 'Фильтры + поиск',
316+
'placeholder' => 'Фильтры + поиск',
318317
],
319318
'on apply' => function (QueryFiltersEvent $e) {
320319
/**
@@ -401,18 +400,18 @@ protected function _initAutoFilters()
401400
if (strpos($key, "_at") !== false) {
402401

403402
$fields[(string)$key] = [
404-
'class' => WidgetField::class,
405-
'widgetClass' => DaterangeInputWidget::class,
406-
'on apply' => function (QueryFiltersEvent $e) use ($key) {
403+
'class' => WidgetField::class,
404+
'widgetClass' => SelectTreeInputWidget::class,
405+
'on apply' => function (QueryFiltersEvent $e) use ($key) {
407406
/**
408407
* @var $query ActiveQuery
409408
*/
410409
$query = $e->dataProvider->query;
411410

412411
if ($e->field->value) {
413412
$data = explode("-", $e->field->value);
414-
$start = strtotime(trim(ArrayHelper::getValue($data, 0) . " 00:00:00"));
415-
$end = strtotime(trim(ArrayHelper::getValue($data, 1) . " 23:59:59"));
413+
$start = strtotime(trim(ArrayHelper::getValue($data, 0)." 00:00:00"));
414+
$end = strtotime(trim(ArrayHelper::getValue($data, 1)." 23:59:59"));
416415

417416
$query->andWhere(['>=', $key, $start]);
418417
$query->andWhere(['<=', $key, $end]);
@@ -526,7 +525,7 @@ protected function _applyFilters()
526525
$result = [];
527526
$fields = $this->filtersModel->builderFields();
528527

529-
$this->visibleFilters = ArrayHelper::merge((array) $this->visibleFilters, [$this->search_param_name]);
528+
$this->visibleFilters = ArrayHelper::merge((array)$this->visibleFilters, [$this->search_param_name]);
530529

531530
//Есть логика включенных выключенных колонок
532531
if ($this->visibleFilters && $fields) {

0 commit comments

Comments
 (0)