Commit 39a349155dfcd56128a21b854ac439a99fad9e05
1 parent
a22972f9
Commit
Showing
4 changed files
with
175 additions
and
52 deletions
Show diff stats
common/models/TenderSearch.php
@@ -36,7 +36,6 @@ | @@ -36,7 +36,6 @@ | ||
36 | return [ | 36 | return [ |
37 | [ | 37 | [ |
38 | [ | 38 | [ |
39 | - 'specialization', | ||
40 | 'budget_currency', | 39 | 'budget_currency', |
41 | 'contractual', | 40 | 'contractual', |
42 | ], | 41 | ], |
@@ -44,6 +43,7 @@ | @@ -44,6 +43,7 @@ | ||
44 | ], | 43 | ], |
45 | [ | 44 | [ |
46 | [ | 45 | [ |
46 | + 'specialization', | ||
47 | 'city', | 47 | 'city', |
48 | 'payment', | 48 | 'payment', |
49 | 'info', | 49 | 'info', |
frontend/controllers/SearchController.php
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | $dataProvider->setPagination([ | 90 | $dataProvider->setPagination([ |
91 | 'pageSize' => 10, | 91 | 'pageSize' => 10, |
92 | ]); | 92 | ]); |
93 | - $specialization = Specialization::specializationsList(); | 93 | + $specializations = Specialization::getSorted()->all(); |
94 | $currencies = Currency::getCurrencyDropdown(); | 94 | $currencies = Currency::getCurrencyDropdown(); |
95 | $payments = Payment::find() | 95 | $payments = Payment::find() |
96 | ->select([ | 96 | ->select([ |
@@ -103,7 +103,7 @@ | @@ -103,7 +103,7 @@ | ||
103 | return $this->render('project', [ | 103 | return $this->render('project', [ |
104 | 'model' => $model, | 104 | 'model' => $model, |
105 | 'dataProvider' => $dataProvider, | 105 | 'dataProvider' => $dataProvider, |
106 | - 'specialization' => $specialization, | 106 | + 'specializations' => $specializations, |
107 | 'currencies' => $currencies, | 107 | 'currencies' => $currencies, |
108 | 'payments' => $payments, | 108 | 'payments' => $payments, |
109 | ]); | 109 | ]); |
@@ -143,7 +143,7 @@ | @@ -143,7 +143,7 @@ | ||
143 | { | 143 | { |
144 | $searchModel = new SearchVacancyForm(); | 144 | $searchModel = new SearchVacancyForm(); |
145 | 145 | ||
146 | - $specialization = Specialization::specializationsList(); | 146 | + $specializations = Specialization::getSorted()->all(); |
147 | 147 | ||
148 | $query = $searchModel->search(Yii::$app->request->queryParams); | 148 | $query = $searchModel->search(Yii::$app->request->queryParams); |
149 | 149 | ||
@@ -170,7 +170,7 @@ | @@ -170,7 +170,7 @@ | ||
170 | 170 | ||
171 | return $this->render('vacancy', [ | 171 | return $this->render('vacancy', [ |
172 | 'dataProvider' => $dataProvider, | 172 | 'dataProvider' => $dataProvider, |
173 | - 'specialization' => $specialization, | 173 | + 'specializations' => $specializations, |
174 | 'model' => $searchModel, | 174 | 'model' => $searchModel, |
175 | 'pagination' => $pagination, | 175 | 'pagination' => $pagination, |
176 | ]); | 176 | ]); |
frontend/views/search/project.php
@@ -3,10 +3,11 @@ | @@ -3,10 +3,11 @@ | ||
3 | * @var View $this | 3 | * @var View $this |
4 | * @var TenderSearch $model | 4 | * @var TenderSearch $model |
5 | * @var ActiveDataProvider $dataProvider | 5 | * @var ActiveDataProvider $dataProvider |
6 | - * @var array $specialization | 6 | + * @var array $specializations |
7 | * @var array $currencies | 7 | * @var array $currencies |
8 | * @var array $payments | 8 | * @var array $payments |
9 | */ | 9 | */ |
10 | + use common\models\Specialization; | ||
10 | use common\models\TenderSearch; | 11 | use common\models\TenderSearch; |
11 | use kartik\select2\Select2; | 12 | use kartik\select2\Select2; |
12 | use yii\data\ActiveDataProvider; | 13 | use yii\data\ActiveDataProvider; |
@@ -35,8 +36,71 @@ | @@ -35,8 +36,71 @@ | ||
35 | ->textInput([ 'class' => 'form-control', | 36 | ->textInput([ 'class' => 'form-control', |
36 | 'placeholder' => 'Текст для поиска', | 37 | 'placeholder' => 'Текст для поиска', |
37 | ]); | 38 | ]); |
39 | + ?> | ||
40 | + <?php | ||
41 | + // New specialization chooser | ||
42 | + ?> | ||
43 | + <div class="input-blocks-wrapper admin-menu-list"> | ||
44 | + <div class="input-blocks" style="width: 100%; margin-bottom: 5px"> | ||
45 | + <label>Специализации</label> | ||
46 | + <div class="required"></div> | ||
47 | + </div> | ||
48 | + <div class="new-spec-block style"> | ||
49 | + <ul class="content-menu-first"> | ||
50 | + <?php foreach($specializations as $specialization): ?> | ||
51 | + <li data-img="<?= $specialization->image ?>"> | ||
52 | + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a> | ||
53 | + <ul> | ||
54 | + <?php foreach($specialization->children as $child_first): ?> | ||
55 | + | ||
56 | + <?php if($child_first instanceof Specialization): ?> | ||
57 | + <li> | ||
58 | + <a href="#"><?= $child_first->specialization_name ?></a> | ||
59 | + <ul> | ||
60 | + <?php foreach($child_first->children as $child_second): ?> | ||
61 | + <?php if($child_first instanceof Specialization): ?> | ||
62 | + <li> | ||
63 | + <a href="#" title="<?= $child_second->specialization_name ?>"> | ||
64 | + <?= $form->field($model, "specialization[{$child_second->specialization_id}]", [ | ||
65 | + 'template' => '{input}{label}{hint}{error}', | ||
66 | + ]) | ||
67 | + ->label('<span></span>' . $child_second->specialization_name) | ||
68 | + ->checkbox([ | ||
69 | + 'value' => $child_second->specialization_id, | ||
70 | + 'label' => NULL, | ||
71 | + 'uncheck' => NULL, | ||
72 | + 'class' => 'custom-check', | ||
73 | + ], false) ?> | ||
74 | + </a> | ||
75 | + </li> | ||
76 | + <?php endif; ?> | ||
77 | + <?php endforeach; ?> | ||
78 | + </ul> | ||
79 | + </li> | ||
80 | + <?php endif; ?> | ||
81 | + <?php endforeach; ?> | ||
82 | + | ||
83 | + </ul> | ||
84 | + </li> | ||
85 | + <?php endforeach; ?> | ||
86 | + </ul> | ||
87 | + </div> | ||
88 | + <div class="style admn-menu-err"> | ||
89 | + <div class="help-block">Необходимо выбрать хотя бы одну «специализацию».</div> | ||
90 | + </div> | ||
91 | + </div> | ||
92 | + | ||
93 | + <div class="admin-specialization-selected style"> | ||
94 | + <ul></ul> | ||
95 | + </div> | ||
96 | + <?php | ||
97 | + // End of new specialization chooser | ||
98 | + ?> | ||
99 | + <?php | ||
100 | + /* | ||
38 | echo $form->field($model, 'specialization') | 101 | echo $form->field($model, 'specialization') |
39 | ->dropDownList($specialization, [ 'prompt' => 'Любая' ]); | 102 | ->dropDownList($specialization, [ 'prompt' => 'Любая' ]); |
103 | + */ | ||
40 | 104 | ||
41 | echo $form->field($model, 'city') | 105 | echo $form->field($model, 'city') |
42 | ->widget(Select2::classname(), [ | 106 | ->widget(Select2::classname(), [ |
frontend/views/search/vacancy.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | -use kartik\select2\Select2; | ||
4 | -use \yii\helpers\Html; | ||
5 | -use yii\web\JsExpression; | ||
6 | -use yii\widgets\ActiveForm; | ||
7 | -use yii\widgets\LinkPager; | ||
8 | -use yii\widgets\ListView; | 3 | + use common\models\Specialization; |
4 | + use kartik\select2\Select2; | ||
5 | + use \yii\helpers\Html; | ||
6 | + use yii\web\JsExpression; | ||
7 | + use yii\widgets\ActiveForm; | ||
8 | + use yii\widgets\LinkPager; | ||
9 | + use yii\widgets\ListView; | ||
9 | 10 | ||
10 | -/* @var $this yii\web\View */ | 11 | + /* @var $this yii\web\View */ |
11 | 12 | ||
12 | -$this->title = 'My Yii Application'; | 13 | + $this->title = 'My Yii Application'; |
13 | ?> | 14 | ?> |
14 | 15 | ||
15 | <div class="section-box content"> | 16 | <div class="section-box content"> |
@@ -19,37 +20,99 @@ $this->title = 'My Yii Application'; | @@ -19,37 +20,99 @@ $this->title = 'My Yii Application'; | ||
19 | <div class="performer-vacancy-sidebar-left-wr vacancy-general-sidebar-wr"> | 20 | <div class="performer-vacancy-sidebar-left-wr vacancy-general-sidebar-wr"> |
20 | <div class="left-search-work"> | 21 | <div class="left-search-work"> |
21 | <?php | 22 | <?php |
22 | - $form = ActiveForm::begin(['options'=>['class'=>'search-work-form'],'action'=>[''], 'method'=>'get']); | 23 | + $form = ActiveForm::begin([ |
24 | + 'options' => [ 'class' => 'search-work-form' ], | ||
25 | + 'action' => [ '' ], | ||
26 | + 'method' => 'get', | ||
27 | + ]); | ||
23 | ?> | 28 | ?> |
24 | 29 | ||
25 | - <?= | ||
26 | - $form->field($model, 'city') | ||
27 | - ->widget(Select2::classname(), [ | ||
28 | - 'options' => [ 'placeholder' => 'Выбор города ...' ], | ||
29 | - 'pluginOptions' => [ | ||
30 | - 'allowClear' => true, | ||
31 | - 'minimumInputLength' => 3, | ||
32 | - 'ajax' => [ | ||
33 | - 'url' => \yii\helpers\Url::to([ 'site/city' ]), | ||
34 | - 'dataType' => 'json', | ||
35 | - 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | ||
36 | - ], | ||
37 | - 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), | ||
38 | - 'templateResult' => new JsExpression('function(city) { return city.text; }'), | ||
39 | - 'templateSelection' => new JsExpression('function (city) { return city.text; }'), | ||
40 | - ], | ||
41 | - ]); | ||
42 | - ?> | ||
43 | - | ||
44 | - <?= | ||
45 | - $form->field($model, 'specialization') | ||
46 | - ->dropDownList($specialization, ['prompt' => 'Любая']); | ||
47 | - ?> | 30 | + <?= $form->field($model, 'city') |
31 | + ->widget(Select2::classname(), [ | ||
32 | + 'options' => [ 'placeholder' => 'Выбор города ...' ], | ||
33 | + 'pluginOptions' => [ | ||
34 | + 'allowClear' => true, | ||
35 | + 'minimumInputLength' => 3, | ||
36 | + 'ajax' => [ | ||
37 | + 'url' => \yii\helpers\Url::to([ 'site/city' ]), | ||
38 | + 'dataType' => 'json', | ||
39 | + 'data' => new JsExpression('function(params) { return {q:params.term}; }'), | ||
40 | + ], | ||
41 | + 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), | ||
42 | + 'templateResult' => new JsExpression('function(city) { return city.text; }'), | ||
43 | + 'templateSelection' => new JsExpression('function (city) { return city.text; }'), | ||
44 | + ], | ||
45 | + ]); ?> | ||
46 | + <?php | ||
47 | + // New specialization chooser | ||
48 | + ?> | ||
49 | + <div class="input-blocks-wrapper admin-menu-list"> | ||
50 | + <div class="input-blocks" style="width: 100%; margin-bottom: 5px"> | ||
51 | + <label>Специализации</label> | ||
52 | + <div class="required"></div> | ||
53 | + </div> | ||
54 | + <div class="new-spec-block style"> | ||
55 | + <ul class="content-menu-first"> | ||
56 | + <?php foreach($specializations as $specialization): ?> | ||
57 | + <li data-img="<?= $specialization->image ?>"> | ||
58 | + <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a> | ||
59 | + <ul> | ||
60 | + <?php foreach($specialization->children as $child_first): ?> | ||
48 | 61 | ||
62 | + <?php if($child_first instanceof Specialization): ?> | ||
63 | + <li> | ||
64 | + <a href="#"><?= $child_first->specialization_name ?></a> | ||
65 | + <ul> | ||
66 | + <?php foreach($child_first->children as $child_second): ?> | ||
67 | + <?php if($child_first instanceof Specialization): ?> | ||
68 | + <li> | ||
69 | + <a href="#" title="<?= $child_second->specialization_name ?>"> | ||
70 | + <?= $form->field($model, "specialization[{$child_second->specialization_id}]", [ | ||
71 | + 'template' => '{input}{label}{hint}{error}', | ||
72 | + ]) | ||
73 | + ->label('<span></span>' . $child_second->specialization_name) | ||
74 | + ->checkbox([ | ||
75 | + 'value' => $child_second->specialization_id, | ||
76 | + 'label' => NULL, | ||
77 | + 'uncheck' => NULL, | ||
78 | + 'class' => 'custom-check', | ||
79 | + ], false) ?> | ||
80 | + </a> | ||
81 | + </li> | ||
82 | + <?php endif; ?> | ||
83 | + <?php endforeach; ?> | ||
84 | + </ul> | ||
85 | + </li> | ||
86 | + <?php endif; ?> | ||
87 | + <?php endforeach; ?> | ||
49 | 88 | ||
50 | - <div class="blocks-check-list-submit"> | ||
51 | - <?= Html::submitInput('Найти') ?> | 89 | + </ul> |
90 | + </li> | ||
91 | + <?php endforeach; ?> | ||
92 | + </ul> | ||
93 | + </div> | ||
94 | + <div class="style admn-menu-err"> | ||
95 | + <div class="help-block">Необходимо выбрать хотя бы одну «специализацию».</div> | ||
52 | </div> | 96 | </div> |
97 | + </div> | ||
98 | + | ||
99 | + <div class="admin-specialization-selected style"> | ||
100 | + <ul></ul> | ||
101 | + </div> | ||
102 | + <?php | ||
103 | + // End of new specialization chooser | ||
104 | + ?> | ||
105 | + <?php | ||
106 | + /* | ||
107 | + $form->field($model, 'specialization') | ||
108 | + ->dropDownList($specialization, ['prompt' => 'Любая']); | ||
109 | + */ | ||
110 | + ?> | ||
111 | + | ||
112 | + | ||
113 | + <div class="blocks-check-list-submit"> | ||
114 | + <?= Html::submitInput('Найти') ?> | ||
115 | + </div> | ||
53 | <?php | 116 | <?php |
54 | $form->end(); | 117 | $form->end(); |
55 | ?> | 118 | ?> |
@@ -59,20 +122,16 @@ $this->title = 'My Yii Application'; | @@ -59,20 +122,16 @@ $this->title = 'My Yii Application'; | ||
59 | <div class="performer-vacancy-vacant-title style">Вакансии</div> | 122 | <div class="performer-vacancy-vacant-title style">Вакансии</div> |
60 | <div class="performer-vacancy-vacant-title-reclam-wr style"> | 123 | <div class="performer-vacancy-vacant-title-reclam-wr style"> |
61 | 124 | ||
62 | - <?= | ||
63 | - ListView::widget([ | ||
64 | - 'dataProvider' => $dataProvider, | ||
65 | - 'itemView' => '_vacancy_list_view', | ||
66 | - 'summary' => false, | ||
67 | - ]); | ||
68 | - ?> | 125 | + <?= ListView::widget([ |
126 | + 'dataProvider' => $dataProvider, | ||
127 | + 'itemView' => '_vacancy_list_view', | ||
128 | + 'summary' => false, | ||
129 | + ]); ?> | ||
69 | </div> | 130 | </div> |
70 | <div class="navi-buttons-wr style"> | 131 | <div class="navi-buttons-wr style"> |
71 | - <?= | ||
72 | - LinkPager::widget([ | ||
73 | - 'pagination' => $pagination | ||
74 | - ]) | ||
75 | - ?> | 132 | + <?= LinkPager::widget([ |
133 | + 'pagination' => $pagination, | ||
134 | + ]) ?> | ||
76 | </div> | 135 | </div> |
77 | </div> | 136 | </div> |
78 | </div> | 137 | </div> |