Blame view

frontend/views/accounts/service.php 13.7 KB
51e0a262   Yarik   test
1
  <?php
5f49082a   Yarik   test
2
      /**
1b56164e   Yarik   test
3
4
5
6
7
       * @var User     $user
       * @var UserInfo $user_info
       * @var string[] $specialization
       * @var string[] $payment
       * @var string[] $currecnies
5f49082a   Yarik   test
8
       */
9cc08528   Yarik   test
9
      use common\models\Currency;
e8236f44   Yarik   test
10
      use common\models\Specialization;
b95371cf   Yarik   test
11
      use common\models\User;
5f49082a   Yarik   test
12
      use common\models\UserInfo;
d02fd466   Yarik   test
13
      use kartik\select2\Select2;
e8236f44   Yarik   test
14
      use yii\helpers\ArrayHelper;
5f49082a   Yarik   test
15
      use yii\helpers\Html;
d02fd466   Yarik   test
16
      use yii\web\JsExpression;
5f49082a   Yarik   test
17
18
      use yii\widgets\ActiveForm;
  
8e5fa1e8   Виталий   tokar commit
19
      $this->title = 'Услуги';
5f49082a   Yarik   test
20
      $this->params[ 'breadcrumbs' ][] = $this->title;
51e0a262   Yarik   test
21
  ?>
8e5fa1e8   Виталий   tokar commit
22
23
24
25
26
27
28
29
30
31
32
33
34
  <div class="login-left-column-title style">
      <table cellpadding="0" cellspacing="0" border="0">
          <tr>
              <td><?= $this->title ?></td>
              <td style="font-size: 13px; color: #b7b7b7;padding-left: 15px;">Рекомендуем детально заполнить для исполнителя. Это сильно влияет на количество заказов.</td>
          </tr>
      </table>
  </div>
  <div class="admin-service-wr style">
      <?php
          $form = ActiveForm::begin();
      ?>
      <div class="input-blocks-wrapper">
9230f848   Виталий   tokar commit
35
          <div class="input-blocks admin-currency-first">
8e5fa1e8   Виталий   tokar commit
36
              <?= $form->field($user_info, 'salary', [
9230f848   Виталий   tokar commit
37
                  'template' => "{label}<br /><span class='admn-input-txt'>от</span>{input}\n{hint}\n{error}",
8e5fa1e8   Виталий   tokar commit
38
39
                  'options'  => [ 'class' => 'form-inline' ],
              ])
9230f848   Виталий   tokar commit
40
41
42
43
44
45
46
                  ->label('Стоимость работ')
                  ->textInput (['class'=> 'custom-input-2 custom-input-2-date','type'=>'number']);
              ?>
          </div>
          <div class="input-blocks admin-currency-second">
              <?=
              $form->field($user_info, 'salary_currency', [
eda71814   Виталий   tokar commit
47
                  'template' => "{input}<span class='admn-input-txt' style='padding-top: 7px; display: block'>за час</span>\n{hint}\n{error}",
9230f848   Виталий   tokar commit
48
49
50
51
              ])
                  ->label(false)
                  ->dropDownList(Currency::getCurrencyDropdown());
              ?>
8e5fa1e8   Виталий   tokar commit
52
53
54
          </div>
      </div>
  
c7e64161   Виталий   tokar commit
55
56
57
58
59
60
61
62
63
64
65
66
      <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): ?>
e8236f44   Yarik   test
67
  
c7e64161   Виталий   tokar commit
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
                                  <?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($user, "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) ?>
                                                          </a>
                                                      </li>
                                                  <?php endif; ?>
                                              <?php endforeach; ?>
                                          </ul>
                                      </li>
                                  <?php endif; ?>
                              <?php endforeach; ?>
e8236f44   Yarik   test
94
  
c7e64161   Виталий   tokar commit
95
96
97
98
99
100
101
102
                          </ul>
                      </li>
                  <?php endforeach; ?>
              </ul>
          </div>
          <div class="style admn-menu-err">
              <div class="help-block">Необходимо выбрать хотя бы одну «специализацию».</div>
          </div>
8e5fa1e8   Виталий   tokar commit
103
      </div>
c7e64161   Виталий   tokar commit
104
105
106
  
      <div class="admin-specialization-selected style"><ul></ul></div>
  
93e3bd31   Виталий   tokar commit
107
      <div class="input-blocks-wrapper admin-city-array">
d02fd466   Yarik   test
108
          <div class="input-blocks">
1b56164e   Yarik   test
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
              <?= $form->field($user_info, 'geographies')
                       ->widget(Select2::classname(), [
                           'options'       => [
                               'placeholder' => 'Выбор города ...',
                               'multiple'    => true,
                           ],
                           '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; }'),
                           ],
                       ]); ?>
8e5fa1e8   Виталий   tokar commit
128
129
130
131
132
133
134
135
          </div>
      </div>
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($user_info, 'guarantee', [
                  'template' => "{label}<br />{input}<span class='admn-input-txt'>лет</span>\n{hint}\n{error}",
                  'options'  => [ 'class' => 'form-inline' ],
              ])
