Commit 9111c0e26bb5ec732de3d651c0d0918b5df06b3d
Merge remote-tracking branch 'origin/master'
Showing
2 changed files
with
38 additions
and
17 deletions
Show diff stats
models/TaxGroupSearch.php
| @@ -14,6 +14,10 @@ | @@ -14,6 +14,10 @@ | ||
| 14 | 14 | ||
| 15 | public $groupName; | 15 | public $groupName; |
| 16 | 16 | ||
| 17 | + public $alias; | ||
| 18 | + | ||
| 19 | + public $description; | ||
| 20 | + | ||
| 17 | public function behaviors() | 21 | public function behaviors() |
| 18 | { | 22 | { |
| 19 | $behaviors = parent::behaviors(); | 23 | $behaviors = parent::behaviors(); |
| @@ -33,6 +37,7 @@ | @@ -33,6 +37,7 @@ | ||
| 33 | [ | 37 | [ |
| 34 | 'id', | 38 | 'id', |
| 35 | 'level', | 39 | 'level', |
| 40 | + 'sort', | ||
| 36 | ], | 41 | ], |
| 37 | 'integer', | 42 | 'integer', |
| 38 | ], | 43 | ], |
| @@ -45,6 +50,8 @@ | @@ -45,6 +50,8 @@ | ||
| 45 | [ | 50 | [ |
| 46 | [ | 51 | [ |
| 47 | 'groupName', | 52 | 'groupName', |
| 53 | + 'alias', | ||
| 54 | + 'description', | ||
| 48 | ], | 55 | ], |
| 49 | 'safe', | 56 | 'safe', |
| 50 | ], | 57 | ], |
| @@ -67,7 +74,7 @@ | @@ -67,7 +74,7 @@ | ||
| 67 | * | 74 | * |
| 68 | * @return ActiveDataProvider | 75 | * @return ActiveDataProvider |
| 69 | */ | 76 | */ |
| 70 | - public function search($params, int $level = null) | 77 | + public function search($params, int $level = NULL) |
| 71 | { | 78 | { |
| 72 | $query = TaxGroup::find() | 79 | $query = TaxGroup::find() |
| 73 | ->joinWith('lang'); | 80 | ->joinWith('lang'); |
| @@ -78,11 +85,20 @@ | @@ -78,11 +85,20 @@ | ||
| 78 | 'sort' => [ | 85 | 'sort' => [ |
| 79 | 'attributes' => [ | 86 | 'attributes' => [ |
| 80 | 'id', | 87 | 'id', |
| 88 | + 'sort', | ||
| 81 | 'is_filter', | 89 | 'is_filter', |
| 82 | - 'groupName' => [ | 90 | + 'groupName' => [ |
| 83 | 'asc' => [ 'tax_group_lang.title' => SORT_ASC ], | 91 | 'asc' => [ 'tax_group_lang.title' => SORT_ASC ], |
| 84 | 'desc' => [ 'tax_group_lang.title' => SORT_DESC ], | 92 | 'desc' => [ 'tax_group_lang.title' => SORT_DESC ], |
| 85 | ], | 93 | ], |
| 94 | + 'alias' => [ | ||
| 95 | + 'asc' => [ 'tax_group_lang.alias' => SORT_ASC ], | ||
| 96 | + 'desc' => [ 'tax_group_lang.alias' => SORT_DESC ], | ||
| 97 | + ], | ||
| 98 | + 'description' => [ | ||
| 99 | + 'asc' => [ 'tax_group_lang.description' => SORT_ASC ], | ||
| 100 | + 'desc' => [ 'tax_group_lang.description' => SORT_DESC ], | ||
| 101 | + ], | ||
| 86 | ], | 102 | ], |
| 87 | ], | 103 | ], |
| 88 | ] | 104 | ] |
| @@ -105,6 +121,7 @@ | @@ -105,6 +121,7 @@ | ||
| 105 | 'id' => $this->id, | 121 | 'id' => $this->id, |
| 106 | 'is_filter' => $this->is_filter, | 122 | 'is_filter' => $this->is_filter, |
| 107 | 'level' => $this->level, | 123 | 'level' => $this->level, |
| 124 | + 'sort' => $this->sort, | ||
| 108 | ] | 125 | ] |
| 109 | ) | 126 | ) |
| 110 | ->andFilterWhere( | 127 | ->andFilterWhere( |
| @@ -113,6 +130,20 @@ | @@ -113,6 +130,20 @@ | ||
| 113 | 'tax_group_lang.title', | 130 | 'tax_group_lang.title', |
| 114 | $this->groupName, | 131 | $this->groupName, |
| 115 | ] | 132 | ] |
| 133 | + ) | ||
| 134 | + ->andFilterWhere( | ||
| 135 | + [ | ||
| 136 | + 'ilike', | ||
| 137 | + 'tax_group_lang.alias', | ||
| 138 | + $this->alias, | ||
| 139 | + ] | ||
| 140 | + ) | ||
| 141 | + ->andFilterWhere( | ||
| 142 | + [ | ||
| 143 | + 'ilike', | ||
| 144 | + 'tax_group_lang.description', | ||
| 145 | + $this->description, | ||
| 146 | + ] | ||
| 116 | ); | 147 | ); |
| 117 | 148 | ||
| 118 | return $dataProvider; | 149 | return $dataProvider; |
views/tax-group/index.php
| @@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
| 41 | 'filterModel' => $searchModel, | 41 | 'filterModel' => $searchModel, |
| 42 | 'columns' => [ | 42 | 'columns' => [ |
| 43 | [ 'class' => 'yii\grid\SerialColumn' ], | 43 | [ 'class' => 'yii\grid\SerialColumn' ], |
| 44 | - 'id', | 44 | + 'sort', |
| 45 | [ | 45 | [ |
| 46 | 'attribute' => 'is_filter', | 46 | 'attribute' => 'is_filter', |
| 47 | 'format' => 'boolean', | 47 | 'format' => 'boolean', |
| @@ -52,22 +52,12 @@ | @@ -52,22 +52,12 @@ | ||
| 52 | 'value' => 'lang.title', | 52 | 'value' => 'lang.title', |
| 53 | ], | 53 | ], |
| 54 | [ | 54 | [ |
| 55 | - 'label' => \Yii::t('rubrication', 'Options count'), | ||
| 56 | - 'value' => function ($model) { | ||
| 57 | - /** | ||
| 58 | - * @var TaxGroup $model | ||
| 59 | - */ | ||
| 60 | - return count($model->options); | ||
| 61 | - }, | 55 | + 'attribute' => 'alias', |
| 56 | + 'value' => 'lang.alias' | ||
| 62 | ], | 57 | ], |
| 63 | [ | 58 | [ |
| 64 | - 'label' => \Yii::t('rubrication', 'Categories count'), | ||
| 65 | - 'value' => function ($model) { | ||
| 66 | - /** | ||
| 67 | - * @var TaxGroup $model | ||
| 68 | - */ | ||
| 69 | - return count($model->categories); | ||
| 70 | - }, | 59 | + 'attribute' => 'description', |
| 60 | + 'value' => 'lang.description' | ||
| 71 | ], | 61 | ], |
| 72 | [ | 62 | [ |
| 73 | 'class' => 'yii\grid\ActionColumn', | 63 | 'class' => 'yii\grid\ActionColumn', |