Commit 8dd0569e90a825f37d979cf91dbcaeab433c3af3

Authored by Administrator
2 parents bb9709e0 b5de253e

Merge remote-tracking branch 'origin/master'

common/models/CustomerSearch.php
@@ -97,6 +97,58 @@ @@ -97,6 +97,58 @@
97 'query' => $query, 97 'query' => $query,
98 ]); 98 ]);
99 99
  100 + $dataProvider->setSort([
  101 + 'defaultOrder' => [
  102 + 'name' => SORT_ASC,
  103 + ],
  104 + 'attributes' => [
  105 + 'name' => [
  106 + 'asc' => [
  107 + 'company_info.name' => SORT_ASC,
  108 + 'firstname' => SORT_ASC,
  109 + 'lastname' => SORT_ASC,
  110 + ],
  111 + 'desc' => [
  112 + 'company_info.name' => SORT_DESC,
  113 + 'firstname' => SORT_DESC,
  114 + 'lastname' => SORT_DESC,
  115 + ],
  116 + 'default' => SORT_ASC,
  117 + 'label' => 'Название',
  118 + ],
  119 + 'staff' => [
  120 + 'asc' => [
  121 + 'company_info.staff' => SORT_ASC,
  122 + ],
  123 + 'desc' => [
  124 + 'company_info.staff' => SORT_DESC,
  125 + ],
  126 + 'default' => SORT_DESC,
  127 + 'label' => 'Количество сотрудников',
  128 + ],
  129 + 'visit' => [
  130 + 'asc' => [
  131 + 'user_info.date_visit' => SORT_ASC,
  132 + ],
  133 + 'desc' => [
  134 + 'user_info.date_visit' => SORT_DESC,
  135 + ],
  136 + 'default' => SORT_DESC,
  137 + 'label' => 'Последний визит',
  138 + ],
  139 + 'city' => [
  140 + 'asc' => [
  141 + 'user_info.city' => SORT_ASC,
  142 + ],
  143 + 'desc' => [
  144 + 'user_info.city' => SORT_DESC,
  145 + ],
  146 + 'default' => SORT_ASC,
  147 + 'label' => 'Город',
  148 + ],
  149 + ],
  150 + ]);
  151 +
100 $this->load($params); 152 $this->load($params);
101 153
102 if(!$this->validate()) { 154 if(!$this->validate()) {
frontend/controllers/SearchController.php
@@ -75,57 +75,6 @@ use common\models\Social; @@ -75,57 +75,6 @@ use common\models\Social;
75 $dataProvider->setPagination([ 75 $dataProvider->setPagination([
76 'pageSize' => 5, 76 'pageSize' => 5,
77 ]); 77 ]);
78 - $dataProvider->setSort([  
79 - 'defaultOrder' => [  
80 - 'name' => SORT_ASC,  
81 - ],  
82 - 'attributes' => [  
83 - 'name' => [  
84 - 'asc' => [  
85 - 'company_info.name' => SORT_ASC,  
86 - 'firstname' => SORT_ASC,  
87 - 'lastname' => SORT_ASC,  
88 - ],  
89 - 'desc' => [  
90 - 'company_info.name' => SORT_DESC,  
91 - 'firstname' => SORT_DESC,  
92 - 'lastname' => SORT_DESC,  
93 - ],  
94 - 'default' => SORT_ASC,  
95 - 'label' => 'Название',  
96 - ],  
97 - 'staff' => [  
98 - 'asc' => [  
99 - 'company_info.staff' => SORT_ASC,  
100 - ],  
101 - 'desc' => [  
102 - 'company_info.staff' => SORT_DESC,  
103 - ],  
104 - 'default' => SORT_DESC,  
105 - 'label' => 'Количество сотрудников',  
106 - ],  
107 - 'visit' => [  
108 - 'asc' => [  
109 - 'user_info.date_visit' => SORT_ASC,  
110 - ],  
111 - 'desc' => [  
112 - 'user_info.date_visit' => SORT_DESC,  
113 - ],  
114 - 'default' => SORT_DESC,  
115 - 'label' => 'Последний визит',  
116 - ],  
117 - 'city' => [  
118 - 'asc' => [  
119 - 'user_info.city' => SORT_ASC,  
120 - ],  
121 - 'desc' => [  
122 - 'user_info.city' => SORT_DESC,  
123 - ],  
124 - 'default' => SORT_ASC,  
125 - 'label' => 'Город',  
126 - ],  
127 - ],  
128 - ]);  
129 $model->load(Yii::$app->request->queryParams); 78 $model->load(Yii::$app->request->queryParams);
130 return $this->render('customer', [ 79 return $this->render('customer', [
131 'model' => $model, 80 'model' => $model,