Commit 2cee8b86bc16b072cd3b65d6c39c339d75ce950a
1 parent
e4a014b8
test
Showing
5 changed files
with
20 additions
and
24 deletions
Show diff stats
common/models/Team.php
common/models/TeamSearch.php
| @@ -41,16 +41,10 @@ | @@ -41,16 +41,10 @@ | ||
| 41 | [ | 41 | [ |
| 42 | [ | 42 | [ |
| 43 | 'experience_from_from', | 43 | 'experience_from_from', |
| 44 | - ], | ||
| 45 | - 'default', | ||
| 46 | - 'value' => 0, | ||
| 47 | - ], | ||
| 48 | - [ | ||
| 49 | - [ | ||
| 50 | 'experience_from_to', | 44 | 'experience_from_to', |
| 51 | ], | 45 | ], |
| 52 | - 'default', | ||
| 53 | - 'value' => 100, | 46 | + 'integer', |
| 47 | + 'min' => 0, | ||
| 54 | ], | 48 | ], |
| 55 | [ | 49 | [ |
| 56 | [ | 50 | [ |
| @@ -160,12 +154,14 @@ | @@ -160,12 +154,14 @@ | ||
| 160 | 'user_add_id' => $this->user_add_id, | 154 | 'user_add_id' => $this->user_add_id, |
| 161 | ]); | 155 | ]); |
| 162 | 156 | ||
| 163 | - $query->andFilterWhere([ | ||
| 164 | - 'between', | ||
| 165 | - 'experience_from', | ||
| 166 | - $this->experience_from_to ? ( date('Y') - $this->experience_from_to ) : ( date('Y') - 100 ), | ||
| 167 | - $this->experience_from_from ? ( date('Y') - $this->experience_from_from ) : date('Y'), | ||
| 168 | - ]); | 157 | + if(!empty($this->experience_from_to) || !empty($this->experience_from_from)) { |
| 158 | + $query->andFilterWhere([ | ||
| 159 | + 'between', | ||
| 160 | + 'experience_from', | ||
| 161 | + $this->experience_from_to ? ( date('Y') - $this->experience_from_to ) : ( date('Y') - 100 ), | ||
| 162 | + $this->experience_from_from ? ( date('Y') - $this->experience_from_from ) : date('Y'), | ||
| 163 | + ]); | ||
| 164 | + } | ||
| 169 | 165 | ||
| 170 | if(!empty( $this->link ) || $this->link === '0') { | 166 | if(!empty( $this->link ) || $this->link === '0') { |
| 171 | $query->andFilterWhere([ | 167 | $query->andFilterWhere([ |
common/widgets/views/phone_field.php
| 1 | <?php | 1 | <?php |
| 2 | use yii\helpers\Html; | 2 | use yii\helpers\Html; |
| 3 | + use yii\widgets\MaskedInput; | ||
| 4 | + | ||
| 3 | ?> | 5 | ?> |
| 4 | <fieldset> | 6 | <fieldset> |
| 5 | 7 | ||
| @@ -18,7 +20,7 @@ | @@ -18,7 +20,7 @@ | ||
| 18 | <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> | 20 | <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> |
| 19 | <div class="input-blocks"> | 21 | <div class="input-blocks"> |
| 20 | <label for="cont-phone-<?= ++$label ?>">Телефон</label> | 22 | <label for="cont-phone-<?= ++$label ?>">Телефон</label> |
| 21 | - <input id="cont-phone-<?= $label ?>" type="text" placeholder="" class="form-control custom-input-2" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[phone][<?=$row?>][0][phone]" /> | 23 | + <input id="cont-phone-<?= $label ?>" type="tel" pattern="^\+?(?:\d{0,3})?[\(\s]?\d{0,5}[\)\s]?\d{3}[-\s]?\d{2}[-\s]?\d{2}$" placeholder="" class="form-control custom-input-2" value="<?= isset($model[$t]['value']) ? $model[$t]['value'] : '' ?>" name="Fields[phone][<?=$row?>][0][phone]" /> |
| 22 | </div> | 24 | </div> |
| 23 | <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> | 25 | <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> |
| 24 | <?= Html::endTag('div')?> | 26 | <?= Html::endTag('div')?> |
| @@ -40,7 +42,7 @@ | @@ -40,7 +42,7 @@ | ||
| 40 | var sub_block = '<div class="form-group" >'+ | 42 | var sub_block = '<div class="form-group" >'+ |
| 41 | '<div class="input-blocks">'+ | 43 | '<div class="input-blocks">'+ |
| 42 | '<label for="cont-phone-' + ++start_label_<?=$this->context->id?> +'">Телефон</label>'+ | 44 | '<label for="cont-phone-' + ++start_label_<?=$this->context->id?> +'">Телефон</label>'+ |
| 43 | - '<input id="cont-phone-' + start_label_<?=$this->context->id?> +'" type="text" placeholder="" class="form-control custom-input-2" value="" name="Fields[phone]['+ start_i_<?=$this->context->id?>++ +'][0][phone]" />'+ | 45 | + '<input id="cont-phone-' + start_label_<?=$this->context->id?> +'" type="tel" pattern="^\\+?(?:\\d{0,3})?[\\(\\s]?\\d{0,5}[\\)\\s]?\\d{3}[-\\s]?\\d{2}[-\\s]?\\d{2}$" placeholder="" class="form-control custom-input-2" value="" name="Fields[phone]['+ start_i_<?=$this->context->id?>++ +'][0][phone]" />'+ |
| 44 | '</div>'+ | 46 | '</div>'+ |
| 45 | '<span class="glyphicon glyphicon-trash delete-field-item custom-remove-ico"></span>'+ | 47 | '<span class="glyphicon glyphicon-trash delete-field-item custom-remove-ico"></span>'+ |
| 46 | '<div>'; | 48 | '<div>'; |
frontend/controllers/AccountsController.php
| @@ -184,6 +184,7 @@ | @@ -184,6 +184,7 @@ | ||
| 184 | } | 184 | } |
| 185 | if(!empty( \Yii::$app->request->post() )) { | 185 | if(!empty( \Yii::$app->request->post() )) { |
| 186 | if(!empty( Yii::$app->request->post('Fields') )) { | 186 | if(!empty( Yii::$app->request->post('Fields') )) { |
| 187 | + | ||
| 187 | Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); | 188 | Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); |
| 188 | } | 189 | } |
| 189 | $user_info->load(\Yii::$app->request->post()); | 190 | $user_info->load(\Yii::$app->request->post()); |
| @@ -314,7 +315,6 @@ | @@ -314,7 +315,6 @@ | ||
| 314 | $user = \Yii::$app->user->identity; | 315 | $user = \Yii::$app->user->identity; |
| 315 | $post = \Yii::$app->request->post(); | 316 | $post = \Yii::$app->request->post(); |
| 316 | if($gallery->load($post) && $gallery->save()) { | 317 | if($gallery->load($post) && $gallery->save()) { |
| 317 | - | ||
| 318 | return $this->redirect([ | 318 | return $this->redirect([ |
| 319 | 'gallery-update', | 319 | 'gallery-update', |
| 320 | 'id' => $gallery->gallery_id, | 320 | 'id' => $gallery->gallery_id, |
| @@ -340,7 +340,6 @@ | @@ -340,7 +340,6 @@ | ||
| 340 | $user = \Yii::$app->user->identity; | 340 | $user = \Yii::$app->user->identity; |
| 341 | $post = \Yii::$app->request->post(); | 341 | $post = \Yii::$app->request->post(); |
| 342 | if($gallery->load($post) && $gallery->save()) { | 342 | if($gallery->load($post) && $gallery->save()) { |
| 343 | - Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); | ||
| 344 | return $this->redirect([ | 343 | return $this->redirect([ |
| 345 | 'gallery-update', | 344 | 'gallery-update', |
| 346 | 'id' => $gallery->gallery_id, | 345 | 'id' => $gallery->gallery_id, |
frontend/views/accounts/team.php
| @@ -51,7 +51,11 @@ | @@ -51,7 +51,11 @@ | ||
| 51 | [ | 51 | [ |
| 52 | 'attribute' => 'experience_from', | 52 | 'attribute' => 'experience_from', |
| 53 | 'value' => function($model, $key, $index, $column) { | 53 | 'value' => function($model, $key, $index, $column) { |
| 54 | - return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from; | 54 | + if(!empty($model->experience_from)) { |
| 55 | + return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from; | ||
| 56 | + } else { | ||
| 57 | + return 'Год начала не задан'; | ||
| 58 | + } | ||
| 55 | }, | 59 | }, |
| 56 | 'label' => 'Опыт, лет', | 60 | 'label' => 'Опыт, лет', |
| 57 | 'filter' => "<div class=\"input-group input-group-xs input-daterange\"> | 61 | 'filter' => "<div class=\"input-group input-group-xs input-daterange\"> |