Blame view

frontend/views/accounts/_projects_form.php 14 KB
aa182b5c   Yarik   test
1
  <?php
0c65fdc5   Виталий   git
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  /**
   * @var Project          $project
   * @var Specialization[] $specialization
   * @var Payment[]        $payment
   * @var string[]         $projects
   */
  use common\components\Request;
  use common\models\Currency;
  use common\models\File;
  use common\models\Payment;
  use common\models\Project;
  use common\models\Specialization;
  use common\modules\file\widgets\ImageUploader;
  use common\modules\fileloader\widgets\FileloaderWidget;
  use kartik\select2\Select2;
  use mihaildev\ckeditor\CKEditor;
  use yii\helpers\Html;
  use yii\jui\DatePicker;
  use yii\web\JsExpression;
  use yii\widgets\ActiveForm;
  
b9a54f61   Yarik   test
23
  $this->title = Yii::t('app', 'Projects');
0c65fdc5   Виталий   git
24
  $this->params[ 'breadcrumbs' ][] = $this->title;
aa182b5c   Yarik   test
25
  ?>
37cb2820   Виталий   tokar commit
26
  <div class="login-left-column-title"><?= $this->title ?></div>
aa182b5c   Yarik   test
27
28
  
  <?php
0c65fdc5   Виталий   git
29
  $form = ActiveForm::begin([ 'options' => [ 'enctype' => 'multipart/form-data' ] ]);
aa182b5c   Yarik   test
30
31
  ?>
  
aa182b5c   Yarik   test
32
  
37cb2820   Виталий   tokar commit
33
34
35
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
          <?= $form->field($project, 'name')
0c65fdc5   Виталий   git
36
              ->textInput([ 'class' => 'custom-input-2' ]) ?>
37cb2820   Виталий   tokar commit
37
38
      </div>
  </div>
aa182b5c   Yarik   test
39
  
37cb2820   Виталий   tokar commit
40
  <div class="input-blocks-wrapper">
93e3bd31   Виталий   tokar commit
41
      <div class="input-blocks admin-project-list admin-currency-second">
37cb2820   Виталий   tokar commit
42
          <?= $form->field($project, 'project_pid')
b9a54f61   Yarik   test
43
              ->dropDownList($projects, [ 'prompt' => Yii::t('app', 'Parent project') ]) ?>
37cb2820   Виталий   tokar commit
44
45
      </div>
  </div>
c7e64161   Виталий   tokar commit
46
  
82c2fa67   Виталий   tokar commit
47
  <div class="input-blocks-wrapper admin-menu-list">
c7e64161   Виталий   tokar commit
48
49
50
51
52
53
54
55
56
57
58
      <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): ?>
d36bdac6   Administrator   17.02.16
59
  
c7e64161   Виталий   tokar commit
60
61
62
63
64
65
66
67
68
                              <?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($project, "specializationInput[{$child_second->specialization_id}]", [
83b0052c   Yarik   test
69
                                                              'template' => '{input}{label}{hint}{error}',
c7e64161   Виталий   tokar commit
70
                                                          ])
0c65fdc5   Виталий   git
71
72
73
74
75
76
77
                                                              ->label('<span></span>' . $child_second->specialization_name)
                                                              ->checkbox([
                                                                  'value'   => $child_second->specialization_id,
                                                                  'label'   => NULL,
                                                                  'uncheck' => NULL,
                                                                  'class'   => 'custom-check',
                                                              ], false) ?>
c7e64161   Виталий   tokar commit
78
79
80
81
82
83
84
85
                                                      </a>
                                                  </li>
                                              <?php endif; ?>
                                          <?php endforeach; ?>
                                      </ul>
                                  </li>
                              <?php endif; ?>
                          <?php endforeach; ?>
d36bdac6   Administrator   17.02.16
86
  
c7e64161   Виталий   tokar commit
87
88
89
90
91
92
93
94
                      </ul>
                  </li>
              <?php endforeach; ?>
          </ul>
      </div>
      <div class="style admn-menu-err">
          <div class="help-block">Необходимо выбрать хотя бы одну «специализацию».</div>
      </div>
d36bdac6   Administrator   17.02.16
95
  </div>
aa182b5c   Yarik   test
96
  
83b0052c   Yarik   test
97
98
99
  <div class="admin-specialization-selected style">
      <ul></ul>
  </div>
c7e64161   Виталий   tokar commit
100
  
