Blame view

frontend/views/accounts/employment.php 12.2 KB
eb7e82fb   Administrator   29.02.16
1
2
3
4
5
6
7
  <?php

      /**

       * @var Job[]    $job

       * @var UserInfo $user_info

       */

      use common\models\Job;

      use common\models\UserInfo;

eb780746   Yarik   test
8
      use mihaildev\ckeditor\CKEditor;

eb7e82fb   Administrator   29.02.16
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
      use yii\helpers\Html;

      use yii\jui\DatePicker;

      use yii\widgets\ActiveForm;

  

      $this->title = 'Трудовой стаж';

      $this->params[ 'breadcrumbs' ][] = $this->title;

  ?>

  <div class="login-left-column-title"><?= $this->title ?></div>

  <?php

      $form = ActiveForm::begin();

      $current = array_shift($job);

  ?>

  <div class="current_job_container style">

      <div class="login-left-column-title-two style">Текущее место работы:</div>

      <div class="current_job_inputs first_current_job_inputs border-general style">

          <div class="input-blocks-wrapper">

              <div class="input-blocks">

                  <?= $form->field($current, '[0]name')

                           ->label('Название')

                           ->textInput([ 'class' => 'custom-input-2' ]); ?>

              </div>

          </div>

  

803325d5   Виталий   git
32
          <div class="input-blocks-wrapper hint-link">

eb7e82fb   Administrator   29.02.16
33
34
35
              <div class="input-blocks">

                  <?= $form->field($current, '[0]link')

                           ->label('Ссылка на компанию на сайте МФП')

4b85f536   Yarik   test
36
                           ->hint('Пример: ' . $_SERVER[ 'HTTP_HOST' ] . '/company/common/1')

eb7e82fb   Administrator   29.02.16
37
38
39
40
41
42
43
44
45
46
47
48
49
50
                           ->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">

eb780746   Yarik   test
51
52
53
54
55
56
57
                  <?= $form->field($current, '[0]achievement')

                           ->widget(CKEditor::className(), [ 'editorOptions' => [ 'preset' => 'basic' ] ]); ?>

              </div>

          </div>

  

          <div class="input-blocks-wrapper">

              <div class="input-blocks">

4b85f536   Yarik   test
58
59
60
61
62
63
64
65
66
67
68
69
                  <?= $form->field($current, '[0]date_start', [ 'options' => [ 'class' => 'test2class' ] ])

                           ->label('Дата начала работы')

                           ->widget(DatePicker::className(), [

                               'options'       => [ 'class' => 'custom-input-2' ],

                               'language'      => 'ru',

                               'dateFormat'    => 'dd-MM-yyyy',

                               'clientOptions' => [

                                   'changeYear'  => true,

                                   'yearRange'   => 'c-20:c',

                                   'changeMonth' => true,

                               ],

                           ]); ?>

eb7e82fb   Administrator   29.02.16
70
71
72
73
74
              </div>

          </div>

  

          <div class="input-blocks-wrapper admin-quantity-project">

              <div class="input-blocks">

4b85f536   Yarik   test
75
76
77
78
79
80
                  <?= $form->field($current, '[0]total_count')

                           ->label('Количество проектов, в которых принимали участие')

                           ->textInput([

                               'class' => 'custom-input-2 custom-input-2-date',

                               'type'  => 'number',

                           ]); ?>

eb7e82fb   Administrator   29.02.16
81
                  <div class="fix-quantity-project">

5d627502   Yarik   test
82
                      <?= $form->field($current, '[0]complete_count', [ 'enableClientValidation' => false ])

4b85f536   Yarik   test
83
84
                               ->label('из них реализовано')

                               ->textInput([

5d627502   Yarik   test
85
                                   'class' => 'custom-input-2 custom-input-2-date no-client-validation',

4b85f536   Yarik   test
86
87
                                   'type'  => 'number',

                               ]); ?>

eb7e82fb   Administrator   29.02.16
88
89
90
91
                  </div>

              </div>

  

  

