Blame view

frontend/views/accounts/employment.php 11.5 KB
eb7e82fb   Administrator   29.02.16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  <?php

      /**

       * @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;

  ?>

  <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
31
          <div class="input-blocks-wrapper hint-link">

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

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

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

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

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

4b85f536   Yarik   test
50
51
52
53
54
55
56
57
58
59
60
61
                  <?= $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
62
63
64
65
66
              </div>

          </div>

  

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

              <div class="input-blocks">

4b85f536   Yarik   test
67
68
69
70
71
72
                  <?= $form->field($current, '[0]total_count')

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

                           ->textInput([

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

                               'type'  => 'number',

                           ]); ?>

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

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

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

                               ->textInput([

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

4b85f536   Yarik   test
78
79
                                   'type'  => 'number',

                               ]); ?>

eb7e82fb   Administrator   29.02.16
80
81
82
83
                  </div>

              </div>

  

  

eb7e82fb   Administrator   29.02.16
84
85
86
87
88
89
90
91
          </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
92
93
94
95
96
                           ->input('number', [

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

                               'min'   => '1950',

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

                           ]); ?>

eb7e82fb   Administrator   29.02.16
97
98
99
100
101
102
103
              </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
104
105
          foreach($job as $index => $job_model) {

              ?>

eb7e82fb   Administrator   29.02.16
106
  

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

eb7e82fb   Administrator   29.02.16
108
109
                  <div class="input-blocks-wrapper">

                      <div class="input-blocks">

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

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

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

eb7e82fb   Administrator   29.02.16
113
114
115
                      </div>

                  </div>

  

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

eb7e82fb   Administrator   29.02.16
117
118
119
                      <div class="input-blocks">

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

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

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

eb7e82fb   Administrator   29.02.16
121
122
123
124
125
126
                                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

                      </div>

                  </div>

  

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

                      <div class="input-blocks">

4b85f536   Yarik   test
127
128
129
130
131
132
133
134
135
136
137
138
                          <?= $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
139
140
141
142
143
                      </div>

                  </div>

  

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

                      <div class="input-blocks">

4b85f536   Yarik   test
144
145
146
147
148
149
150
151
152
153
154
155
                          <?= $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
156
157
158
159
160
                      </div>

                  </div>

  

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

                      <div class="input-blocks">

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

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

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

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

                  </div>

  

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

                      <div class="input-blocks">

4b85f536   Yarik   test
169
170
171
172
173
174
                          <?= $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
175
                          <div class="fix-quantity-project">

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

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

                                       ->textInput([

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

4b85f536   Yarik   test
180
181
182
                                           'type'  => 'number',

                                       ]); ?>

                          </div>

eb7e82fb   Administrator   29.02.16
183
184
                      </div>

                  </div>

4b85f536   Yarik   test
185
186
187
                  <?= Html::button('', [ 'class' => 'remove_job_button' ]) ?>

              </div>

          <?php } ?>

eb7e82fb   Administrator   29.02.16
188
189
190
191
  

  </div>

  

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

4b85f536   Yarik   test
192
193
194
195
      <?= Html::button('добавить еще место работы', [

          'id'    => 'add_job_button',

          'class' => 'btn',

      ]); ?>

eb7e82fb   Administrator   29.02.16
196
197
198
199
200
  </div>

  

  

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

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

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

eb7e82fb   Administrator   29.02.16
202
203
      </div>

  </div>

4b85f536   Yarik   test
204
205
206
  <?php

      $form->end();

  ?>

eb7e82fb   Administrator   29.02.16
207
  <script>

4b85f536   Yarik   test
208
209
210
      $(

          function()

          {

4b85f536   Yarik   test
211
212
213
214
              var regexp = /^[\w]+\[(\d+)\].*$/;

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

              if(prevEmploy < 1)

              {

eb7e82fb   Administrator   29.02.16
215
216
217
                  $('.prev_job_container').addClass('none-job-inputs')

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

              }

4b85f536   Yarik   test
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
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
              $(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
259
  </script>