From 90924316bb9c0df219d3d71cd7653d1a39f42117 Mon Sep 17 00:00:00 2001 From: Yarik Date: Fri, 11 Mar 2016 18:34:58 +0200 Subject: [PATCH] test --- common/models/CustomerSearch.php | 14 ++++++++++++-- frontend/views/search/_customer_list_view.php | 2 +- frontend/views/search/customer.php | 40 ++++++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/common/models/CustomerSearch.php b/common/models/CustomerSearch.php index 91fce55..243402d 100644 --- a/common/models/CustomerSearch.php +++ b/common/models/CustomerSearch.php @@ -32,12 +32,22 @@ [ [ 'type', - 'rating', 'online', ], 'integer', ], [ + ['rating'], + 'number', + 'min' => 0, + 'max' => 5, + ], + [ + ['rating'], + 'default', + 'value' => 0, + ], + [ [ 'city', 'info', @@ -123,7 +133,7 @@ } $query->andFilterWhere([ - 'user_info.rating' => $this->rating, + '>=', 'user_info.rating', $this->rating, ]); $query->andFilterWhere([ diff --git a/frontend/views/search/_customer_list_view.php b/frontend/views/search/_customer_list_view.php index 783d37f..f6f86d2 100644 --- a/frontend/views/search/_customer_list_view.php +++ b/frontend/views/search/_customer_list_view.php @@ -52,7 +52,7 @@ } ?>
- Послелний визит: formatter->asRelativeTime($model->userInfo->date_visit) ?> + Последний визит: formatter->asRelativeTime($model->userInfo->date_visit) ?>
getProjects()->count()}", ['search/project', (new Project())->formName().'[user_id]' => $model->id]) ?> diff --git a/frontend/views/search/customer.php b/frontend/views/search/customer.php index a70e687..4919ae0 100644 --- a/frontend/views/search/customer.php +++ b/frontend/views/search/customer.php @@ -7,6 +7,7 @@ use common\models\CustomerSearch; use yii\data\ActiveDataProvider; use yii\helpers\Html; + use yii\jui\SliderInput; use yii\widgets\ActiveForm; use yii\widgets\LinkSorter; use yii\widgets\ListView; @@ -50,22 +51,29 @@ ], [ 'prompt' => 'Любой' ]); ?>
-
Рейтинг
-
- field($model, 'rating') - ->label(false) - ->radioList([ - '' => 'Все', - 0 => 0, - 1 => 1, - 2 => 2, - 3 => 3, - 4 => 4, - 5 => 5, - ]); - ?> -
+
+ field($model, 'rating', [ + 'template' => "{label}
{$model->rating}

{input}\n{hint}\n{error}", + 'labelOptions' => [ + 'class' => 'blocks-check-title', + ], + ]) + ->widget(SliderInput::className(), [ + 'clientOptions' => [ + 'min' => 0, + 'max' => 5, + 'step' => 0.5, + ], + 'clientEvents' => [ + 'slide' => "function( event, ui ) { + $( '#{$form->id}-rating' ).text(ui.value); + $('input[name=\"{$model->formName()}[rating]\"]').val(ui.value); + + }", + ], + ]); + ?>