eb7e82fb   Administrator   29.02.16
92
93
94
95
96
97
98
99
          </div>

  

      </div>

      <div class="current_job_inputs border-general style">

          <div class="input-blocks-wrapper">

              <div class="input-blocks">

                  <?= $form->field($user_info, 'experience')

                           ->label('Когда начали заниматься проектированием')

4b85f536   Yarik   test
100
101
102
103
104
                           ->input('number', [

                               'class' => 'custom-input-2',

                               'min'   => '1950',

                               'max'   => date('Y'),

                           ]); ?>

eb7e82fb   Administrator   29.02.16
105
106
107
108
109
110
111
              </div>

          </div>

      </div>

  </div>

  <div class="prev_job_container style">

      <div class="login-left-column-title-two previous-employment-wr style">Предыдущие места работы</div>

      <?php

4b85f536   Yarik   test
112
113
          foreach($job as $index => $job_model) {

              ?>

eb7e82fb   Administrator   29.02.16
114
  

4b85f536   Yarik   test
115
              <div class='prev_job_inputs'>

eb7e82fb   Administrator   29.02.16
116
117
                  <div class="input-blocks-wrapper">

                      <div class="input-blocks">

4b85f536   Yarik   test
118
119
120
                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']name')

                                   ->label('Название')

                                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

eb7e82fb   Administrator   29.02.16
121
122
123
                      </div>

                  </div>

  

803325d5   Виталий   git
124
                  <div class="input-blocks-wrapper hint-link">

eb7e82fb   Administrator   29.02.16
125
126
127
                      <div class="input-blocks">

                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']link')

                                   ->label('Ссылка на компанию на сайте МФП')

4b85f536   Yarik   test
128
                                   ->hint('Пример: ' . $_SERVER[ 'HTTP_HOST' ] . '/company/common/1')

eb7e82fb   Administrator   29.02.16
129
130
131
132
133
134
                                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

                      </div>

                  </div>

  

                  <div class="input-blocks-wrapper">

                      <div class="input-blocks">

4b85f536   Yarik   test
135
136
137
138
139
140
141
142
143
144
145
146
                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']date_start')

                                   ->label('Дата начала работы')

                                   ->widget(DatePicker::className(), [

                                       'options'       => [ 'class' => 'custom-input-2' ],

                                       'language'      => 'ru',

                                       'dateFormat'    => 'dd-MM-yyyy',

                                       'clientOptions' => [

                                           'changeYear'  => true,

                                           'yearRange'   => 'c-20:c',

                                           'changeMonth' => true,

                                       ],

                                   ]); ?>

eb7e82fb   Administrator   29.02.16
147
148
149
150
151
                      </div>

                  </div>

  

                  <div class="input-blocks-wrapper">

                      <div class="input-blocks">

4b85f536   Yarik   test
152
153
154
155
156
157
158
159
160
161
162
163
                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']date_end')

                                   ->label('Дата окончания работы')

                                   ->widget(DatePicker::className(), [

                                       'options'       => [ 'class' => 'custom-input-2' ],

                                       'language'      => 'ru',

                                       'dateFormat'    => 'dd-MM-yyyy',

                                       'clientOptions' => [

                                           'changeYear'  => true,

                                           'yearRange'   => 'c-20:c',

                                           'changeMonth' => true,

                                       ],

                                   ]); ?>

eb7e82fb   Administrator   29.02.16
164
165
166
167
168
                      </div>

                  </div>

  

                  <div class="input-blocks-wrapper">

                      <div class="input-blocks">

4b85f536   Yarik   test
169
170
171
                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']position')

                                   ->label('Должность')

                                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

eb7e82fb   Administrator   29.02.16
172
173
174
                      </div>

                  </div>

  

eb780746   Yarik   test
175
176
177
178
179
180
181
                  <div class="input-blocks-wrapper">

                      <div class="input-blocks">

                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']achievement')

                                   ->widget(CKEditor::className(), [ 'editorOptions' => [ 'preset' => 'basic' ] ]); ?>

                      </div>

                  </div>

  

