Commit 5d163f4ba8a3acfb9ecdf9b53573ce5b1740393a
1 parent
658d13d4
09.02.16
Showing
1 changed file
with
15 additions
and
12 deletions
Show diff stats
common/widgets/views/education_field.php
@@ -9,6 +9,8 @@ | @@ -9,6 +9,8 @@ | ||
9 | <div class="field_list"> | 9 | <div class="field_list"> |
10 | 10 | ||
11 | <?php $t = 0; | 11 | <?php $t = 0; |
12 | + $label = 0; | ||
13 | + | ||
12 | for($i = 1; $i <= count($model); $i++): | 14 | for($i = 1; $i <= count($model); $i++): |
13 | $row = $i; | 15 | $row = $i; |
14 | 16 | ||
@@ -18,14 +20,14 @@ | @@ -18,14 +20,14 @@ | ||
18 | 'class' => 'form-group', | 20 | 'class' => 'form-group', |
19 | 'id' => isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0, | 21 | 'id' => isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0, |
20 | ]) ?> | 22 | ]) ?> |
21 | - <input id="edu-name-<?= $t ?>" type="text" placeholder="Название" class="form-control custom-input-2" value="<?= isset( $model[ $t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][0][name]"/> | ||
22 | - <label for="edu-name-<?= $t ?>"></label> | 23 | + <input id="edu-name-<?= ++$label ?>" type="text" placeholder="Название" class="form-control custom-input-2" value="<?= isset( $model[ $t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][0][name]"/> |
24 | + <label for="edu-name-<?= $label ?>"></label> | ||
23 | 25 | ||
24 | - <input id="edu-to-<?= $t ?>" type="number" class="form-control form-control custom-input-2 custom-input-2-date" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][1][year_from]"/> | ||
25 | - <label for="edu-to-<?= $t ?>"></label> | 26 | + <input id="edu-to-<?= ++$label ?>" type="number" class="form-control form-control custom-input-2 custom-input-2-date" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][1][year_from]"/> |
27 | + <label for="edu-to-<?= $label ?>"></label> | ||
26 | 28 | ||
27 | - <input id="edu-to-<?= $t ?>" type="number" class="form-control form-control custom-input-2 custom-input-2-date" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][2][year_to]"/> | ||
28 | - <label for="edu-out-<?= $t ?>"></label> | 29 | + <input id="edu-out-<?= ++$label ?>" type="number" class="form-control form-control custom-input-2 custom-input-2-date" value="<?= isset( $model[ ++$t ][ 'value' ] ) ? $model[ $t ][ 'value' ] : '' ?>" name="Fields[education][<?= $row ?>][2][year_to]"/> |
30 | + <label for="edu-out-<?= $label ?>"></label> | ||
29 | 31 | ||
30 | <span data-id="<?= isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> | 32 | <span data-id="<?= isset( $model[ $i ][ 'parent_key' ] ) ? $model[ $i ][ 'parent_key' ] : 0 ?>" title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span> |
31 | <?= Html::endTag('div') ?> | 33 | <?= Html::endTag('div') ?> |
@@ -38,6 +40,7 @@ | @@ -38,6 +40,7 @@ | ||
38 | 40 | ||
39 | <script> | 41 | <script> |
40 | var start_i_<?=$this->context->id?> = <?=$i?>; | 42 | var start_i_<?=$this->context->id?> = <?=$i?>; |
43 | + var start_label_<?=$this->context->id?> = <?=$label?>; | ||
41 | $ (document) | 44 | $ (document) |
42 | .ready ( | 45 | .ready ( |
43 | function () | 46 | function () |
@@ -51,12 +54,12 @@ | @@ -51,12 +54,12 @@ | ||
51 | var block_id = $ (this) | 54 | var block_id = $ (this) |
52 | .parent ('fieldset'); | 55 | .parent ('fieldset'); |
53 | var sub_block = '<div class="form-group" >' + | 56 | var sub_block = '<div class="form-group" >' + |
54 | - '<input id="edu-name-' + start_i_<?=$this->context->id?>++ +'" type="text" placeholder="" class="form-control custom-input-2" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][0][name]" />' + | ||
55 | - '<label for="edu-name-' + start_i_<?=$this->context->id?>++ +'"></label>'+ | ||
56 | - '<input id="edu-to-' + start_i_<?=$this->context->id?>++ +'" type="number" class="form-control custom-input-2 custom-input-2-date" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][1][year_from]" />' + | ||
57 | - '<label for="edu-to-' + start_i_<?=$this->context->id?>++ +'"></label>'+ | ||
58 | - '<input id="edu-out-' + start_i_<?=$this->context->id?>++ +'"" type="number" class="form-control custom-input-2 custom-input-2-date" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][2][year_to]" />' + | ||
59 | - '<label for="edu-out-' + start_i_<?=$this->context->id?>++ +'"></label>'+ | 57 | + '<input id="edu-name-' + ++start_label_<?=$this->context->id?> +'" type="text" placeholder="" class="form-control custom-input-2" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][0][name]" />' + |
58 | + '<label for="edu-name-' + start_label_<?=$this->context->id?> +'"></label>'+ | ||
59 | + '<input id="edu-to-' + ++start_label_<?=$this->context->id?> +'" type="number" class="form-control custom-input-2 custom-input-2-date" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][1][year_from]" />' + | ||
60 | + '<label for="edu-to-' + start_label_<?=$this->context->id?> +'"></label>'+ | ||
61 | + '<input id="edu-out-' + ++start_label_<?=$this->context->id?> +'"" type="number" class="form-control custom-input-2 custom-input-2-date" value="" name="Fields[education][' + start_i_<?=$this->context->id?>++ + '][2][year_to]" />' + | ||
62 | + '<label for="edu-out-' + start_label_<?=$this->context->id?> +'"></label>'+ | ||
60 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>' + | 63 | '<span title="удалить" class="glyphicon glyphicon-trash delete-field-item"></span>' + |
61 | '<div>'; | 64 | '<div>'; |
62 | console.log (block); | 65 | console.log (block); |