customer.php
8.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
/**
* @var CustomerSearch $model
* @var ActiveDataProvider $dataProvider
*/
use common\models\CustomerSearch;
use kartik\select2\Select2;
use yii\data\ActiveDataProvider;
use yii\helpers\Html;
use yii\jui\SliderInput;
use yii\web\JsExpression;
use yii\widgets\ActiveForm;
use yii\widgets\LinkSorter;
use yii\widgets\ListView;
$sort_array = $dataProvider->sort->getAttributeOrders();
$active_key = array_keys($sort_array)[ 0 ];
$active_value = $sort_array[ $active_key ];
$sort_name = ( ( $active_value == 4 ) ? '-' : '' ) . $active_key;
?>
<div class="section-box-22 section-box-customer">
<div class="box-wr">
<div class="box-all">
<?php
// == Left filter ==
?>
<div class="left-search-work">
<?php
$form = ActiveForm::begin([
'method' => 'get',
'options' => [ 'class' => 'search-work-form' ],
'action' => [ '' ],
]);
echo $form->field($model, 'city')
->widget(Select2::classname(), [
'options' => [ 'placeholder' => 'Выбор города ...' ],
'pluginOptions' => [
'allowClear' => true,
'minimumInputLength' => 3,
'ajax' => [
'url' => \yii\helpers\Url::to([ 'site/city' ]),
'dataType' => 'json',
'data' => new JsExpression('function(params) { return {q:params.term}; }'),
],
'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
'templateResult' => new JsExpression('function(city) { return city.text; }'),
'templateSelection' => new JsExpression('function (city) { return city.text; }'),
],
]);
echo $form->field($model, 'type', [
'options' => [
'class' => 'blocks-check-list-wrapp',
],
'template' => "<div class='blocks-check-title'>{label}</div>\n{input}<div class='select-after'></div>\n{hint}\n{error}",
])
->dropDownList([
1 => 'Физическое лицо',
2 => 'Компания',
], [ 'prompt' => 'Любой' ]);
?>
<div class="blocks-check-list-wrapp">
<div id="slider-value"></div>
<?php
echo $form->field($model, 'rating', [
'template' => "{label}<br><div id='{$form->id}-rating'>{$model->rating}</div><br>{input}\n{hint}\n{error}",
'labelOptions' => [
'class' => 'blocks-check-title',
],
])
->widget(SliderInput::className(), [
'clientOptions' => [
'min' => 0,
'max' => 10,
'step' => 0.5,
],
'clientEvents' => [
'slide' => "function( event, ui ) {
$( '#{$form->id}-rating' ).text(ui.value);
$('input[name=\"{$model->formName()}[rating]\"]').val(ui.value);
}",
],
]);
?>
</div>
<?php
echo $form->field($model, 'online', [
'options' => [
'class' => 'blocks-check-list-wrapp',
],
'template' => "<div class='blocks-check-title'>{label}</div>\n{input}\n{hint}\n{error}",
])
->radioList([
'' => 'Все',
1 => 'Онлайн',
], [
'item' => function($index, $label, $name, $checked, $value) use ($model) {
$checked = ( $model->online == $value );
return "<div class='blocks-check-list'><input type='radio' id='{$model->formName()}-{$index}' name='{$name}' class='check-search' value='{$value}' " . ( $checked ? 'checked' : '' ) . "><label for='{$model->formName()}-{$index}'><span></span>{$label}</label></div>";
},
'unselect' => NULL,
]);
echo '<div class="blocks-check-list-submit">' . Html::submitInput('Найти') . '</div>';
$form->end();
?>
<script>
$('div.rating').rating(
{
fx : 'full',
}
);
</script>
</div>
<?php
// == End of left filter ==
?>
<?php
// == Page content ==
?>
<div class="right-search-work">
<div class="search-worker-title style">Найти заказчика</div>
<div class="search-worker-title-two style">Заказчики готовые приступить к работе
<span><?= $dataProvider->totalCount ?></span></div>
<div class="search-worker-search-wr style">
<?php
$form2 = ActiveForm::begin([
'method' => 'get',
'action' => [ '' ],
'options' => [ 'class' => 'search-worker-form' ],
]);
echo $form2->field($model, 'info', [ 'options' => [ 'tag' => 'span' ] ])
->label(false)
->textInput([ 'placeholder' => $model->getAttributeLabel('info') ]);
echo Html::submitInput('Найти');
$form2->end();
?>
<a href="#" class="add-to-catalog-search-worker">Добавить себя в каталог</a>
<div class="search-worker-sort-wr style">
<div class="search-worker-sort">Сортировать: </div>
<ul>
<li class="activejob">
<a href="#" data-sort-name="<?= $sort_name ?>"></a>
<div class="sidebar-droped-wr style">
<?php
echo LinkSorter::widget([
'sort' => $dataProvider->sort,
]);
?>
</div>
</li>
</ul>
</div>
</div>
<?php
echo ListView::widget([
'dataProvider' => $dataProvider,
'layout' => "{items}\n{pager}",
'options' => [
'class' => 'search-worker-blocks-wr style',
],
'itemOptions' => [
'class' => 'search-worker-blocks',
],
'itemView' => '_customer_list_view',
]);
?>
<script>
$('div.rating_search_performer').rating(
{
fx : 'full', readOnly : 'true', url : 'rating.php'
}
);
</script>
</div>
<?php
// == End of page content ==
?>
</div>
</div>
</div>