Blame view

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