37cb2820   Виталий   tokar commit
101
  
b9a54f61   Yarik   test
102
  <div class="conacts-admin style">Адрес заказа:</div>
aa182b5c   Yarik   test
103
  <div class="form-inline">
37cb2820   Виталий   tokar commit
104
105
106
      <div class="input-blocks-wrapper">
          <div class="input-blocks">
              <?= $form->field($project, 'city')
0c65fdc5   Виталий   git
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
                  ->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; }'),
                      ],
                  ]); ?>
37cb2820   Виталий   tokar commit
122
123
124
          </div>
  
  
37cb2820   Виталий   tokar commit
125
126
          <div class="input-blocks street-input">
              <?= $form->field($project, 'street', [ 'template' => "{label}{input}{hint}{error}" ])
0c65fdc5   Виталий   git
127
                  ->textInput([ 'class' => 'custom-input-2' ]) ?>
37cb2820   Виталий   tokar commit
128
129
130
          </div>
  
  
37cb2820   Виталий   tokar commit
131
132
          <div class="input-blocks home-input">
              <?= $form->field($project, 'house', [ 'template' => "{label}{input}{hint}{error}" ])
0c65fdc5   Виталий   git
133
                  ->textInput([ 'class' => 'custom-input-2' ]) ?>
37cb2820   Виталий   tokar commit
134
135
          </div>
      </div>
aa182b5c   Yarik   test
136
137
  </div>
  
37cb2820   Виталий   tokar commit
138
  <div class="input-blocks-wrapper">
93e3bd31   Виталий   tokar commit
139
140
      <div class="input-blocks admin-project-list-two admin-currency-first">
          <?= $form->field($project, 'budget', [
83b0052c   Yarik   test
141
              'template' => "{label}<br />{input}\n{hint}\n{error}",
93e3bd31   Виталий   tokar commit
142
          ])
0c65fdc5   Виталий   git
143
144
145
146
              ->textInput([
                  'class' => 'custom-input-2 custom-input-2-date',
                  'type'  => 'number',
              ]) ?>
37cb2820   Виталий   tokar commit
147
      </div>
93e3bd31   Виталий   tokar commit
148
      <div class="input-blocks admin-project-list-two admin-currency-second">
83b0052c   Yarik   test
149
          <?= $form->field($project, 'budget_currency')
0c65fdc5   Виталий   git
150
151
              ->label(false)
              ->dropDownList(Currency::getCurrencyDropdown(), [ 'class' => 'custom-input-2' ]); ?>
37cb2820   Виталий   tokar commit
152
      </div>
93e3bd31   Виталий   tokar commit
153
      <div class="input-blocks admin-who-check-payment admin-project-contractual">
83b0052c   Yarik   test
154
          <?= $form->field($project, 'contractual', [ 'template' => "{input}{label}\n{hint}\n{error}" ])
0c65fdc5   Виталий   git
155
156
              ->checkbox([ 'class' => 'custom-check' ], false)
              ->label('<span></span>Договорной') ?>
37cb2820   Виталий   tokar commit
157
158
159
      </div>
  
  </div>
aa182b5c   Yarik   test
160
  
93e3bd31   Виталий   tokar commit
161
  <div class="input-blocks-wrapper">
5aefd508   Виталий   tokar commit
162
163
      <div class="input-blocks">
          <?= $form->field($project, 'payment_variant')
0c65fdc5   Виталий   git
164
165
166
167
168
169
170
171
172
173
174
175
176
177
              ->radioList([
                  1 => 'Без предоплаты',
                  2 => 'Предоплата возможна',
              ], [
                  'item' => function($index, $label, $name, $checked, $value) {
                      $return = '<div class="admin-who-check">';
                      $return .= '<input class="custom-radio" id="select_admin_mfp' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
                      $return .= '<label for="select_admin_mfp' . $value . '" >';
                      $return .= '<span></span>' . ucwords($label);
                      $return .= '</label>';
                      $return .= '</div>';
                      return $return;
                  },
              ]) ?>
5aefd508   Виталий   tokar commit
178
      </div>
93e3bd31   Виталий   tokar commit
179
180
  </div>
  
5aefd508   Виталий   tokar commit
181
182
183
  <div class="input-blocks-wrapper">
      <div class="input-blocks">
          <?= $form->field($project, 'paymentInput')