eb7e82fb   Administrator   29.02.16
182
183
                  <div class="input-blocks-wrapper admin-quantity-project">

                      <div class="input-blocks">

4b85f536   Yarik   test
184
185
186
187
188
189
                          <?= $form->field($job_model, '[' . ( $index + 1 ) . ']total_count')

                                   ->label('Количество проектов, в которых принимали участие')

                                   ->textInput([

                                       'class' => 'custom-input-2 custom-input-2-date',

                                       'type'  => 'number',

                                   ]); ?>

eb7e82fb   Administrator   29.02.16
190
                          <div class="fix-quantity-project">

5d627502   Yarik   test
191
                              <?= $form->field($job_model, '[' . ( $index + 1 ) . ']complete_count', [ 'enableClientValidation' => false ])

4b85f536   Yarik   test
192
193
                                       ->label('из них реализовано')

                                       ->textInput([

5d627502   Yarik   test
194
                                           'class' => 'custom-input-2 custom-input-2-date no-client-validation',

4b85f536   Yarik   test
195
196
197
                                           'type'  => 'number',

                                       ]); ?>

                          </div>

eb7e82fb   Administrator   29.02.16
198
199
                      </div>

                  </div>

4b85f536   Yarik   test
200
201
202
                  <?= Html::button('', [ 'class' => 'remove_job_button' ]) ?>

              </div>

          <?php } ?>

eb7e82fb   Administrator   29.02.16
203
204
205
206
  

  </div>

  

  <div class="add-field-employment fix_add-field-employment style">

4b85f536   Yarik   test
207
208
209
210
      <?= Html::button('добавить еще место работы', [

          'id'    => 'add_job_button',

          'class' => 'btn',

      ]); ?>

eb7e82fb   Administrator   29.02.16
211
212
213
214
215
  </div>

  

  

  <div class="input-blocks-wrapper">

      <div class="admin-save-btn skills-save-btn  style">

4b85f536   Yarik   test
216
          <?= Html::submitButton('Сохранить', [ 'class' => 'input-blocks-wrapper button' ]) ?>

eb7e82fb   Administrator   29.02.16
217
218
      </div>

  </div>

4b85f536   Yarik   test
219
220
221
  <?php

      $form->end();

  ?>

eb7e82fb   Administrator   29.02.16
222
  <script>

4b85f536   Yarik   test
223
224
225
      $(

          function()

          {

4b85f536   Yarik   test
226
227
228
229
              var regexp = /^[\w]+\[(\d+)\].*$/;

              var prevEmploy = $('.prev_job_inputs').length

              if(prevEmploy < 1)

              {

eb7e82fb   Administrator   29.02.16
230
231
232
                  $('.prev_job_container').addClass('none-job-inputs')

                  $('.add-field-employment').addClass('none-job-inputs')

              }

4b85f536   Yarik   test
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
              $(document).on(

                  'click', '#add_job_button', function()

                  {

                      var inputs = $('.prev_job_inputs').last();

                      var name = $(inputs).find('input, textarea').first().attr('name');

                      var result = regexp.exec(name);

                      var lastindex;

                      if(result != null)

                      {

                          lastindex = result[1];

                      } else

                      {

                          lastindex = 0;

                          $('.prev_job_container').removeClass('none-job-inputs')

                          $('.add-field-employment').removeClass('none-job-inputs')

                      }

                      $.get(

                          '/accounts/get-form', {lastindex : lastindex}, function(data)

                          {

                              $('.prev_job_container')

                              .append($(data).find('.ajax-loaded').first().html());

                              $(data).filter('script').appendTo('body');

                          }

                      );

  

                  }

              );

              $(document).on(

                  'click', '.remove_job_button', function()

                  {

                      $(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')

                      }

                  }

              );

          }

      );

eb7e82fb   Administrator   29.02.16
274
  </script>