Commit 9111c0e26bb5ec732de3d651c0d0918b5df06b3d

Authored by Administrator
2 parents 5715e3de 5bcc2ad6

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 14  
15 15 public $groupName;
16 16  
  17 + public $alias;
  18 +
  19 + public $description;
  20 +
17 21 public function behaviors()
18 22 {
19 23 $behaviors = parent::behaviors();
... ... @@ -33,6 +37,7 @@
33 37 [
34 38 'id',
35 39 'level',
  40 + 'sort',
36 41 ],
37 42 'integer',
38 43 ],
... ... @@ -45,6 +50,8 @@
45 50 [
46 51 [
47 52 'groupName',
  53 + 'alias',
  54 + 'description',
48 55 ],
49 56 'safe',
50 57 ],
... ... @@ -67,7 +74,7 @@
67 74 *
68 75 * @return ActiveDataProvider
69 76 */
70   - public function search($params, int $level = null)
  77 + public function search($params, int $level = NULL)
71 78 {
72 79 $query = TaxGroup::find()
73 80 ->joinWith('lang');
... ... @@ -78,11 +85,20 @@
78 85 'sort' => [
79 86 'attributes' => [
80 87 'id',
  88 + 'sort',
81 89 'is_filter',
82   - 'groupName' => [
  90 + 'groupName' => [
83 91 'asc' => [ 'tax_group_lang.title' => SORT_ASC ],
84 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 121 'id' => $this->id,
106 122 'is_filter' => $this->is_filter,
107 123 'level' => $this->level,
  124 + 'sort' => $this->sort,
108 125 ]
109 126 )
110 127 ->andFilterWhere(
... ... @@ -113,6 +130,20 @@
113 130 'tax_group_lang.title',
114 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 149 return $dataProvider;
... ...
views/tax-group/index.php
... ... @@ -41,7 +41,7 @@
41 41 'filterModel' => $searchModel,
42 42 'columns' => [
43 43 [ 'class' => 'yii\grid\SerialColumn' ],
44   - 'id',
  44 + 'sort',
45 45 [
46 46 'attribute' => 'is_filter',
47 47 'format' => 'boolean',
... ... @@ -52,22 +52,12 @@
52 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 63 'class' => 'yii\grid\ActionColumn',
... ...