Blame view

frontend/views/accounts/employment.php 8.81 KB
51e0a262   Yarik   test
1
  <?php
b2743529   Виталий   tokar commit
2
3
4
5
6
7
8
  /**
   * @var Job[] $job
   */
  use common\models\Job;
  use yii\helpers\Html;
  use yii\jui\DatePicker;
  use yii\widgets\ActiveForm;
3272f030   Administrator   Merge remote-trac...
9
  //HUUIISAODASIDSIA
b2743529   Виталий   tokar commit
10
11
  $this->title = 'Трудовой стаж';
  $this->params['breadcrumbs'][] = $this->title;
51e0a262   Yarik   test
12
  ?>
b2743529   Виталий   tokar commit
13
  <div class="login-left-column-title"><?= $this->title ?></div>
51e0a262   Yarik   test
14
  <?php
b2743529   Виталий   tokar commit
15
16
  $form = ActiveForm::begin ();
  $current = array_shift ($job);
51e0a262   Yarik   test
17
  ?>
bdf3e361   Виталий   tokar commit
18
  <div class="current_job_container style">
b2743529   Виталий   tokar commit
19
      <div class="login-left-column-title-two style">Текущее место работы:</div>
bdf3e361   Виталий   tokar commit
20
      <div class="current_job_inputs first_current_job_inputs border-general style">
b2743529   Виталий   tokar commit
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
          <div class="input-blocks-wrapper">
              <div class="input-blocks">
                  <?= $form->field ($current, '[0]name')
                      ->label ('Название')
                      ->textInput (['class'=> 'custom-input-2']);
                  ?>
              </div>
          </div>
  
          <div class="input-blocks-wrapper">
              <div class="input-blocks">
                  <?= $form->field ($current, '[0]link')
                      ->label ('Ссылка на компанию на сайте МФП')
                      ->textInput (['class'=> 'custom-input-2']);
                  ?>
              </div>
          </div>
  
          <div class="input-blocks-wrapper">
              <div class="input-blocks">
                  <?= $form->field ($current, '[0]position')
                      ->label ('Должность')
                      ->textInput (['class'=> 'custom-input-2']);
                  ?>
              </div>
          </div>
  
          <div class="input-blocks-wrapper">
              <div class="input-blocks">
ccab742d   Виталий   tokar commit
50
                  <?= $form->field ($current, '[0]date_start', ['options' => ['class' => 'test2class']])
b2743529   Виталий   tokar commit
51
                      ->label ('Дата начала работы')
bdf3e361   Виталий   tokar commit
52
                      ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]);
b2743529   Виталий   tokar commit
53
54
                  ?>
              </div>
e9013fc3   Yarik   test
55
          </div>
b2743529   Виталий   tokar commit
56
  
bdf3e361   Виталий   tokar commit
57
          <div class="input-blocks-wrapper admin-quantity-project">
b2743529   Виталий   tokar commit
58
59
60
              <div class="input-blocks">
                  <?= $form->field ($current, '[0]total_count')
                      ->label ('Количество проектов, в которых принимали участие')
bdf3e361   Виталий   tokar commit
61
                      ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
b2743529   Виталий   tokar commit
62
                  ?>
bdf3e361   Виталий   tokar commit
63
64
65
66
67
68
                  <div class="fix-quantity-project">
                      <?= $form->field ($current, '[0]complete_count')
                          ->label ('из них реализовано')
                          ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
                      ?>
                  </div>
b2743529   Виталий   tokar commit
69
              </div>
bdf3e361   Виталий   tokar commit
70
71
72
  
  
  
b2743529   Виталий   tokar commit
73
74
          </div>
  
bdf3e361   Виталий   tokar commit
75
76
      </div>
      <div class="current_job_inputs border-general style">
b2743529   Виталий   tokar commit
77
78
          <div class="input-blocks-wrapper">
              <div class="input-blocks">
bdf3e361   Виталий   tokar commit
79
80
81
                  <?= $form->field ($current, '[0]date_start')
                      ->label ('Когда начали заниматься проектированием')
                      ->textInput (['class'=> 'custom-input-2']);
b2743529   Виталий   tokar commit
82
83
84
                  ?>
              </div>
          </div>
e9013fc3   Yarik   test
85
      </div>
b2743529   Виталий   tokar commit
86
  </div>
bdf3e361   Виталий   tokar commit
87
88
  <div class="prev_job_container style">
      <div class="login-left-column-title-two previous-employment-wr style">Предыдущие места работы</div>
b2743529   Виталий   tokar commit
89
90
91
92
93
94
      <?php
      foreach ($job as $index => $job_model)
      {
      ?>
  
      <div class='prev_job_inputs'>
bdf3e361   Виталий   tokar commit
95
96
97
98
99
100
101
102
                  <div class="input-blocks-wrapper">
                      <div class="input-blocks">
                          <?= $form->field ($job_model, '['. ($index + 1) .']name')
                              ->label ('Название')
                              ->textInput (['class'=> 'custom-input-2']);
                          ?>
                      </div>
                  </div>
b2743529   Виталий   tokar commit
103
104
105
106
107
108
109
110
111
112
113
114
  
                  <div class="input-blocks-wrapper">
                      <div class="input-blocks">
                          <?= $form->field ($job_model, '['. ($index + 1) .']link')
                              ->label ('Ссылка на компанию на сайте МФП')
                              ->textInput (['class'=> 'custom-input-2']);
                          ?>
                      </div>
                  </div>
  
                  <div class="input-blocks-wrapper">
                      <div class="input-blocks">
bdf3e361   Виталий   tokar commit
115
                          <?= $form->field ($current, '[0]date_start')
b2743529   Виталий   tokar commit
116
117
118
119
120
121
122
123
124
125
                              ->label ('Дата начала работы')
                              ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]);
                          ?>
                      </div>
                  </div>
  
                  <div class="input-blocks-wrapper">
                      <div class="input-blocks">
                          <?= $form->field ($job_model, '['. ($index + 1) .']date_end')
                              ->label ('Дата окончания работы')
