Blame view

frontend/views/accounts/_vacancy_form.php 11.8 KB
eb7e82fb   Administrator   29.02.16
1
2
  <?php

      /**

a0821e65   Yarik   test
3
4
5
       * @var Vacancy          $vacancy

       * @var Employment[]     $employment

       * @var string[]         $currencies

eb7e82fb   Administrator   29.02.16
6
       * @var Specialization[] $specializations

a0821e65   Yarik   test
7
       * @var User             $user

eb7e82fb   Administrator   29.02.16
8
9
10
11
12
13
14
15
16
17
18
       */

      use common\components\Request;

      use common\models\Employment;

      use common\models\Specialization;

      use common\models\Vacancy;

      use common\widgets\FieldEditor;

      use kartik\select2\Select2;

      use mihaildev\ckeditor\CKEditor;

      use yii\helpers\Html;

      use yii\web\JsExpression;

      use yii\widgets\ActiveForm;

a41edafc   Yarik   test
19
      use common\models\User;

eb7e82fb   Administrator   29.02.16
20
21
22
23
24
25
26
27
28
29
30
31
32
  

      $this->title = 'Вакансии';

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

  ?>

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

  <div class="login-left-column-title-two style">Редактирование:</div>

  <?php

      $form = ActiveForm::begin();

  ?>

  

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

      <div class="input-blocks">

          <?= $form->field($vacancy, 'name')

a0821e65   Yarik   test
33
                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

eb7e82fb   Administrator   29.02.16
34
35
36
      </div>

  </div>

  

9fd076e8   Administrator   01.03.16
37
  

eb7e82fb   Administrator   29.02.16
38
39
40
  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($vacancy, 'user_name')

a0821e65   Yarik   test
41
42
43
44
45
46
47
48
49
50
                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

          <?php

              if(!empty( $user->firstname ) && !empty( $user->lastname )) {

                  echo Html::tag('span', 'Вы', [

                          'class'      => 'admin-hint-vacancy-contact form_auto_data',

                          'data-value' => $user->firstname . ' ' . $user->lastname,

                          'title'      => 'Вставить данные с Вашего личного кабинета',

                      ]);

              }

          ?>

eb7e82fb   Administrator   29.02.16
51
52
      </div>

  </div>

eb7e82fb   Administrator   29.02.16
53
54
55
  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($vacancy, 'phone')

a0821e65   Yarik   test
56
57
58
59
60
61
62
63
64
65
                   ->textInput([ 'class' => 'custom-input-2' ]); ?>

          <?php

              if(!empty($user->getPhones()[1]['phone'])) {

                  echo Html::tag('span', 'Вы', [

                      'class'      => 'admin-hint-vacancy-contact form_auto_data',

                      'data-value' => $user->getPhones()[1]['phone'],

                      'title'      => 'Вставить данные с Вашего личного кабинета',

                  ]);

              }

          ?>

eb7e82fb   Administrator   29.02.16
66
67
68
      </div>

  </div>

  

3b7b4418   Виталий   git
69
  <div class="input-blocks-wrapper hint-link hint-link-fx">

eb7e82fb   Administrator   29.02.16
70
      <div class="input-blocks">

a0821e65   Yarik   test
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
          <?= $form->field($vacancy, 'city')

                   ->hint('Город, в котором предлагается работа', ['tag' => 'span'])

                   ->widget(Select2::classname(), [

                       'options'       => [ 'placeholder' => 'Выбор города ...' ],

                       'pluginOptions' => [

                           'allowClear'         => true,

                           'minimumInputLength' => 3,

                           'ajax'               => [

                               'url'      => \yii\helpers\Url::to([ 'site/city' ]),

                               'dataType' => 'json',

                               'data'     => new JsExpression('function(params) { return {q:params.term}; }'),

                           ],

                           'escapeMarkup'       => new JsExpression('function (markup) { return markup; }'),

                           'templateResult'     => new JsExpression('function(city) { return city.text; }'),

                           'templateSelection'  => new JsExpression('function (city) { return city.text; }'),

                       ],

                   ]); ?>

          <?php

              if(!empty( $user->userInfo->city )) {

                  echo Html::tag('span', 'Ваш', [

                          'class'      => 'admin-hint-vacancy-contact form_auto_data',

                          'data-value' => $user->userInfo->city,

                          'title'      => 'Вставить данные с Вашего личного кабинета',

                      ]);

              }