1b56164e   Yarik   test
136
137
138
139
140
                       ->label('Гарантия качества работ')
                       ->textInput([
                           'class' => 'custom-input-2 custom-input-2-date custom-input-2-margin-r',
                           'type'  => 'number',
                       ]) ?>
8e5fa1e8   Виталий   tokar commit
141
142
143
144
145
146
          </div>
      </div>
  
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ])
1b56164e   Yarik   test
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
                       ->label('Работа по договору')
                       ->radioList([
                           1 => 'Да',
                           0 => 'Нет',
                       ], [
                               'item' => function($index, $label, $name, $checked, $value) {
                                   $return = '<div class="admin-who-check">';
                                   $return .= '<input class="custom-radio" id="select_admin_doc' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
                                   $return .= '<label for="select_admin_doc' . $value . '" >';
                                   $return .= '<span></span>' . ucwords($label);
                                   $return .= '</label>';
                                   $return .= '</div>';
                                   return $return;
                               },
                           ]) ?>
8e5fa1e8   Виталий   tokar commit
162
163
164
165
166
167
          </div>
      </div>
  
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ])
1b56164e   Yarik   test
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
                       ->label('Предоставляете смету')
                       ->radioList([
                           1 => 'Да',
                           0 => 'Нет',
                       ], [
                           'item' => function($index, $label, $name, $checked, $value) {
                               $return = '<div class="admin-who-check">';
                               $return .= '<input class="custom-radio" id="select_admin_estimate' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
                               $return .= '<label for="select_admin_estimate' . $value . '" >';
                               $return .= '<span></span>' . ucwords($label);
                               $return .= '</label>';
                               $return .= '</div>';
                               return $return;
                           },
                       ]) ?>
8e5fa1e8   Виталий   tokar commit
183
184
185
186
187
188
          </div>
      </div>
  
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ])
1b56164e   Yarik   test
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
                       ->label('Делаете сами закупку материалов')
                       ->radioList([
                           1 => 'Да',
                           0 => 'Нет',
                       ], [
                           'item' => function($index, $label, $name, $checked, $value) {
                               $return = '<div class="admin-who-check">';
                               $return .= '<input class="custom-radio" id="select_admin_purchase' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
                               $return .= '<label for="select_admin_purchase' . $value . '" >';
                               $return .= '<span></span>' . ucwords($label);
                               $return .= '</label>';
                               $return .= '</div>';
                               return $return;
                           },
                       ]) ?>
8e5fa1e8   Виталий   tokar commit
204
205
206
207
208
          </div>
      </div>
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ])
1b56164e   Yarik   test
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
                       ->label('Занимаетесь сами доставкой материалов')
                       ->radioList([
                           1 => 'Да',
                           0 => 'Нет',
                       ], [
                           'item' => function($index, $label, $name, $checked, $value) {
                               $return = '<div class="admin-who-check">';
                               $return .= '<input class="custom-radio" id="select_admin_delivery' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
                               $return .= '<label for="select_admin_delivery' . $value . '" >';
                               $return .= '<span></span>' . ucwords($label);
                               $return .= '</label>';
                               $return .= '</div>';
                               return $return;
                           },
                       ]) ?>
8e5fa1e8   Виталий   tokar commit
224
225
226
227
228
229
230
231
232
          </div>
      </div>
  
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($user_info, 'prepayment', [
                  'template' => "{label}<br />{input}<span class='admn-input-txt'>%</span>\n{hint}\n{error}",
                  'options'  => [ 'class' => 'form-inline' ],
              ])
1b56164e   Yarik   test
233
234
235
236
237
                       ->label('Минимальная предоплата за работы')
                       ->textInput([
                           'class' => 'custom-input-2 custom-input-2-date custom-input-2-margin-r',
                           'type'  => 'number',
                       ]) ?>
8e5fa1e8   Виталий   tokar commit
238
239
240
241
242
243
          </div>
      </div>
  
      <div class="input-blocks-wrapper style border-general">
          <div class="input-blocks">
              <?= $form->field($user, 'paymentInput', [ 'template' => "{label}\n{input}\n{error}" ])
1b56164e   Yarik   test
244
245
246
247
248
249
250
251
252
253
254
255
                       ->label('Способы оплаты')
                       ->checkboxList($payment, [
                               '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;
                               },
                           ]) ?>
8e5fa1e8   Виталий   tokar commit
256
257
258
          </div>
      </div>
  
8e5fa1e8   Виталий   tokar commit
259
260
261
262
263
264
265
266
267
      <div class="input-blocks-wrapper">
          <div class="admin-save-btn style admin-save-btn-fix-line">
              <?= Html::submitButton('Сохранить') ?>
          </div>
      </div>
  
      <?php
          $form->end();
      ?>
93e3bd31   Виталий   tokar commit
268
269
  </div>
  <script>
a81136e7   Виталий   tokar commit
270
271
272
273
274
275
      $(document).ready(function(){
          $('.input-blocks.admin-currency-second select').change(function(){
              $(this).blur()
          })
      })
  </script>