0c65fdc5   Виталий   git
184
185
186
187
188
189
190
191
192
193
194
              ->checkboxList($payment, [
                  'item' => function($index, $label, $name, $checked, $value) {
                      $return = '<div class="admin-who-check-payment">';
                      $return .= '<input class="custom-check" id="check_admin_mfp' . $value . '" type="checkbox" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
                      $return .= '<label for="check_admin_mfp' . $value . '" >';
                      $return .= '<span></span>' . ucwords($label);
                      $return .= '</label>';
                      $return .= '</div>';
                      return $return;
                  },
              ]) ?>
5aefd508   Виталий   tokar commit
195
196
      </div>
  </div>
aa182b5c   Yarik   test
197
  
aa182b5c   Yarik   test
198
  
37cb2820   Виталий   tokar commit
199
  <div class="input-blocks-wrapper">
5aefd508   Виталий   tokar commit
200
201
      <div class="input-blocks admin-project-days">
          <?= $form->field($project, 'deadline', [ 'template' => "{label}<br />{input}<span class='admn-input-txt' style='padding-left: 10px'>дней</span>\n{hint}\n{error}" ])
0c65fdc5   Виталий   git
202
203
204
205
              ->textInput([
                  'class' => 'custom-input-2 custom-input-2-date',
                  'type'  => 'number',
              ]) ?>
5aefd508   Виталий   tokar commit
206
207
208
209
      </div>
  </div>
  
  <div class="input-blocks-wrapper full-blocks admin-editor-bl">
37cb2820   Виталий   tokar commit
210
      <div class="input-blocks">
5aefd508   Виталий   tokar commit
211
          <?= $form->field($project, 'description')
0c65fdc5   Виталий   git
212
              ->widget(CKEditor::className()) ?>
37cb2820   Виталий   tokar commit
213
214
      </div>
  </div>
aa182b5c   Yarik   test
215
  
492ed7f7   Yarik   test
216
  <?php
0c65fdc5   Виталий   git
217
218
219
220
221
222
223
224
225
226
227
228
  /* == Old file upload ==
  ?>
  <div class="input-blocks-wrapper admin-project-file">
      <div class="input-blocks">
          <div style="position: absolute; float: left;top: 0; left: 0; z-index: 1; width: 100%; overflow: hidden">
              <div class="gen-admin-title">Присоединить файл</div>
              <div class="admin-project-file-btn">Загрузить</div>
              <div class="not-file-mb-adm">До 3 Мб файл</div>
          </div>
          <div style="opacity: 0; height: 54px; width: 100%; float: left;position: absolute; top: 0;left: 0; z-index: 2;-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)'">
              <?= $form->field($project, 'files[]')
                       ->fileInput([ 'multiple' => 'multiple' ]) ?>
5aefd508   Виталий   tokar commit
229
          </div>
5aefd508   Виталий   tokar commit
230
      </div>
0c65fdc5   Виталий   git
231
232
233
  </div>
  <?php
      == End of old file upload == */
3735dff7   Yarik   test
234
235
236
237
  ?>
  
  <div class="input-blocks-wrapper">
      <?php
0c65fdc5   Виталий   git
238
239
240
241
242
243
244
245
246
247
      echo $form->field($project, 'fileloader')
          ->label(false)
          ->widget(FileloaderWidget::className(), [
              'labelOptions' => [ 'label' => '<div class="gen-admin-title">Присоединить файлы</div><div class="admin-project-file-btn">Загрузить</div><div class="not-file-mb-adm">До 3 Мб файл</div>' ],
              'inputOptions' => [
                  'multiple' => 'multiple',
                  'class'    => 'hidden',
              ],
              'options'      => [ 'class' => 'fileloader-file' ],
          ]);
3735dff7   Yarik   test
248
      ?>
5aefd508   Виталий   tokar commit
249
  </div>
aa182b5c   Yarik   test
250
  
5aefd508   Виталий   tokar commit
251
252
  <div class="input-blocks-wrapper">
      <div class="input-blocks admin-project-list admin-currency-second">
3735dff7   Yarik   test
253
          <?= $form->field($project, 'date_end')
0c65fdc5   Виталий   git
254
255
256
257
              ->widget(DatePicker::className(), [
                  'dateFormat'    => 'yyyy-MM-dd',
                  'clientOptions' => [ 'minDate' => 1 ],
              ]) ?>
492ed7f7   Yarik   test
258
259
260
      </div>
  </div>
  
