Commit a41edafc6fe25b5b1f368a2ef13e3f4ac5e4b94d
1 parent
816e328e
test
Showing
6 changed files
with
53 additions
and
29 deletions
Show diff stats
common/models/Vacancy.php
@@ -29,6 +29,8 @@ | @@ -29,6 +29,8 @@ | ||
29 | class Vacancy extends \yii\db\ActiveRecord | 29 | class Vacancy extends \yii\db\ActiveRecord |
30 | { | 30 | { |
31 | 31 | ||
32 | + const STATUS_ACTIVE = 1; | ||
33 | + const STATUS_CLOSED = 3; | ||
32 | /** | 34 | /** |
33 | * @inheritdoc | 35 | * @inheritdoc |
34 | */ | 36 | */ |
@@ -82,10 +84,15 @@ | @@ -82,10 +84,15 @@ | ||
82 | 'safe', | 84 | 'safe', |
83 | ], | 85 | ], |
84 | [ | 86 | [ |
85 | - ['salary_currency'], | 87 | + ['salary_currency', 'status',], |
86 | 'integer' | 88 | 'integer' |
87 | ], | 89 | ], |
88 | [ | 90 | [ |
91 | + ['salary'], | ||
92 | + 'integer', | ||
93 | + 'min' => 0, | ||
94 | + ], | ||
95 | + [ | ||
89 | [ 'employmentInput', 'specializationInput' ], | 96 | [ 'employmentInput', 'specializationInput' ], |
90 | 'default', | 97 | 'default', |
91 | 'value' => [], | 98 | 'value' => [], |
@@ -96,6 +103,11 @@ | @@ -96,6 +103,11 @@ | ||
96 | 'value' => 0, | 103 | 'value' => 0, |
97 | ], | 104 | ], |
98 | [ | 105 | [ |
106 | + [ 'status' ], | ||
107 | + 'default', | ||
108 | + 'value' => 1, | ||
109 | + ], | ||
110 | + [ | ||
99 | [ | 111 | [ |
100 | 'name', | 112 | 'name', |
101 | 'link', | 113 | 'link', |
common/models/VacancySearch.php
@@ -112,16 +112,11 @@ | @@ -112,16 +112,11 @@ | ||
112 | 112 | ||
113 | $query->andFilterWhere([ | 113 | $query->andFilterWhere([ |
114 | 'like', | 114 | 'like', |
115 | - 'name', | ||
116 | - $this->name, | 115 | + 'LOWER(name)', |
116 | + mb_strtolower($this->name), | ||
117 | ]) | 117 | ]) |
118 | ->andFilterWhere([ | 118 | ->andFilterWhere([ |
119 | 'like', | 119 | 'like', |
120 | - 'link', | ||
121 | - $this->link, | ||
122 | - ]) | ||
123 | - ->andFilterWhere([ | ||
124 | - 'like', | ||
125 | 'user_name', | 120 | 'user_name', |
126 | $this->user_name, | 121 | $this->user_name, |
127 | ]) | 122 | ]) |
common/widgets/views/requirements_field.php
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | <?php endfor; ?> | 26 | <?php endfor; ?> |
27 | 27 | ||
28 | </div> | 28 | </div> |
29 | - <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить поле</p> | 29 | + <p class="btn btn-success add_field_<?= $this->context->id ?>">Добавить еще</p> |
30 | </fieldset> | 30 | </fieldset> |
31 | <script> | 31 | <script> |
32 | var start_i_<?=$this->context->id?> = <?=$i?>; | 32 | var start_i_<?=$this->context->id?> = <?=$i?>; |
frontend/controllers/AccountsController.php
@@ -416,16 +416,15 @@ | @@ -416,16 +416,15 @@ | ||
416 | $post = \Yii::$app->request->post(); | 416 | $post = \Yii::$app->request->post(); |
417 | if(!empty( $post )) { | 417 | if(!empty( $post )) { |
418 | 418 | ||
419 | - | ||
420 | - if($user_info->load($post)){ | 419 | + if($user_info->load($post)) { |
421 | $user_info->save(); | 420 | $user_info->save(); |
422 | } | 421 | } |
423 | 422 | ||
424 | - if($company_info->load($post)){ | 423 | + if($company_info->load($post)) { |
425 | $company_info->save(); | 424 | $company_info->save(); |
426 | } | 425 | } |
427 | 426 | ||
428 | - if($user->load($post) && $user->save() ) { | 427 | + if($user->load($post) && $user->save()) { |
429 | \Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена'); | 428 | \Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена'); |
430 | } else { | 429 | } else { |
431 | \Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму'); | 430 | \Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму'); |
@@ -730,7 +729,7 @@ | @@ -730,7 +729,7 @@ | ||
730 | foreach($project->paymentInput as $one_payment) { | 729 | foreach($project->paymentInput as $one_payment) { |
731 | $project->link('payments', Payment::findOne($one_payment)); | 730 | $project->link('payments', Payment::findOne($one_payment)); |
732 | } | 731 | } |
733 | - return $this->redirect(['projects']); | 732 | + return $this->redirect([ 'projects' ]); |
734 | } | 733 | } |
735 | } | 734 | } |
736 | return $this->render('_projects_form', [ | 735 | return $this->render('_projects_form', [ |
@@ -957,9 +956,9 @@ | @@ -957,9 +956,9 @@ | ||
957 | 'department' => $department, | 956 | 'department' => $department, |
958 | 'country' => $country, | 957 | 'country' => $country, |
959 | ]); | 958 | ]); |
960 | -// return $this->redirect([ | ||
961 | -// 'team', | ||
962 | -// ]); | 959 | + // return $this->redirect([ |
960 | + // 'team', | ||
961 | + // ]); | ||
963 | } else { | 962 | } else { |
964 | return $this->render('_team_form', [ | 963 | return $this->render('_team_form', [ |
965 | 'team' => $team, | 964 | 'team' => $team, |
@@ -1026,10 +1025,14 @@ | @@ -1026,10 +1025,14 @@ | ||
1026 | ->orderBy('specialization_id') | 1025 | ->orderBy('specialization_id') |
1027 | ->all(); | 1026 | ->all(); |
1028 | $currencies = Currency::getCurrencyDropdown(); | 1027 | $currencies = Currency::getCurrencyDropdown(); |
1028 | + $user = \Yii::$app->user->identity; | ||
1029 | $post = \Yii::$app->request->post(); | 1029 | $post = \Yii::$app->request->post(); |
1030 | if(!empty( $post )) { | 1030 | if(!empty( $post )) { |
1031 | $vacancy->load($post); | 1031 | $vacancy->load($post); |
1032 | $vacancy->validate(); | 1032 | $vacancy->validate(); |
1033 | + if(empty( $vacancy->specializationInput )) { | ||
1034 | + $vacancy->addError('specializationInput'); | ||
1035 | + } | ||
1033 | if(!$vacancy->hasErrors()) { | 1036 | if(!$vacancy->hasErrors()) { |
1034 | $vacancy->save(); | 1037 | $vacancy->save(); |
1035 | Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru'); | 1038 | Fields::saveFieldData(Yii::$app->request->post('Fields'), $vacancy->vacancy_id, Vacancy::className(), 'ru'); |
@@ -1051,6 +1054,7 @@ | @@ -1051,6 +1054,7 @@ | ||
1051 | 'employment' => $employment, | 1054 | 'employment' => $employment, |
1052 | 'currencies' => $currencies, | 1055 | 'currencies' => $currencies, |
1053 | 'specializations' => $specializations, | 1056 | 'specializations' => $specializations, |
1057 | + 'user' => $user, | ||
1054 | ]); | 1058 | ]); |
1055 | } | 1059 | } |
1056 | 1060 | ||
@@ -1083,6 +1087,7 @@ | @@ -1083,6 +1087,7 @@ | ||
1083 | ->where([ 'specialization_pid' => 0 ]) | 1087 | ->where([ 'specialization_pid' => 0 ]) |
1084 | ->orderBy('specialization_id') | 1088 | ->orderBy('specialization_id') |
1085 | ->all(); | 1089 | ->all(); |
1090 | + $user = \Yii::$app->user->identity; | ||
1086 | $currencies = Currency::getCurrencyDropdown(); | 1091 | $currencies = Currency::getCurrencyDropdown(); |
1087 | $post = \Yii::$app->request->post(); | 1092 | $post = \Yii::$app->request->post(); |
1088 | if(!empty( $post )) { | 1093 | if(!empty( $post )) { |
@@ -1111,6 +1116,7 @@ | @@ -1111,6 +1116,7 @@ | ||
1111 | 'employment' => $employment, | 1116 | 'employment' => $employment, |
1112 | 'currencies' => $currencies, | 1117 | 'currencies' => $currencies, |
1113 | 'specializations' => $specializations, | 1118 | 'specializations' => $specializations, |
1119 | + 'user' => $user, | ||
1114 | ]); | 1120 | ]); |
1115 | } | 1121 | } |
1116 | 1122 |
frontend/views/accounts/_vacancy_form.php
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | * @var Employment[] $employment | 4 | * @var Employment[] $employment |
5 | * @var string[] $currencies | 5 | * @var string[] $currencies |
6 | * @var Specialization[] $specializations | 6 | * @var Specialization[] $specializations |
7 | + * @var User $user | ||
7 | */ | 8 | */ |
8 | use common\components\Request; | 9 | use common\components\Request; |
9 | use common\models\Employment; | 10 | use common\models\Employment; |
@@ -15,6 +16,7 @@ | @@ -15,6 +16,7 @@ | ||
15 | use yii\helpers\Html; | 16 | use yii\helpers\Html; |
16 | use yii\web\JsExpression; | 17 | use yii\web\JsExpression; |
17 | use yii\widgets\ActiveForm; | 18 | use yii\widgets\ActiveForm; |
19 | + use common\models\User; | ||
18 | 20 | ||
19 | $this->title = 'Вакансии'; | 21 | $this->title = 'Вакансии'; |
20 | $this->params[ 'breadcrumbs' ][] = $this->title; | 22 | $this->params[ 'breadcrumbs' ][] = $this->title; |
@@ -38,7 +40,7 @@ | @@ -38,7 +40,7 @@ | ||
38 | <div class="input-blocks"> | 40 | <div class="input-blocks"> |
39 | <?= $form->field($vacancy, 'user_name') | 41 | <?= $form->field($vacancy, 'user_name') |
40 | ->textInput (['class'=> 'custom-input-2']); ?> | 42 | ->textInput (['class'=> 'custom-input-2']); ?> |
41 | - <span class="admin-hint-vacancy-contact">Вы</span> | 43 | + <span class="admin-hint-vacancy-contact form_auto_data" data-value="<?=$user->firstname.' '.$user->lastname?>">Вы</span> |
42 | </div> | 44 | </div> |
43 | </div> | 45 | </div> |
44 | 46 | ||
@@ -46,7 +48,6 @@ | @@ -46,7 +48,6 @@ | ||
46 | <div class="input-blocks"> | 48 | <div class="input-blocks"> |
47 | <?= $form->field($vacancy, 'phone') | 49 | <?= $form->field($vacancy, 'phone') |
48 | ->textInput (['class'=> 'custom-input-2']); ?> | 50 | ->textInput (['class'=> 'custom-input-2']); ?> |
49 | - <span class="admin-hint-vacancy-contact">Ваш</span> | ||
50 | </div> | 51 | </div> |
51 | </div> | 52 | </div> |
52 | 53 | ||
@@ -69,7 +70,7 @@ | @@ -69,7 +70,7 @@ | ||
69 | ], | 70 | ], |
70 | ]); | 71 | ]); |
71 | ?> | 72 | ?> |
72 | - <span class="admin-hint-vacancy-contact">Ваш</span> | 73 | + <span class="admin-hint-vacancy-contact form_auto_data" data-value="<?=$user->userInfo->city?>">Ваш</span> |
73 | </div> | 74 | </div> |
74 | </div> | 75 | </div> |
75 | 76 | ||
@@ -80,7 +81,7 @@ | @@ -80,7 +81,7 @@ | ||
80 | 'options' => [ 'class' => 'form-inline' ], | 81 | 'options' => [ 'class' => 'form-inline' ], |
81 | ]) | 82 | ]) |
82 | ->label('Заработная плата') | 83 | ->label('Заработная плата') |
83 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | 84 | + ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number', 'min' => 0]); |
84 | ?> | 85 | ?> |
85 | </div> | 86 | </div> |
86 | <div class="input-blocks admin-currency-second"> | 87 | <div class="input-blocks admin-currency-second"> |
@@ -214,9 +215,14 @@ | @@ -214,9 +215,14 @@ | ||
214 | $form->end(); | 215 | $form->end(); |
215 | ?> | 216 | ?> |
216 | <script> | 217 | <script> |
217 | - $(document).ready(function(){ | 218 | + $(function() { |
218 | $('.input-blocks.admin-currency-second select').change(function(){ | 219 | $('.input-blocks.admin-currency-second select').change(function(){ |
219 | $(this).blur() | 220 | $(this).blur() |
220 | - }) | ||
221 | - }) | 221 | + }); |
222 | + $(document).on('click', '.form_auto_data', function() { | ||
223 | + var value = $(this).data('value'); | ||
224 | + var container = $(this).parents('.input-blocks').first(); | ||
225 | + $('#vacancy-city').select2().val(value).trigger('change'); | ||
226 | + }); | ||
227 | + }); | ||
222 | </script> | 228 | </script> |
223 | \ No newline at end of file | 229 | \ No newline at end of file |
frontend/views/company/_company_list_view.php
1 | <?php | 1 | <?php |
2 | -use yii\helpers\Html; | ||
3 | -use yii\helpers\Url; | ||
4 | - | 2 | + use yii\helpers\Html; |
3 | + use yii\helpers\Url; | ||
5 | 4 | ||
6 | ?> | 5 | ?> |
7 | <div class="command-block-wrapper"> | 6 | <div class="command-block-wrapper"> |
8 | <div class="command-block-wr-two"> | 7 | <div class="command-block-wr-two"> |
9 | <div class="command-block-foto"> | 8 | <div class="command-block-foto"> |
10 | - <?= Html::a(($model->photo ? Html::img($model->photo) : '') . '<div class="hover-command-bg"></div>', Url::toRoute(['#']))?> | 9 | + <?= Html::a(( $model->photo ? Html::img($model->photo) : '' ) . '<div class="hover-command-bg"></div>', Url::toRoute([ '#' ])) ?> |
11 | </div> | 10 | </div> |
12 | <div class="command-block-name"><?= $model->user ?></div> | 11 | <div class="command-block-name"><?= $model->user ?></div> |
13 | - <div class="command-block-job"><?= $model->department->name ?></div> | 12 | + <?php |
13 | + if(!empty( $model->department->name )) { | ||
14 | + ?> | ||
15 | + <div class="command-block-job"><?= $model->department->name ?></div> | ||
16 | + <?php | ||
17 | + } | ||
18 | + ?> | ||
14 | <div class="command-block-line"> | 19 | <div class="command-block-line"> |
15 | <div class="command-block-line-left"></div> | 20 | <div class="command-block-line-left"></div> |
16 | <div class="command-block-line-right"></div> | 21 | <div class="command-block-line-right"></div> |