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 | 41 | [ |
| 42 | 42 | [ |
| 43 | 43 | 'experience_from_from', |
| 44 | - ], | |
| 45 | - 'default', | |
| 46 | - 'value' => 0, | |
| 47 | - ], | |
| 48 | - [ | |
| 49 | - [ | |
| 50 | 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 | 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 | 166 | if(!empty( $this->link ) || $this->link === '0') { |
| 171 | 167 | $query->andFilterWhere([ | ... | ... |
common/widgets/views/phone_field.php
| 1 | 1 | <?php |
| 2 | 2 | use yii\helpers\Html; |
| 3 | + use yii\widgets\MaskedInput; | |
| 4 | + | |
| 3 | 5 | ?> |
| 4 | 6 | <fieldset> |
| 5 | 7 | |
| ... | ... | @@ -18,7 +20,7 @@ |
| 18 | 20 | <?= Html::beginTag('div',['class'=>'form-group','id'=>isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ])?> |
| 19 | 21 | <div class="input-blocks"> |
| 20 | 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 | 24 | </div> |
| 23 | 25 | <span data-id="<?= isset($model[$i]['parent_key']) ? $model[$i]['parent_key'] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> |
| 24 | 26 | <?= Html::endTag('div')?> |
| ... | ... | @@ -40,7 +42,7 @@ |
| 40 | 42 | var sub_block = '<div class="form-group" >'+ |
| 41 | 43 | '<div class="input-blocks">'+ |
| 42 | 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 | 46 | '</div>'+ |
| 45 | 47 | '<span class="glyphicon glyphicon-trash delete-field-item custom-remove-ico"></span>'+ |
| 46 | 48 | '<div>'; | ... | ... |
frontend/controllers/AccountsController.php
| ... | ... | @@ -184,6 +184,7 @@ |
| 184 | 184 | } |
| 185 | 185 | if(!empty( \Yii::$app->request->post() )) { |
| 186 | 186 | if(!empty( Yii::$app->request->post('Fields') )) { |
| 187 | + | |
| 187 | 188 | Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); |
| 188 | 189 | } |
| 189 | 190 | $user_info->load(\Yii::$app->request->post()); |
| ... | ... | @@ -314,7 +315,6 @@ |
| 314 | 315 | $user = \Yii::$app->user->identity; |
| 315 | 316 | $post = \Yii::$app->request->post(); |
| 316 | 317 | if($gallery->load($post) && $gallery->save()) { |
| 317 | - | |
| 318 | 318 | return $this->redirect([ |
| 319 | 319 | 'gallery-update', |
| 320 | 320 | 'id' => $gallery->gallery_id, |
| ... | ... | @@ -340,7 +340,6 @@ |
| 340 | 340 | $user = \Yii::$app->user->identity; |
| 341 | 341 | $post = \Yii::$app->request->post(); |
| 342 | 342 | if($gallery->load($post) && $gallery->save()) { |
| 343 | - Fields::saveFieldData(Yii::$app->request->post('Fields'), \Yii::$app->user->identity->id, User::className(), 'ru'); | |
| 344 | 343 | return $this->redirect([ |
| 345 | 344 | 'gallery-update', |
| 346 | 345 | 'id' => $gallery->gallery_id, | ... | ... |
frontend/views/accounts/team.php
| ... | ... | @@ -51,7 +51,11 @@ |
| 51 | 51 | [ |
| 52 | 52 | 'attribute' => 'experience_from', |
| 53 | 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 | 60 | 'label' => 'Опыт, лет', |
| 57 | 61 | 'filter' => "<div class=\"input-group input-group-xs input-daterange\"> | ... | ... |