0c65fdc5   Виталий   git
261
  <div class="input-blocks-wrapper hint-link hint-link-check">
492ed7f7   Yarik   test
262
      <div class="input-blocks admin-project-list admin-currency-second">
0c65fdc5   Виталий   git
263
264
          <?= $form->field($project, 'hidden', [ 'template' => "{input}{label}\n{hint}\n{error}" ])
              ->checkbox([ 'class' => 'custom-check admin-check' ], false)
b9a54f61   Yarik   test
265
266
              ->label('<span></span>'.Yii::t('app', 'hidden_project'))
              ->hint(Yii::t('app', 'hidden_project_hint')) ?>
5aefd508   Виталий   tokar commit
267
268
      </div>
  </div>
aa182b5c   Yarik   test
269
  
3a1bbfcc   Yarik   test
270
  <div class="input-blocks-wrapper">
04b478b9   Виталий   tokar commit
271
      <div class="admin-save-btn skills-save-btn admin-add-remove-wr style">
06ec2844   Administrator   28.03.16
272
          <?= Html::submitButton($project->isNewRecord ? Yii::t('app', 'add') : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>
04b478b9   Виталий   tokar commit
273
274
          <div class="admin-remove-note">
              <?php
0c65fdc5   Виталий   git
275
276
277
278
279
280
281
282
283
284
285
286
              if(!$project->isNewRecord) {
                  echo Html::a(Yii::t('app', 'delete'), [
                      'accounts/projects-delete',
                      'id' => $project->project_id,
                  ], [
                      'title'        => Yii::t('app', 'delete'),
                      'aria-label'   => Yii::t('app', 'delete'),
                      'data-confirm' =>  Yii::t('app', 'delete_confirm'),
                      'data-method'  => 'post',
                      'data-pjax'    => 0,
                  ]);
              }
04b478b9   Виталий   tokar commit
287
288
289
              ?>
          </div>
          <div class="admin-back-note">
83b0052c   Yarik   test
290
              <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/projects' ]) ?>
04b478b9   Виталий   tokar commit
291
          </div>
3a1bbfcc   Yarik   test
292
293
      </div>
  </div>
aa182b5c   Yarik   test
294
295
  
  <?php
0c65fdc5   Виталий   git
296
  $form->end();
aa182b5c   Yarik   test
297
  ?>
93e3bd31   Виталий   tokar commit
298
  <script>
83b0052c   Yarik   test
299
300
301
302
303
304
305
306
307
308
309
310
311
      $(document).ready(
          function()
          {
              $('.input-blocks.admin-currency-second select').change(
                  function()
                  {
                      $(this).blur()
                  }
              )
  
              if($('.admin-project-contractual input[type="checkbox"]').prop("checked"))
              {
                  $('.admin-project-list-two input, .admin-project-list-two select')
0c65fdc5   Виталий   git
312
                      .attr('disabled', 'disabled')
83b0052c   Yarik   test
313
314
315
316
317
318
319
              }
              $('.admin-project-contractual input[type="checkbox"]').change(
                  function()
                  {
                      if($(this).prop("checked"))
                      {
                          $('.admin-project-list-two input, .admin-project-list-two select')
0c65fdc5   Виталий   git
320
                              .attr('disabled', 'disabled')
83b0052c   Yarik   test
321
322
323
                      } else
                      {
                          $('.admin-project-list-two input, .admin-project-list-two select')
0c65fdc5   Виталий   git
324
                              .removeAttr('disabled')
83b0052c   Yarik   test
325
326
327
                      }
                  }
              )
5aefd508   Виталий   tokar commit
328
  
83b0052c   Yarik   test
329
330
331
332
333
              $('.admin-project-file input[type="file"]').change(
                  function()
                  {
                      var strInput = this.value
                      $('.admin-project-file .not-file-mb-adm').html(strInput.replace(/^.*\\/, ""))
5aefd508   Виталий   tokar commit
334
  
83b0052c   Yarik   test
335
336
                  }
              );
5aefd508   Виталий   tokar commit
337
  
0c65fdc5   Виталий   git
338
339
340
              $('#project-date_end').focus(function () {
                  $('#ui-datepicker-div').addClass('fix-color-datepicker')
              })
83b0052c   Yarik   test
341
342
          }
      )
5aefd508   Виталий   tokar commit
343
  </script>
0c65fdc5   Виталий   git