bdf3e361   Виталий   tokar commit
126
                              ->widget (DatePicker::className (), ['options' => ['class' => 'custom-input-2'], 'language' => 'ru', 'dateFormat' => 'dd-MM-yyyy', 'clientOptions' => ['changeYear' => true, 'yearRange' => 'c-20:c', 'changeMonth' => true]]);
b2743529   Виталий   tokar commit
127
128
129
130
131
132
133
134
135
136
137
138
139
                          ?>
                      </div>
                  </div>
  
                  <div class="input-blocks-wrapper">
                      <div class="input-blocks">
                          <?= $form->field ($job_model, '['. ($index + 1) .']position')
                              ->label ('Должность')
                              ->textInput (['class'=> 'custom-input-2']);
                          ?>
                      </div>
                  </div>
  
bdf3e361   Виталий   tokar commit
140
                  <div class="input-blocks-wrapper admin-quantity-project">
b2743529   Виталий   tokar commit
141
142
143
                      <div class="input-blocks">
                          <?= $form->field ($job_model, '['. ($index + 1) .']total_count')
                              ->label ('Количество проектов, в которых принимали участие')
bdf3e361   Виталий   tokar commit
144
                              ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
b2743529   Виталий   tokar commit
145
                          ?>
bdf3e361   Виталий   tokar commit
146
                          <div class="fix-quantity-project">
b2743529   Виталий   tokar commit
147
148
                          <?= $form->field ($job_model, '['. ($index + 1) .']complete_count')
                              ->label ('из них реализовано')
bdf3e361   Виталий   tokar commit
149
                              ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
b2743529   Виталий   tokar commit
150
151
                          ?>
                      </div>
bdf3e361   Виталий   tokar commit
152
                      </div>
b2743529   Виталий   tokar commit
153
                  </div>
bdf3e361   Виталий   tokar commit
154
155
                  <?= Html::button('', ['class' => 'remove_job_button']) ?>
      </div>
b2743529   Виталий   tokar commit
156
157
              <?php } ?>
  
bdf3e361   Виталий   tokar commit
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  </div>
  
  <div class="add-field-employment fix_add-field-employment style">
      <?=
       Html::button('добавить еще место работы', ['id' => 'add_job_button', 'class' => 'btn']);
      ?>
  </div>
  
  
  <div class="input-blocks-wrapper">
      <div class="admin-save-btn skills-save-btn  style">
          <?= Html::submitButton('Сохранить',['class'=>'input-blocks-wrapper button']) ?>
      </div>
  </div>
e9013fc3   Yarik   test
172
          <?php
bdf3e361   Виталий   tokar commit
173
               $form->end ();
e9013fc3   Yarik   test
174
          ?>
e9013fc3   Yarik   test
175
176
177
178
179
180
  <script>
      $(function() {
          var regexp = /^[\w]+\[(\d+)\].*$/;
          $(document).on('click', '#add_job_button', function() {
              var inputs = $('.prev_job_inputs').last();
              var name = $(inputs).find('input, textarea').first().attr('name');
588209fc   Yarik   test
181
182
183
184
              var result = regexp.exec(name);
              var lastindex;
              if(result != null) {
                  lastindex = result[1];
bdf3e361   Виталий   tokar commit
185
                  console.log('111111111')
588209fc   Yarik   test
186
187
              } else {
                  lastindex = 1;
bdf3e361   Виталий   tokar commit
188
189
                  $('.prev_job_container').removeClass('none-job-inputs')
                  $('.add-field-employment').removeClass('none-job-inputs')
588209fc   Yarik   test
190
              }
e9013fc3   Yarik   test
191
192
193
              $.get('/accounts/get-form', { lastindex: lastindex }, function(data) {
                  $('.prev_job_container').append($(data).find('.ajax-loaded').first().html());
                  $(data).filter('script').appendTo('body');
e9013fc3   Yarik   test
194
              });
bdf3e361   Виталий   tokar commit
195
  
e9013fc3   Yarik   test
196
          });
588209fc   Yarik   test
197
          $(document).on('click', '.remove_job_button', function() {
bdf3e361   Виталий   tokar commit
198
199
200
201
202
203
              $(this).parents('.prev_job_inputs').remove()
              var prevEmploy =  $('.prev_job_inputs').length
              if(prevEmploy<1){
                  $('.prev_job_container').addClass('none-job-inputs')
                  $('.add-field-employment').addClass('none-job-inputs')
              }
588209fc   Yarik   test
204
          });
e9013fc3   Yarik   test
205
206
      });
  </script>
bdf3e361   Виталий   tokar commit
207
208
209
210
211
212
213
214
215
  
  <script>
  //    $(document).ready(function(){
  //      var prevEmploy =  $('.prev_job_inputs').length
  //        if(prevEmploy<1){
  //            $('.prev_job_container').addClass
  //        }
  //    })
  </script>