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