Blame view

frontend/views/accounts/_vacancy_form.php 10.4 KB
ea09d15d   Yarik   test
1
2
3
4
  <?php
      /**
       * @var Vacancy $vacancy
       * @var Employment[] $employment
1b56164e   Yarik   test
5
6
       * @var string[] $currencies
       * @var Specialization[] $specializations
ea09d15d   Yarik   test
7
       */
3f7185f2   Yarik   test
8
      use common\components\Request;
ea09d15d   Yarik   test
9
      use common\models\Employment;
1b56164e   Yarik   test
10
      use common\models\Specialization;
ea09d15d   Yarik   test
11
12
      use common\models\Vacancy;
      use common\widgets\FieldEditor;
e8236f44   Yarik   test
13
      use kartik\select2\Select2;
ea09d15d   Yarik   test
14
15
      use mihaildev\ckeditor\CKEditor;
      use yii\helpers\Html;
e8236f44   Yarik   test
16
      use yii\web\JsExpression;
ea09d15d   Yarik   test
17
18
      use yii\widgets\ActiveForm;
  
8e5fa1e8   Виталий   tokar commit
19
      $this->title = 'Вакансии';
ea09d15d   Yarik   test
20
21
      $this->params[ 'breadcrumbs' ][] = $this->title;
  ?>
8e5fa1e8   Виталий   tokar commit
22
  <div class="login-left-column-title"><?= $this->title ?></div>
58806a3d   Виталий   tokar commit
23
  <div class="login-left-column-title-two style">Редактирование:</div>
ea09d15d   Yarik   test
24
25
26
27
  <?php
      $form = ActiveForm::begin();
  ?>
  
58806a3d   Виталий   tokar commit
28
29
30
31
32
33
34
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
          <?= $form->field($vacancy, 'name')
              ->textInput (['class'=> 'custom-input-2']); ?>
      </div>
  </div>
  
58806a3d   Виталий   tokar commit
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
          <?= $form->field($vacancy, 'link')
              ->textInput (['class'=> 'custom-input-2']); ?>
      </div>
  </div>
  
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
          <?= $form->field($vacancy, 'user_name')
              ->textInput (['class'=> 'custom-input-2']); ?>
          <span class="admin-hint-vacancy-contact">Вы</span>
      </div>
  </div>
ea09d15d   Yarik   test
49
  
58806a3d   Виталий   tokar commit
50
51
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
1b56164e   Yarik   test
52
53
          <?= $form->field($vacancy, 'phone')
                   ->textInput (['class'=> 'custom-input-2']); ?>
58806a3d   Виталий   tokar commit
54
55
56
          <span class="admin-hint-vacancy-contact">Ваш</span>
      </div>
  </div>
ea09d15d   Yarik   test
57
  
e8236f44   Yarik   test
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
          <?=
              $form->field($vacancy, 'city')->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; }'),
                  ],
              ]);
          ?>
58806a3d   Виталий   tokar commit
77
78
79
          <span class="admin-hint-vacancy-contact">Ваш</span>
      </div>
  </div>
e8236f44   Yarik   test
80
  
1b56164e   Yarik   test
81
  <div class="input-blocks-wrapper">
93e3bd31   Виталий   tokar commit
82
83
84
85
86
87
88
89
90
91
92
93
      <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' ],
          ])
              ->label('Заработная плата')
              ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
          ?>
      </div>
      <div class="input-blocks admin-currency-second">
          <?=
          $form->field($vacancy, 'salary_currency', [
54962f07   Виталий   tokar commit
94
              'template' => "{input}\n{hint}\n{error}",
93e3bd31   Виталий   tokar commit
95
96
97
98
          ])
              ->label(false)
              ->dropDownList($currencies)
          ?>
1b56164e   Yarik   test
99
100
101
      </div>
  </div>
  
93e3bd31   Виталий   tokar commit
102
  
82c2fa67   Виталий   tokar commit
103
  <div class="input-blocks-wrapper admin-menu-list">
54962f07   Виталий   tokar commit
104
105
106
      <div class="input-blocks" style="width: 100%; margin-bottom: 5px">
          <label>Специализации</label>
      </div>
1b56164e   Yarik   test
107
108
109
110
111
112
113
114
115
116
117
118
119
120
      <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>
82c2fa67   Виталий   tokar commit
121
122
123
124
125
126
127
128
129
130
131
                                                  <a href="#" title="<?= $child_second->specialization_name ?>">
                                                      <?= $form->field($vacancy, "specializationInput[{$child_second->specialization_id}]", [
                                                          'template'     => '{input}{label}{hint}{error}',
                                                      ])
                                                          ->label('<span></span>' . $child_second->specialization_name)
                                                          ->checkbox([
                                                              'value'   => $child_second->specialization_id,
                                                              'label'   => NULL,
                                                              'uncheck' => NULL,
                                                              'class' => 'custom-check',
                                                          ], false) ?>
