diff --git a/common/config/main.php b/common/config/main.php index 071f0df..c3405c3 100755 --- a/common/config/main.php +++ b/common/config/main.php @@ -96,6 +96,7 @@ ], 'formatter' => [ 'booleanFormat' => ['Нет', 'Да'], + 'defaultTimeZone' => 'Europe/Kiev', ], 'urlManager' => [ 'enablePrettyUrl' => true, diff --git a/common/models/CustomerSearch.php b/common/models/CustomerSearch.php index 243402d..c8c60bb 100644 --- a/common/models/CustomerSearch.php +++ b/common/models/CustomerSearch.php @@ -37,13 +37,13 @@ 'integer', ], [ - ['rating'], + [ 'rating' ], 'number', 'min' => 0, 'max' => 5, ], [ - ['rating'], + [ 'rating' ], 'default', 'value' => 0, ], @@ -63,11 +63,11 @@ public function attributeLabels() { return [ - 'type' => Yii::t('app', 'Тип заказчика'), - 'rating' => Yii::t('app', 'Рейтинг'), - 'online' => Yii::t('app', 'Статус'), - 'city' => Yii::t('app', 'Город'), - 'info' => Yii::t('app', 'Любая информация о заказчике'), + 'type' => Yii::t('app', 'Тип заказчика'), + 'rating' => Yii::t('app', 'Рейтинг'), + 'online' => Yii::t('app', 'Статус'), + 'city' => Yii::t('app', 'Город'), + 'info' => Yii::t('app', 'Любая информация о заказчике'), ]; } @@ -133,61 +133,62 @@ } $query->andFilterWhere([ - '>=', 'user_info.rating', $this->rating, + '>=', + 'user_info.rating', + $this->rating, ]); $query->andFilterWhere([ - 'like', - 'user_info.city', - $this->city, - ])->andFilterWhere([ - 'or', - [ - 'like', - 'LOWER(username)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(lastname)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(firstname)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(middlename)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(company_info.name)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(company_info.street)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(user_info.country)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(user_info.city)', - mb_strtolower($this->info), - ], - [ - 'like', - 'LOWER(user_info.about)', - mb_strtolower($this->info), - ], - ]); + 'user_info.city' => $this->city, + ]) + ->andFilterWhere([ + 'or', + [ + 'like', + 'LOWER(username)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(lastname)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(firstname)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(middlename)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(company_info.name)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(company_info.street)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(user_info.country)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(user_info.city)', + mb_strtolower($this->info), + ], + [ + 'like', + 'LOWER(user_info.about)', + mb_strtolower($this->info), + ], + ]); return $dataProvider; } diff --git a/frontend/controllers/SearchController.php b/frontend/controllers/SearchController.php index 4c40602..6c386e7 100755 --- a/frontend/controllers/SearchController.php +++ b/frontend/controllers/SearchController.php @@ -124,16 +124,9 @@ ], ]); $model->load(Yii::$app->request->queryParams); - $cities = UserInfo::find() - ->select('city') - ->distinct() - ->asArray() - ->indexBy('city') - ->column(); return $this->render('customer', [ 'model' => $model, 'dataProvider' => $dataProvider, - 'cities' => $cities, ]); } diff --git a/frontend/views/search/_customer_list_view.php b/frontend/views/search/_customer_list_view.php index f6f86d2..4954370 100644 --- a/frontend/views/search/_customer_list_view.php +++ b/frontend/views/search/_customer_list_view.php @@ -52,7 +52,14 @@ } ?>