eb7e82fb   Administrator   29.02.16
96
          ?>

eb7e82fb   Administrator   29.02.16
97
98
99
100
101
102
103
104
105
      </div>

  </div>

  

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

      <div class="input-blocks admin-currency-first">

          <?= $form->field($vacancy, 'salary', [

              'template' => "{label}<br /><span class='admn-input-txt'>от</span>{input}\n{hint}\n{error}",

              'options'  => [ 'class' => 'form-inline' ],

          ])

a0821e65   Yarik   test
106
107
108
109
110
111
                   ->label('Заработная плата')

                   ->textInput([

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

                       'type'  => 'number',

                       'min'   => 0,

                   ]); ?>

eb7e82fb   Administrator   29.02.16
112
113
      </div>

      <div class="input-blocks admin-currency-second">

a0821e65   Yarik   test
114
          <?= $form->field($vacancy, 'salary_currency', [

eb7e82fb   Administrator   29.02.16
115
116
              'template' => "{input}\n{hint}\n{error}",

          ])

a0821e65   Yarik   test
117
118
                   ->label(false)

                   ->dropDownList($currencies) ?>

eb7e82fb   Administrator   29.02.16
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
      </div>

  </div>

  

  

  <div class="input-blocks-wrapper admin-menu-list">

      <div class="input-blocks" style="width: 100%; margin-bottom: 5px">

          <label>Специализации</label>

          <div class="required"></div>

      </div>

  

      <div class="style">

          <ul class="content-menu-first">

              <?php foreach($specializations as $specialization): ?>

                  <li data-img="<?= $specialization->image ?>">

                      <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a>

                      <ul>

                          <?php foreach($specialization->children as $child_first): ?>

  

                              <?php if($child_first instanceof Specialization): ?>

                                  <li>

                                      <a href="#"><?= $child_first->specialization_name ?></a>

                                      <ul>

                                          <?php foreach($child_first->children as $child_second): ?>

                                              <?php if($child_first instanceof Specialization): ?>

                                                  <li>

                                                      <a href="#" title="<?= $child_second->specialization_name ?>">

                                                          <?= $form->field($vacancy, "specializationInput[{$child_second->specialization_id}]", [

a0821e65   Yarik   test
146
                                                              'template' => '{input}{label}{hint}{error}',

eb7e82fb   Administrator   29.02.16
147
                                                          ])

a0821e65   Yarik   test
148
149
150
151
152
153
154
                                                                   ->label('<span></span>' . $child_second->specialization_name)

                                                                   ->checkbox([

                                                                       'value'   => $child_second->specialization_id,

                                                                       'label'   => NULL,

                                                                       'uncheck' => NULL,

                                                                       'class'   => 'custom-check',

                                                                   ], false) ?>

eb7e82fb   Administrator   29.02.16
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
                                                      </a>

                                                  </li>

                                              <?php endif; ?>

                                          <?php endforeach; ?>

                                      </ul>

                                  </li>

                              <?php endif; ?>

                          <?php endforeach; ?>

  

                      </ul>

                  </li>

              <?php endforeach; ?>

          </ul>

      </div>

  

      <div class="style admn-menu-err">

          <div class="help-block">Необходимо выбрать хотя бы одну «специализацию».</div>

      </div>

  </div>

  

a0821e65   Yarik   test
175
176
177
  <div class="admin-specialization-selected style">

      <ul></ul>

  </div>