1b56164e   Yarik   test
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
                                                  </a>
                                              </li>
                                          <?php endif; ?>
                                      <?php endforeach; ?>
                                  </ul>
                              </li>
                          <?php endif; ?>
                      <?php endforeach; ?>
  
                  </ul>
              </li>
          <?php endforeach; ?>
      </ul>
  </div>
  
54962f07   Виталий   tokar commit
147
148
149
150
151
152
  <div class="admin-specialization-selected style">
      <ul>
  
      </ul>
  </div>
  
58806a3d   Виталий   tokar commit
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
  <div class="input-blocks-wrapper admin-vacancy-check" style="margin-top: 29px">
      <div class="input-blocks">
          <?= $form->field($vacancy, 'employmentInput')
              ->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;
                      }
                  ]
              ) ?>
e8236f44   Yarik   test
169
170
      </div>
  </div>
ea09d15d   Yarik   test
171
  
58806a3d   Виталий   tokar commit
172
173
174
175
176
177
178
179
180
181
182
  <div class="skills-admin-wrapper style">
      <div class="input-blocks-wrapper skills-programs">
          <div class="input-blocks">
              <?= FieldEditor::widget (
                  [
                      'template' => 'requirements', 'item_id' => $vacancy->vacancy_id, 'model' => 'common\models\Vacancy', 'language' => 'ru',
                  ]
              ); ?>
          </div>
      </div>
  </div>
ea09d15d   Yarik   test
183
  
8e5fa1e8   Виталий   tokar commit
184
185
186
187
188
  <div class="input-blocks-wrapper full-blocks admin-editor-bl">
      <div class="input-blocks">
          <?= $form->field($vacancy, 'description')->widget(CKEditor::className()) ?>
      </div>
  </div>
ea09d15d   Yarik   test
189
  
04b478b9   Виталий   tokar commit
190
  <div class="admin-save-btn skills-save-btn admin-add-remove-wr style">
3a1bbfcc   Yarik   test
191
      <?= Html::submitButton($vacancy->isNewRecord?'Добавить':'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
04b478b9   Виталий   tokar commit
192
193
      <div class="admin-remove-note">
          <?php
3a1bbfcc   Yarik   test
194
195
196
197
198
199
200
201
202
203
204
205
          if(!$vacancy->isNewRecord) {
              echo Html::a('Удалить', [
                  'accounts/vacancy-delete',
                  'id' => $vacancy->vacancy_id,
              ], [
                  'title'        => 'Удалить',
                  'aria-label'   => 'Удалить',
                  'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
                  'data-method'  => 'post',
                  'data-pjax'    => 0,
              ]);
          }
04b478b9   Виталий   tokar commit
206
207
208
          ?>
      </div>
      <div class="admin-back-note">
1c67655e   Yarik   test
209
          <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer)?\Yii::$app->request->referrer:['accounts/vacancy' ]) ?>
04b478b9   Виталий   tokar commit
210
      </div>
8e5fa1e8   Виталий   tokar commit
211
  </div>
ea09d15d   Yarik   test
212
  
ea09d15d   Yarik   test
213
214
215
216
  
  <?php
      $form->end();
  ?>
93e3bd31   Виталий   tokar commit
217
218
219
220
221
  <script>
      $(document).ready(function(){
          $('.input-blocks.admin-currency-second select').change(function(){
              $(this).blur()
          })
54962f07   Виталий   tokar commit
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
  
          specializationTags()
          function specializationTags(){
              addSpecializationTags()
              removeSpecializationTags()
              newAddSpecializationTags()
  
              function addSpecializationTags(){
                  var specTags = $('.admin-page .third-ul-menu input:checked')
                  for (var spI=0;spI<specTags.length;spI++) {
                      var newSpecTagsId = $(specTags[spI]).attr('id')
                      var newSpecTagsTxt = $(specTags[spI]).parents('a').text()
                      $('.admin-page .admin-specialization-selected ul').append('<li data-spec-id="'+newSpecTagsId+'">'+newSpecTagsTxt+'</li>')
                  }
              }
  
              function removeSpecializationTags(){
                  $('body').on('click', '.admin-page .admin-specialization-selected ul li', function(){
                      var removeSpecTagsId = $(this).attr('data-spec-id')
                      $('.admin-page .third-ul-menu #'+removeSpecTagsId).attr('checked', false)
                      $(this).remove()
                  })
              }
  
              function newAddSpecializationTags(){
                  $('.admin-page .third-ul-menu input').change(function(){
                      var thisSpecTagsId = $(this).attr('id')
                      var thisSpecTagsTxt = $(this).parents('a').text()
                      if($(this).prop("checked")){
                          $('.admin-page .admin-specialization-selected ul').append('<li data-spec-id="'+thisSpecTagsId+'">'+thisSpecTagsTxt+'</li>')
                      } else {
                       $('.admin-page .admin-specialization-selected ul li[data-spec-id="'+thisSpecTagsId+'"]').remove()
                      }
                  })
              }
          }
93e3bd31   Виталий   tokar commit
258
259
      })
  </script>