Commit 4b85f536e07836dae0141e91fbd5147c7117a004
1 parent
110087c2
test
Showing
6 changed files
with
244 additions
and
137 deletions
Show diff stats
common/models/Job.php
| @@ -84,22 +84,43 @@ | @@ -84,22 +84,43 @@ | ||
| 84 | 'string', | 84 | 'string', |
| 85 | 'max' => 255, | 85 | 'max' => 255, |
| 86 | ], | 86 | ], |
| 87 | + [ | ||
| 88 | + [ | ||
| 89 | + 'link', | ||
| 90 | + ], | ||
| 91 | + 'match', | ||
| 92 | + 'pattern' => '/^(?:https?:\/\/)?(?:w{3}\.)?'.preg_quote($_SERVER['HTTP_HOST']).'\/company\/\w+\/\d+$/i', | ||
| 93 | + ], | ||
| 87 | ]; | 94 | ]; |
| 88 | } | 95 | } |
| 89 | 96 | ||
| 90 | public function getExpTime() | 97 | public function getExpTime() |
| 91 | { | 98 | { |
| 92 | - if($this->date_end && $this->date_start) { | ||
| 93 | - $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start)); | ||
| 94 | - return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $this->date_end)))); | ||
| 95 | - } elseif($this->date_start) { | ||
| 96 | - $now = new \DateTime(); | ||
| 97 | - $date = new \DateTime(date('Y-m-d H:i:s', strtotime($this->date_start))); | ||
| 98 | - return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime())); | 99 | + if(!empty($this->date_start) && !empty($this->date_end)) { |
| 100 | + $result = ''; | ||
| 101 | + $start = new \DateTime($this->date_start); | ||
| 102 | + $end = new \DateTime($this->date_end); | ||
| 103 | + $interval = $end->diff($start); | ||
| 104 | + if(!empty($interval->y)) { | ||
| 105 | + if($interval->y) { | ||
| 106 | + $result | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + } elseif(!empty($this->date_start)) { | ||
| 110 | + | ||
| 99 | } else { | 111 | } else { |
| 100 | - return 'неизвестна дата начала'; | 112 | + return false; |
| 101 | } | 113 | } |
| 102 | - | 114 | +// if($this->date_end && $this->date_start) { |
| 115 | +// $date = new \DateTime(date('Y-m-d H:i:s', $this->date_start)); | ||
| 116 | +// return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime(date('Y-m-d H:i:s', $this->date_end)))); | ||
| 117 | +// } elseif($this->date_start) { | ||
| 118 | +// $now = new \DateTime(); | ||
| 119 | +// $date = new \DateTime(date('Y-m-d H:i:s', strtotime($this->date_start))); | ||
| 120 | +// return \Yii::$app->formatter->asRelativeTime($date->diff(new \DateTime())); | ||
| 121 | +// } else { | ||
| 122 | +// return 'неизвестна дата начала'; | ||
| 123 | +// } | ||
| 103 | } | 124 | } |
| 104 | 125 | ||
| 105 | /** | 126 | /** |
common/models/User.php
| @@ -523,7 +523,7 @@ | @@ -523,7 +523,7 @@ | ||
| 523 | public function getJobs() | 523 | public function getJobs() |
| 524 | { | 524 | { |
| 525 | return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]) | 525 | return $this->hasMany(Job::className(), [ 'user_id' => 'id' ]) |
| 526 | - ->orderBy([ 'current' => SORT_DESC ]); | 526 | + ->orderBy([ 'current' => SORT_DESC, 'date_start' => SORT_DESC]); |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | /** | 529 | /** |
frontend/controllers/PerformerController.php
| @@ -250,7 +250,7 @@ | @@ -250,7 +250,7 @@ | ||
| 250 | 250 | ||
| 251 | public function actionWorkplace($performer_id) | 251 | public function actionWorkplace($performer_id) |
| 252 | { | 252 | { |
| 253 | - $user = User::findOne($performer_id); | 253 | + $user = User::find()->where(['id' => $performer_id])->with('jobs')->one(); |
| 254 | if(!$user instanceof User) { | 254 | if(!$user instanceof User) { |
| 255 | throw new BadRequestHttpException('Пользователь не найден'); | 255 | throw new BadRequestHttpException('Пользователь не найден'); |
| 256 | } | 256 | } |
frontend/views/accounts/_job_form.php
| 1 | <?php | 1 | <?php |
| 2 | -/** | ||
| 3 | - * @var integer $index | ||
| 4 | - */ | ||
| 5 | -use common\models\Job; | ||
| 6 | -use yii\helpers\Html; | ||
| 7 | -use yii\jui\DatePicker; | ||
| 8 | -use yii\widgets\ActiveForm; | 2 | + /** |
| 3 | + * @var integer $index | ||
| 4 | + */ | ||
| 5 | + use common\models\Job; | ||
| 6 | + use yii\helpers\Html; | ||
| 7 | + use yii\jui\DatePicker; | ||
| 8 | + use yii\widgets\ActiveForm; | ||
| 9 | 9 | ||
| 10 | -$model = new Job(['user_id' => \Yii::$app->user->getId (), 'current' => 0]); | ||
| 11 | -$form = ActiveForm::begin (); | 10 | + $model = new Job([ |
| 11 | + 'user_id' => \Yii::$app->user->getId(), | ||
| 12 | + 'current' => 0, | ||
| 13 | + ]); | ||
| 14 | + $form = ActiveForm::begin(); | ||
| 12 | ?> | 15 | ?> |
| 13 | -<div class='ajax-loaded'><div class='prev_job_inputs'> | 16 | +<div class='ajax-loaded'> |
| 17 | + <div class='prev_job_inputs'> | ||
| 14 | <div class="input-blocks-wrapper"> | 18 | <div class="input-blocks-wrapper"> |
| 15 | <div class="input-blocks"> | 19 | <div class="input-blocks"> |
| 16 | - <?= $form->field ($model, '[' . $index . ']name') | ||
| 17 | - ->label ('Название') | ||
| 18 | - ->textInput (['class'=> 'custom-input-2']); | ||
| 19 | - ?> | 20 | + <?= $form->field($model, '[' . $index . ']name') |
| 21 | + ->label('Название') | ||
| 22 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | ||
| 20 | </div> | 23 | </div> |
| 21 | </div> | 24 | </div> |
| 22 | <div class="input-blocks-wrapper"> | 25 | <div class="input-blocks-wrapper"> |
| 23 | <div class="input-blocks"> | 26 | <div class="input-blocks"> |
| 24 | - <?= $form->field ($model, '[' . $index . ']link') | ||
| 25 | - ->label ('Ссылка на компанию на сайте МФП') | ||
| 26 | - ->textInput (['class'=> 'custom-input-2']); | ||
| 27 | - ?> | 27 | + <?= $form->field($model, '[' . $index . ']link') |
| 28 | + ->label('Ссылка на компанию на сайте МФП') | ||
| 29 | + ->hint('Пример: ' . $_SERVER[ 'HTTP_HOST' ] . '/company/common/1') | ||
| 30 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | ||
| 28 | </div> | 31 | </div> |
| 29 | </div> | 32 | </div> |
| 30 | <div class="input-blocks-wrapper"> | 33 | <div class="input-blocks-wrapper"> |
| 31 | <div class="input-blocks"> | 34 | <div class="input-blocks"> |
| 32 | - <?= $form->field ($model, '[' . $index . ']date_start') | ||
| 33 | - ->label ('Дата начала работы') | ||
| 34 | - ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]); | ||
| 35 | - ?> | 35 | + <?= $form->field($model, '[' . $index . ']date_start') |
| 36 | + ->label('Дата начала работы') | ||
| 37 | + ->widget(DatePicker::className(), [ | ||
| 38 | + 'options' => [ 'class' => 'custom-input-2' ], | ||
| 39 | + 'language' => 'ru', | ||
| 40 | + 'dateFormat' => 'dd-MM-yyyy', | ||
| 41 | + 'clientOptions' => [ | ||
| 42 | + 'changeYear' => true, | ||
| 43 | + 'yearRange' => 'c-20:c', | ||
| 44 | + 'changeMonth' => true, | ||
| 45 | + ], | ||
| 46 | + ]); ?> | ||
| 36 | </div> | 47 | </div> |
| 37 | </div> | 48 | </div> |
| 38 | 49 | ||
| 39 | <div class="input-blocks-wrapper"> | 50 | <div class="input-blocks-wrapper"> |
| 40 | <div class="input-blocks"> | 51 | <div class="input-blocks"> |
| 41 | - <?= $form->field ($model, '[' . $index . ']date_end') | ||
| 42 | - ->label ('Дата окончания работы') | ||
| 43 | - ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]); | ||
| 44 | - ?> | 52 | + <?= $form->field($model, '[' . $index . ']date_end') |
| 53 | + ->label('Дата окончания работы') | ||
| 54 | + ->widget(DatePicker::className(), [ | ||
| 55 | + 'options' => [ 'class' => 'custom-input-2' ], | ||
| 56 | + 'language' => 'ru', | ||
| 57 | + 'dateFormat' => 'dd-MM-yyyy', | ||
| 58 | + 'clientOptions' => [ | ||
| 59 | + 'changeYear' => true, | ||
| 60 | + 'yearRange' => 'c-20:c', | ||
| 61 | + 'changeMonth' => true, | ||
| 62 | + ], | ||
| 63 | + ]); ?> | ||
| 45 | </div> | 64 | </div> |
| 46 | </div> | 65 | </div> |
| 47 | 66 | ||
| 48 | <div class="input-blocks-wrapper"> | 67 | <div class="input-blocks-wrapper"> |
| 49 | <div class="input-blocks"> | 68 | <div class="input-blocks"> |
| 50 | - <?= $form->field ($model, '[' . $index . ']position') | ||
| 51 | - ->label ('Должность') | ||
| 52 | - ->textInput (['class'=> 'custom-input-2']); | ||
| 53 | - ?> | 69 | + <?= $form->field($model, '[' . $index . ']position') |
| 70 | + ->label('Должность') | ||
| 71 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | ||
| 54 | </div> | 72 | </div> |
| 55 | </div> | 73 | </div> |
| 56 | 74 | ||
| 57 | <div class="input-blocks-wrapper admin-quantity-project"> | 75 | <div class="input-blocks-wrapper admin-quantity-project"> |
| 58 | <div class="input-blocks"> | 76 | <div class="input-blocks"> |
| 59 | - <?= $form->field ($model, '[' . $index . ']total_count') | ||
| 60 | - ->label ('Количество проектов, в которых принимали участие') | ||
| 61 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | ||
| 62 | - ?> | 77 | + <?= $form->field($model, '[' . $index . ']total_count') |
| 78 | + ->label('Количество проектов, в которых принимали участие') | ||
| 79 | + ->textInput([ | ||
| 80 | + 'class' => 'custom-input-2 custom-input-2-date', | ||
| 81 | + 'type' => 'number', | ||
| 82 | + ]); ?> | ||
| 63 | 83 | ||
| 64 | <div class="fix-quantity-project"> | 84 | <div class="fix-quantity-project"> |
| 65 | - <?= $form->field ($model, '[' . $index . ']complete_count') | ||
| 66 | - ->label ('из них реализовано') | ||
| 67 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | ||
| 68 | - ?> | 85 | + <?= $form->field($model, '[' . $index . ']complete_count') |
| 86 | + ->label('из них реализовано') | ||
| 87 | + ->textInput([ | ||
| 88 | + 'class' => 'custom-input-2 custom-input-2-date', | ||
| 89 | + 'type' => 'number', | ||
| 90 | + ]); ?> | ||
| 69 | </div> | 91 | </div> |
| 70 | </div> | 92 | </div> |
| 71 | </div> | 93 | </div> |
| 72 | 94 | ||
| 73 | - <?= Html::button('', ['class' => 'remove_job_button']);?> | ||
| 74 | - </div></div> | ||
| 75 | -<?php $form->end (); ?> | 95 | + <?= Html::button('', [ 'class' => 'remove_job_button' ]); ?> |
| 96 | + </div> | ||
| 97 | +</div> | ||
| 98 | +<?php $form->end(); ?> |
frontend/views/accounts/employment.php
| @@ -32,6 +32,7 @@ | @@ -32,6 +32,7 @@ | ||
| 32 | <div class="input-blocks"> | 32 | <div class="input-blocks"> |
| 33 | <?= $form->field($current, '[0]link') | 33 | <?= $form->field($current, '[0]link') |
| 34 | ->label('Ссылка на компанию на сайте МФП') | 34 | ->label('Ссылка на компанию на сайте МФП') |
| 35 | + ->hint('Пример: ' . $_SERVER[ 'HTTP_HOST' ] . '/company/common/1') | ||
| 35 | ->textInput([ 'class' => 'custom-input-2' ]); ?> | 36 | ->textInput([ 'class' => 'custom-input-2' ]); ?> |
| 36 | </div> | 37 | </div> |
| 37 | </div> | 38 | </div> |
| @@ -46,29 +47,40 @@ | @@ -46,29 +47,40 @@ | ||
| 46 | 47 | ||
| 47 | <div class="input-blocks-wrapper"> | 48 | <div class="input-blocks-wrapper"> |
| 48 | <div class="input-blocks"> | 49 | <div class="input-blocks"> |
| 49 | - <?= $form->field ($current, '[0]date_start', ['options' => ['class' => 'test2class']]) | ||
| 50 | - ->label ('Дата начала работы') | ||
| 51 | - ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]); | ||
| 52 | - ?> | 50 | + <?= $form->field($current, '[0]date_start', [ 'options' => [ 'class' => 'test2class' ] ]) |
| 51 | + ->label('Дата начала работы') | ||
| 52 | + ->widget(DatePicker::className(), [ | ||
| 53 | + 'options' => [ 'class' => 'custom-input-2' ], | ||
| 54 | + 'language' => 'ru', | ||
| 55 | + 'dateFormat' => 'dd-MM-yyyy', | ||
| 56 | + 'clientOptions' => [ | ||
| 57 | + 'changeYear' => true, | ||
| 58 | + 'yearRange' => 'c-20:c', | ||
| 59 | + 'changeMonth' => true, | ||
| 60 | + ], | ||
| 61 | + ]); ?> | ||
| 53 | </div> | 62 | </div> |
| 54 | </div> | 63 | </div> |
| 55 | 64 | ||
| 56 | <div class="input-blocks-wrapper admin-quantity-project"> | 65 | <div class="input-blocks-wrapper admin-quantity-project"> |
| 57 | <div class="input-blocks"> | 66 | <div class="input-blocks"> |
| 58 | - <?= $form->field ($current, '[0]total_count') | ||
| 59 | - ->label ('Количество проектов, в которых принимали участие') | ||
| 60 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | ||
| 61 | - ?> | 67 | + <?= $form->field($current, '[0]total_count') |
| 68 | + ->label('Количество проектов, в которых принимали участие') | ||
| 69 | + ->textInput([ | ||
| 70 | + 'class' => 'custom-input-2 custom-input-2-date', | ||
| 71 | + 'type' => 'number', | ||
| 72 | + ]); ?> | ||
| 62 | <div class="fix-quantity-project"> | 73 | <div class="fix-quantity-project"> |
| 63 | - <?= $form->field ($current, '[0]complete_count') | ||
| 64 | - ->label ('из них реализовано') | ||
| 65 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | ||
| 66 | - ?> | 74 | + <?= $form->field($current, '[0]complete_count') |
| 75 | + ->label('из них реализовано') | ||
| 76 | + ->textInput([ | ||
| 77 | + 'class' => 'custom-input-2 custom-input-2-date', | ||
| 78 | + 'type' => 'number', | ||
| 79 | + ]); ?> | ||
| 67 | </div> | 80 | </div> |
| 68 | </div> | 81 | </div> |
| 69 | 82 | ||
| 70 | 83 | ||
| 71 | - | ||
| 72 | </div> | 84 | </div> |
| 73 | 85 | ||
| 74 | </div> | 86 | </div> |
| @@ -77,7 +89,11 @@ | @@ -77,7 +89,11 @@ | ||
| 77 | <div class="input-blocks"> | 89 | <div class="input-blocks"> |
| 78 | <?= $form->field($user_info, 'experience') | 90 | <?= $form->field($user_info, 'experience') |
| 79 | ->label('Когда начали заниматься проектированием') | 91 | ->label('Когда начали заниматься проектированием') |
| 80 | - ->input('number', [ 'class' => 'custom-input-2', 'min' => '1950', 'max' => date('Y') ]); ?> | 92 | + ->input('number', [ |
| 93 | + 'class' => 'custom-input-2', | ||
| 94 | + 'min' => '1950', | ||
| 95 | + 'max' => date('Y'), | ||
| 96 | + ]); ?> | ||
| 81 | </div> | 97 | </div> |
| 82 | </div> | 98 | </div> |
| 83 | </div> | 99 | </div> |
| @@ -85,17 +101,15 @@ | @@ -85,17 +101,15 @@ | ||
| 85 | <div class="prev_job_container style"> | 101 | <div class="prev_job_container style"> |
| 86 | <div class="login-left-column-title-two previous-employment-wr style">Предыдущие места работы</div> | 102 | <div class="login-left-column-title-two previous-employment-wr style">Предыдущие места работы</div> |
| 87 | <?php | 103 | <?php |
| 88 | - foreach ($job as $index => $job_model) | ||
| 89 | - { | ||
| 90 | - ?> | 104 | + foreach($job as $index => $job_model) { |
| 105 | + ?> | ||
| 91 | 106 | ||
| 92 | - <div class='prev_job_inputs'> | 107 | + <div class='prev_job_inputs'> |
| 93 | <div class="input-blocks-wrapper"> | 108 | <div class="input-blocks-wrapper"> |
| 94 | <div class="input-blocks"> | 109 | <div class="input-blocks"> |
| 95 | - <?= $form->field ($job_model, '['. ($index + 1) .']name') | ||
| 96 | - ->label ('Название') | ||
| 97 | - ->textInput (['class'=> 'custom-input-2']); | ||
| 98 | - ?> | 110 | + <?= $form->field($job_model, '[' . ( $index + 1 ) . ']name') |
| 111 | + ->label('Название') | ||
| 112 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | ||
| 99 | </div> | 113 | </div> |
| 100 | </div> | 114 | </div> |
| 101 | 115 | ||
| @@ -103,100 +117,143 @@ | @@ -103,100 +117,143 @@ | ||
| 103 | <div class="input-blocks"> | 117 | <div class="input-blocks"> |
| 104 | <?= $form->field($job_model, '[' . ( $index + 1 ) . ']link') | 118 | <?= $form->field($job_model, '[' . ( $index + 1 ) . ']link') |
| 105 | ->label('Ссылка на компанию на сайте МФП') | 119 | ->label('Ссылка на компанию на сайте МФП') |
| 120 | + ->hint('Пример: ' . $_SERVER[ 'HTTP_HOST' ] . '/company/common/1') | ||
| 106 | ->textInput([ 'class' => 'custom-input-2' ]); ?> | 121 | ->textInput([ 'class' => 'custom-input-2' ]); ?> |
| 107 | </div> | 122 | </div> |
| 108 | </div> | 123 | </div> |
| 109 | 124 | ||
| 110 | <div class="input-blocks-wrapper"> | 125 | <div class="input-blocks-wrapper"> |
| 111 | <div class="input-blocks"> | 126 | <div class="input-blocks"> |
| 112 | - <?= $form->field ($job_model, '['. ($index + 1) .']date_start') | ||
| 113 | - ->label ('Дата начала работы') | ||
| 114 | - ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]); | ||
| 115 | - ?> | 127 | + <?= $form->field($job_model, '[' . ( $index + 1 ) . ']date_start') |
| 128 | + ->label('Дата начала работы') | ||
| 129 | + ->widget(DatePicker::className(), [ | ||
| 130 | + 'options' => [ 'class' => 'custom-input-2' ], | ||
| 131 | + 'language' => 'ru', | ||
| 132 | + 'dateFormat' => 'dd-MM-yyyy', | ||
| 133 | + 'clientOptions' => [ | ||
| 134 | + 'changeYear' => true, | ||
| 135 | + 'yearRange' => 'c-20:c', | ||
| 136 | + 'changeMonth' => true, | ||
| 137 | + ], | ||
| 138 | + ]); ?> | ||
| 116 | </div> | 139 | </div> |
| 117 | </div> | 140 | </div> |
| 118 | 141 | ||
| 119 | <div class="input-blocks-wrapper"> | 142 | <div class="input-blocks-wrapper"> |
| 120 | <div class="input-blocks"> | 143 | <div class="input-blocks"> |
| 121 | - <?= $form->field ($job_model, '['. ($index + 1) .']date_end') | ||
| 122 | - ->label ('Дата окончания работы') | ||
| 123 | - ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]); | ||
| 124 | - ?> | 144 | + <?= $form->field($job_model, '[' . ( $index + 1 ) . ']date_end') |
| 145 | + ->label('Дата окончания работы') | ||
| 146 | + ->widget(DatePicker::className(), [ | ||
| 147 | + 'options' => [ 'class' => 'custom-input-2' ], | ||
| 148 | + 'language' => 'ru', | ||
| 149 | + 'dateFormat' => 'dd-MM-yyyy', | ||
| 150 | + 'clientOptions' => [ | ||
| 151 | + 'changeYear' => true, | ||
| 152 | + 'yearRange' => 'c-20:c', | ||
| 153 | + 'changeMonth' => true, | ||
| 154 | + ], | ||
| 155 | + ]); ?> | ||
| 125 | </div> | 156 | </div> |
| 126 | </div> | 157 | </div> |
| 127 | 158 | ||
| 128 | <div class="input-blocks-wrapper"> | 159 | <div class="input-blocks-wrapper"> |
| 129 | <div class="input-blocks"> | 160 | <div class="input-blocks"> |
| 130 | - <?= $form->field ($job_model, '['. ($index + 1) .']position') | ||
| 131 | - ->label ('Должность') | ||
| 132 | - ->textInput (['class'=> 'custom-input-2']); | ||
| 133 | - ?> | 161 | + <?= $form->field($job_model, '[' . ( $index + 1 ) . ']position') |
| 162 | + ->label('Должность') | ||
| 163 | + ->textInput([ 'class' => 'custom-input-2' ]); ?> | ||
| 134 | </div> | 164 | </div> |
| 135 | </div> | 165 | </div> |
| 136 | 166 | ||
| 137 | <div class="input-blocks-wrapper admin-quantity-project"> | 167 | <div class="input-blocks-wrapper admin-quantity-project"> |
| 138 | <div class="input-blocks"> | 168 | <div class="input-blocks"> |
| 139 | - <?= $form->field ($job_model, '['. ($index + 1) .']total_count') | ||
| 140 | - ->label ('Количество проектов, в которых принимали участие') | ||
| 141 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | ||
| 142 | - ?> | 169 | + <?= $form->field($job_model, '[' . ( $index + 1 ) . ']total_count') |
| 170 | + ->label('Количество проектов, в которых принимали участие') | ||
| 171 | + ->textInput([ | ||
| 172 | + 'class' => 'custom-input-2 custom-input-2-date', | ||
| 173 | + 'type' => 'number', | ||
| 174 | + ]); ?> | ||
| 143 | <div class="fix-quantity-project"> | 175 | <div class="fix-quantity-project"> |
| 144 | - <?= $form->field ($job_model, '['. ($index + 1) .']complete_count') | ||
| 145 | - ->label ('из них реализовано') | ||
| 146 | - ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']); | ||
| 147 | - ?> | ||
| 148 | - </div> | 176 | + <?= $form->field($job_model, '[' . ( $index + 1 ) . ']complete_count') |
| 177 | + ->label('из них реализовано') | ||
| 178 | + ->textInput([ | ||
| 179 | + 'class' => 'custom-input-2 custom-input-2-date', | ||
| 180 | + 'type' => 'number', | ||
| 181 | + ]); ?> | ||
| 182 | + </div> | ||
| 149 | </div> | 183 | </div> |
| 150 | </div> | 184 | </div> |
| 151 | - <?= Html::button('', ['class' => 'remove_job_button']) ?> | ||
| 152 | - </div> | ||
| 153 | - <?php } ?> | 185 | + <?= Html::button('', [ 'class' => 'remove_job_button' ]) ?> |
| 186 | + </div> | ||
| 187 | + <?php } ?> | ||
| 154 | 188 | ||
| 155 | </div> | 189 | </div> |
| 156 | 190 | ||
| 157 | <div class="add-field-employment fix_add-field-employment style"> | 191 | <div class="add-field-employment fix_add-field-employment style"> |
| 158 | - <?= | ||
| 159 | - Html::button('добавить еще место работы', ['id' => 'add_job_button', 'class' => 'btn']); | ||
| 160 | - ?> | 192 | + <?= Html::button('добавить еще место работы', [ |
| 193 | + 'id' => 'add_job_button', | ||
| 194 | + 'class' => 'btn', | ||
| 195 | + ]); ?> | ||
| 161 | </div> | 196 | </div> |
| 162 | 197 | ||
| 163 | 198 | ||
| 164 | <div class="input-blocks-wrapper"> | 199 | <div class="input-blocks-wrapper"> |
| 165 | <div class="admin-save-btn skills-save-btn style"> | 200 | <div class="admin-save-btn skills-save-btn style"> |
| 166 | - <?= Html::submitButton('Сохранить',['class'=>'input-blocks-wrapper button']) ?> | 201 | + <?= Html::submitButton('Сохранить', [ 'class' => 'input-blocks-wrapper button' ]) ?> |
| 167 | </div> | 202 | </div> |
| 168 | </div> | 203 | </div> |
| 169 | - <?php | ||
| 170 | - $form->end (); | ||
| 171 | - ?> | 204 | +<?php |
| 205 | + $form->end(); | ||
| 206 | +?> | ||
| 172 | <script> | 207 | <script> |
| 173 | - $(function() { | ||
| 174 | - var regexp = /^[\w]+\[(\d+)\].*$/; | ||
| 175 | - $(document).on('click', '#add_job_button', function() { | ||
| 176 | - var inputs = $('.prev_job_inputs').last(); | ||
| 177 | - var name = $(inputs).find('input, textarea').first().attr('name'); | ||
| 178 | - var result = regexp.exec(name); | ||
| 179 | - var lastindex; | ||
| 180 | - if(result != null) { | ||
| 181 | - lastindex = result[1]; | ||
| 182 | - } else { | ||
| 183 | - lastindex = 0; | ||
| 184 | - $('.prev_job_container').removeClass('none-job-inputs') | ||
| 185 | - $('.add-field-employment').removeClass('none-job-inputs') | ||
| 186 | - } | ||
| 187 | - $.get('/accounts/get-form', { lastindex: lastindex }, function(data) { | ||
| 188 | - $('.prev_job_container').append($(data).find('.ajax-loaded').first().html()); | ||
| 189 | - $(data).filter('script').appendTo('body'); | ||
| 190 | - }); | ||
| 191 | - | ||
| 192 | - }); | ||
| 193 | - $(document).on('click', '.remove_job_button', function() { | ||
| 194 | - $(this).parents('.prev_job_inputs').remove() | ||
| 195 | - var prevEmploy = $('.prev_job_inputs').length | ||
| 196 | - if(prevEmploy<1){ | 208 | + $( |
| 209 | + function() | ||
| 210 | + { | ||
| 211 | + var regexp = /^[\w]+\[(\d+)\].*$/; | ||
| 212 | + var prevEmploy = $('.prev_job_inputs').length | ||
| 213 | + if(prevEmploy < 1) | ||
| 214 | + { | ||
| 197 | $('.prev_job_container').addClass('none-job-inputs') | 215 | $('.prev_job_container').addClass('none-job-inputs') |
| 198 | $('.add-field-employment').addClass('none-job-inputs') | 216 | $('.add-field-employment').addClass('none-job-inputs') |
| 199 | } | 217 | } |
| 200 | - }); | ||
| 201 | - }); | 218 | + $(document).on( |
| 219 | + 'click', '#add_job_button', function() | ||
| 220 | + { | ||
| 221 | + var inputs = $('.prev_job_inputs').last(); | ||
| 222 | + var name = $(inputs).find('input, textarea').first().attr('name'); | ||
| 223 | + var result = regexp.exec(name); | ||
| 224 | + var lastindex; | ||
| 225 | + if(result != null) | ||
| 226 | + { | ||
| 227 | + lastindex = result[1]; | ||
| 228 | + } else | ||
| 229 | + { | ||
| 230 | + lastindex = 0; | ||
| 231 | + $('.prev_job_container').removeClass('none-job-inputs') | ||
| 232 | + $('.add-field-employment').removeClass('none-job-inputs') | ||
| 233 | + } | ||
| 234 | + $.get( | ||
| 235 | + '/accounts/get-form', {lastindex : lastindex}, function(data) | ||
| 236 | + { | ||
| 237 | + $('.prev_job_container') | ||
| 238 | + .append($(data).find('.ajax-loaded').first().html()); | ||
| 239 | + $(data).filter('script').appendTo('body'); | ||
| 240 | + } | ||
| 241 | + ); | ||
| 242 | + | ||
| 243 | + } | ||
| 244 | + ); | ||
| 245 | + $(document).on( | ||
| 246 | + 'click', '.remove_job_button', function() | ||
| 247 | + { | ||
| 248 | + $(this).parents('.prev_job_inputs').remove() | ||
| 249 | + var prevEmploy = $('.prev_job_inputs').length | ||
| 250 | + if(prevEmploy < 1) | ||
| 251 | + { | ||
| 252 | + $('.prev_job_container').addClass('none-job-inputs') | ||
| 253 | + $('.add-field-employment').addClass('none-job-inputs') | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + ); | ||
| 257 | + } | ||
| 258 | + ); | ||
| 202 | </script> | 259 | </script> |
frontend/views/layouts/performer.php
| @@ -186,12 +186,18 @@ | @@ -186,12 +186,18 @@ | ||
| 186 | <li><img src="/images/sidebar-ico/ico-13.png" alt=""/> | 186 | <li><img src="/images/sidebar-ico/ico-13.png" alt=""/> |
| 187 | <div class="sidebarvievstxt"><?= implode(', ', ArrayHelper::getColumn($this->params[ 'user' ]->payments, 'name')) ?></div> | 187 | <div class="sidebarvievstxt"><?= implode(', ', ArrayHelper::getColumn($this->params[ 'user' ]->payments, 'name')) ?></div> |
| 188 | </li> | 188 | </li> |
| 189 | - <li><img src="/images/sidebar-ico/ico-14.png" alt=""/> | ||
| 190 | - <div class="sidebarvievstxt"> | ||
| 191 | - <span class="sidebar-views-txt">Текущее место работы:<br/></span><?= isset( $this->params[ 'user' ]->currentJob ) ? $this->params[ 'user' ]->currentJob->name : "" ?> | ||
| 192 | - </div> | ||
| 193 | - </li> | ||
| 194 | - | 189 | + <?php |
| 190 | + if(!empty( $this->params[ 'user' ]->currentJob )) { | ||
| 191 | + ?> | ||
| 192 | + <li> | ||
| 193 | + <img src="/images/sidebar-ico/ico-14.png" alt=""/> | ||
| 194 | + <div class="sidebarvievstxt"> | ||
| 195 | + <span class="sidebar-views-txt">Текущее место работы:<br/></span><?= $this->params[ 'user' ]->currentJob->name ?> | ||
| 196 | + </div> | ||
| 197 | + </li> | ||
| 198 | + <?php | ||
| 199 | + } | ||
| 200 | + ?> | ||
| 195 | </ul> | 201 | </ul> |
| 196 | </div> | 202 | </div> |
| 197 | </div> | 203 | </div> |