eb7e82fb   Administrator   29.02.16
178
179
180
181
  

  <div class="input-blocks-wrapper admin-vacancy-check admin-vacancy-check-fx-marg" style="margin-top: 19px">

      <div class="input-blocks">

          <?= $form->field($vacancy, 'employmentInput')

a0821e65   Yarik   test
182
183
184
185
186
187
188
189
190
191
192
                   ->checkboxList($employment, [

                       'item' => function($index, $label, $name, $checked, $value) {

                           $return = '<div class="admin-who-check-payment">';

                           $return .= '<input class="custom-check" id="select_admin_payment' . $value . '" type="checkbox" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';

                           $return .= '<label for="select_admin_payment' . $value . '" >';

                           $return .= '<span></span>' . ucwords($label);

                           $return .= '</label>';

                           $return .= '</div>';

                           return $return;

                       },

                   ]) ?>

eb7e82fb   Administrator   29.02.16
193
194
195
196
197
198
      </div>

  </div>

  

  <div class="skills-admin-wrapper style">

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

          <div class="input-blocks">

a0821e65   Yarik   test
199
200
201
202
203
204
              <?= FieldEditor::widget([

                  'template' => 'requirements',

                  'item_id'  => $vacancy->vacancy_id,

                  'model'    => 'common\models\Vacancy',

                  'language' => 'ru',

              ]); ?>

eb7e82fb   Administrator   29.02.16
205
206
207
208
209
210
          </div>

      </div>

  </div>

  

  <div class="input-blocks-wrapper full-blocks admin-editor-bl">

      <div class="input-blocks">

a0821e65   Yarik   test
211
212
          <?= $form->field($vacancy, 'description')

                   ->widget(CKEditor::className()) ?>

eb7e82fb   Administrator   29.02.16
213
214
215
216
      </div>

  </div>

  

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

06ec2844   Administrator   28.03.16
217
      <?= Html::submitButton($vacancy->isNewRecord ? Yii::t('app', 'add') : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>

eb7e82fb   Administrator   29.02.16
218
219
      <div class="admin-remove-note">

          <?php

a0821e65   Yarik   test
220
              if(!$vacancy->isNewRecord) {

06ec2844   Administrator   28.03.16
221
                  echo Html::a(Yii::t('app', 'delete'), [

a0821e65   Yarik   test
222
223
224
                      'accounts/vacancy-delete',

                      'id' => $vacancy->vacancy_id,

                  ], [

06ec2844   Administrator   28.03.16
225
226
227
                      'title'        => Yii::t('app', 'delete'),

                      'aria-label'   => Yii::t('app', 'delete'),

                      'data-confirm' =>  Yii::t('app', 'delete_confirm'),

a0821e65   Yarik   test
228
229
230
231
                      'data-method'  => 'post',

                      'data-pjax'    => 0,

                  ]);

              }

eb7e82fb   Administrator   29.02.16
232
233
234
          ?>

      </div>

      <div class="admin-back-note">

a0821e65   Yarik   test
235
          <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/vacancy' ]) ?>

eb7e82fb   Administrator   29.02.16
236
237
238
239
240
241
242
243
      </div>

  </div>

  

  

  <?php

      $form->end();

  ?>

  <script>

a0821e65   Yarik   test
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
      $(

          function()

          {

              $('.input-blocks.admin-currency-second select').change(

                  function()

                  {

                      $(this).blur()

                  }

              );

              $(document).on(

                  'click', '.form_auto_data', function()

                  {

                      var value = $(this).data('value');

                      var container = $(this).parents('.input-blocks').first();

                      var select = $(container).find('select[data-krajee-select2]').first();

                      if(select.length >= 1)

                      {

                          $(select)

                          .append('<option value="' + value + '" selected>' + value + '</option>');

                          var id = $(select).attr('id');

                          $(container).find('#select2-' + id + '-container').attr('title', value);

                          $(container).find('#select2-' + id + '-container').text(value);

                      } else

                      {

                          $(container).find('input, textarea').val(value);

                      }

                  }

              );

          }

      );

93e3bd31   Виталий   tokar commit
274
  </script>