Commit 90924316bb9c0df219d3d71cd7653d1a39f42117
1 parent
2fd40ee7
test
Showing
3 changed files
with
37 additions
and
19 deletions
Show diff stats
common/models/CustomerSearch.php
| ... | ... | @@ -32,12 +32,22 @@ |
| 32 | 32 | [ |
| 33 | 33 | [ |
| 34 | 34 | 'type', |
| 35 | - 'rating', | |
| 36 | 35 | 'online', |
| 37 | 36 | ], |
| 38 | 37 | 'integer', |
| 39 | 38 | ], |
| 40 | 39 | [ |
| 40 | + ['rating'], | |
| 41 | + 'number', | |
| 42 | + 'min' => 0, | |
| 43 | + 'max' => 5, | |
| 44 | + ], | |
| 45 | + [ | |
| 46 | + ['rating'], | |
| 47 | + 'default', | |
| 48 | + 'value' => 0, | |
| 49 | + ], | |
| 50 | + [ | |
| 41 | 51 | [ |
| 42 | 52 | 'city', |
| 43 | 53 | 'info', |
| ... | ... | @@ -123,7 +133,7 @@ |
| 123 | 133 | } |
| 124 | 134 | |
| 125 | 135 | $query->andFilterWhere([ |
| 126 | - 'user_info.rating' => $this->rating, | |
| 136 | + '>=', 'user_info.rating', $this->rating, | |
| 127 | 137 | ]); |
| 128 | 138 | |
| 129 | 139 | $query->andFilterWhere([ | ... | ... |
frontend/views/search/_customer_list_view.php
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | } |
| 53 | 53 | ?> |
| 54 | 54 | <div class="search_perform_visit"> |
| 55 | - <span>Послелний визит:</span> <?= \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit) ?> | |
| 55 | + <span>Последний визит:</span> <?= \Yii::$app->formatter->asRelativeTime($model->userInfo->date_visit) ?> | |
| 56 | 56 | </div> |
| 57 | 57 | <div class="search_perform_projets_nam"> |
| 58 | 58 | <?= Html::a("Заказано проектов {$model->getProjects()->count()}", ['search/project', (new Project())->formName().'[user_id]' => $model->id]) ?> | ... | ... |
frontend/views/search/customer.php
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | use common\models\CustomerSearch; |
| 8 | 8 | use yii\data\ActiveDataProvider; |
| 9 | 9 | use yii\helpers\Html; |
| 10 | + use yii\jui\SliderInput; | |
| 10 | 11 | use yii\widgets\ActiveForm; |
| 11 | 12 | use yii\widgets\LinkSorter; |
| 12 | 13 | use yii\widgets\ListView; |
| ... | ... | @@ -50,22 +51,29 @@ |
| 50 | 51 | ], [ 'prompt' => 'Любой' ]); |
| 51 | 52 | ?> |
| 52 | 53 | <div class="blocks-check-list-wrapp"> |
| 53 | - <div class="blocks-check-title">Рейтинг</div> | |
| 54 | - <div class=""> | |
| 55 | - <?php | |
| 56 | - echo $form->field($model, 'rating') | |
| 57 | - ->label(false) | |
| 58 | - ->radioList([ | |
| 59 | - '' => 'Все', | |
| 60 | - 0 => 0, | |
| 61 | - 1 => 1, | |
| 62 | - 2 => 2, | |
| 63 | - 3 => 3, | |
| 64 | - 4 => 4, | |
| 65 | - 5 => 5, | |
| 66 | - ]); | |
| 67 | - ?> | |
| 68 | - </div> | |
| 54 | + <div id="slider-value"></div> | |
| 55 | + <?php | |
| 56 | + echo $form->field($model, 'rating', [ | |
| 57 | + 'template' => "{label}<br><div id='{$form->id}-rating'>{$model->rating}</div><br>{input}\n{hint}\n{error}", | |
| 58 | + 'labelOptions' => [ | |
| 59 | + 'class' => 'blocks-check-title', | |
| 60 | + ], | |
| 61 | + ]) | |
| 62 | + ->widget(SliderInput::className(), [ | |
| 63 | + 'clientOptions' => [ | |
| 64 | + 'min' => 0, | |
| 65 | + 'max' => 5, | |
| 66 | + 'step' => 0.5, | |
| 67 | + ], | |
| 68 | + 'clientEvents' => [ | |
| 69 | + 'slide' => "function( event, ui ) { | |
| 70 | + $( '#{$form->id}-rating' ).text(ui.value); | |
| 71 | + $('input[name=\"{$model->formName()}[rating]\"]').val(ui.value); | |
| 72 | + | |
| 73 | + }", | |
| 74 | + ], | |
| 75 | + ]); | |
| 76 | + ?> | |
| 69 | 77 | </div> |
| 70 | 78 | |
| 71 | 79 | <?php | ... | ... |