Blame view

views/order/_form.php 28.7 KB
e0906f08   Alexey Boroda   -Fixing existing ...
1
2
  <?php
      
bb962a6d   Alexey Boroda   -Order in process
3
      use artweb\artbox\ecommerce\models\Label;
e0906f08   Alexey Boroda   -Fixing existing ...
4
      use artweb\artbox\ecommerce\models\Order;
30b799f2   Alexey Boroda   -Order in process 2
5
      use artweb\artbox\ecommerce\models\OrderPayment;
2ad65823   Alexey Boroda   -Added date range...
6
      use artweb\artbox\ecommerce\models\OrderProduct;
01185786   Alexey Boroda   -Sms in process
7
      use backend\models\SmsTemplate;
d57c8c00   Alexey Boroda   -Blocking in process
8
      use common\models\User;
7520dc0e   Alexey Boroda   -Grid with input ...
9
      use kartik\grid\GridView;
42883b83   Alexey Boroda   -Order form beta ...
10
      use kartik\grid\SerialColumn;
bb962a6d   Alexey Boroda   -Order in process
11
      use kartik\widgets\DatePicker;
2ad65823   Alexey Boroda   -Added date range...
12
      use kartik\widgets\Select2;
bb962a6d   Alexey Boroda   -Order in process
13
      use kartik\widgets\SwitchInput;
7520dc0e   Alexey Boroda   -Grid with input ...
14
      use yii\data\ActiveDataProvider;
e0906f08   Alexey Boroda   -Fixing existing ...
15
16
      use yii\helpers\Html;
      use yii\bootstrap\ActiveForm;
6f14188b   Alexey Boroda   -Product card fixed
17
18
      use yii\helpers\ArrayHelper;
      use artweb\artbox\ecommerce\models\Delivery;
42883b83   Alexey Boroda   -Order form beta ...
19
      use yii\helpers\StringHelper;
7520dc0e   Alexey Boroda   -Grid with input ...
20
      use yii\web\View;
2ad65823   Alexey Boroda   -Added date range...
21
      use yii\web\JsExpression;
42883b83   Alexey Boroda   -Order form beta ...
22
      use yii\widgets\Pjax;
e0906f08   Alexey Boroda   -Fixing existing ...
23
      
7520dc0e   Alexey Boroda   -Grid with input ...
24
25
26
27
28
      /**
       * @var View               $this
       * @var Order              $model
       * @var ActiveForm         $form
       * @var ActiveDataProvider $dataProvider
28b51b30   Alexey Boroda   -Order module bug...
29
       * @var User               $user
7520dc0e   Alexey Boroda   -Grid with input ...
30
       */
2ad65823   Alexey Boroda   -Added date range...
31
      
28b51b30   Alexey Boroda   -Order module bug...
32
33
      $user = \Yii::$app->user->identity;
      
2ad65823   Alexey Boroda   -Added date range...
34
35
36
37
38
39
40
41
42
43
44
      $js = <<< JS
  $(document).on('submit', '#add-product-form', function(e) {
      e.preventDefault();
      var addFormData = $(this).serializeArray();
      var addFormAction = this.action;
      $.ajax({
          url: addFormAction,
          type: "POST",
          data: addFormData,
          success: function (data) {
               if (data.status === "success") {
42883b83   Alexey Boroda   -Order form beta ...
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
                   $.pjax.reload({container:"#order-products-grid"});
               }
          },
          error: function () {
          }
      });
  });
  $(document).on('click', '.delete-button', function(e) {
      e.preventDefault();
      var link = $(this).attr('href') + '&order_id=' + {$model->id};
      $.ajax({
          url: link,
          type: "GET",
          success: function (data) {
               if (data.status === "success") {
                   $.pjax.reload({container:"#order-products-grid"});
                   $('[data-toggle="popover"]').popover();
2ad65823   Alexey Boroda   -Added date range...
62
63
64
65
66
67
68
69
70
               }
          },
          error: function () {
          }
      });
  });
  JS;
      
      $this->registerJs($js, View::POS_READY);
bb962a6d   Alexey Boroda   -Order in process
71
72
73
74
75
      
      $js = <<< JS
  $('#order-phone, #order-phone2').mask('+38(000)000-00-00', {
      placeholder: '+38(___)___-__-__'
  });
42883b83   Alexey Boroda   -Order form beta ...
76
77
78
79
80
  $('[data-toggle="popover"]').popover();
  $(document).on('pjax:end', '#order-products-grid', function() {
    $('[data-toggle="popover"]').popover();
    $.pjax.reload({container: '#total-cost'});
  });
bb962a6d   Alexey Boroda   -Order in process
81
82
83
  JS;
      
      $this->registerJs($js, View::POS_READY);
01185786   Alexey Boroda   -Sms in process
84
85
86
87
      
      $js = <<< JS
  $(document).on('change', '#sms-template-selector', function(event) {
      var text = $('#select2-sms-template-selector-container').attr('title');
db3040d3   Alexey Boroda   -Order module alm...
88
89
90
91
92
      var val = $('option:contains(' + text + ')').attr('value');
      $('#sms-text-area').val(val);
  });
  
  $(document).on('click', '#send-sms-action', function(event) {
b0c7d586   Alexey Boroda   -Bykov fixes
93
94
95
96
97
98
99
100
      var variant = $('input[name=send-phone]:checked').val();
      var content = $('#sms-text-area').val();
      if (variant == 1) {
          var phone = $('input#order-phone').val();    
      } else if (variant == 2) {
          var phone = $('input#order-phone2').val();    
      }
      console.log(phone);
db3040d3   Alexey Boroda   -Order module alm...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
      $.ajax({
          url: "/admin/ecommerce/order/send-sms",
          method: "POST",
          data: { 
              phone: phone,
              content: content
           },
          success: function(data) {
            console.log(data);
            var newButton = document.createElement('button');
            newButton.classList.add('btn', 'btn-default');
            newButton.innerText = 'Отправлено';
            var current = document.getElementById("send-sms-action");
            var parentDiv = current.parentNode;
            parentDiv.replaceChild(newButton, current);
          }
      });
01185786   Alexey Boroda   -Sms in process
118
119
120
121
  });
  JS;
      
      $this->registerJs($js, View::POS_READY);
b0c7d586   Alexey Boroda   -Bykov fixes
122
123
124
      
      $js = <<< JS
  $(document).on('click', '#page-submit', function() {
52e22ec2   Administrator   add similar products
125
    var phone =  $('#order-phone').val(); 
f36d238b   Alexey Boroda   -Order publish fi...
126
127
128
129
    $.ajax({
      url: "/admin/ecommerce/order/publish-order",
      type: "GET",
      data: {
52e22ec2   Administrator   add similar products
130
131
          id: {$model->id},
          phone: phone
f36d238b   Alexey Boroda   -Order publish fi...
132
133
      },
      success: function (data) {
52e22ec2   Administrator   add similar products
134
  
f36d238b   Alexey Boroda   -Order publish fi...
135
136
137
138
      },
      error: function () {
      }
    });
52e22ec2   Administrator   add similar products
139
    $('#main-form').trigger('submit');
b0c7d586   Alexey Boroda   -Bykov fixes
140
141
142
143
144
  });
  JS;
      
      $this->registerJs($js, View::POS_READY);
  
e0906f08   Alexey Boroda   -Fixing existing ...
145
146
  ?>
  
f2d1c773   Alexey Boroda   -Images popup fix...
147
148
  <?php $form = ActiveForm::begin(
      [
93a0cd0b   Yarik   Credits
149
          'id' => 'main-form',
f2d1c773   Alexey Boroda   -Images popup fix...
150
151
      ]
  ); ?>
17569d93   Alexey Boroda   -Order product lo...
152
153
154
155
  
  
  <div class="box box-default">
    <div class="box-header with-border">
f23a9b6b   Alexey Boroda   -Quick fix
156
      <h3 class="box-title">Заказ</h3>
17569d93   Alexey Boroda   -Order product lo...
157
158
159
160
161
162
163
164
      <div class="box-tools pull-right">
        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
        </button>
      </div>
    </div>
    <div class="box-body">
      
      
6f14188b   Alexey Boroda   -Product card fixed
165
  <div class="container">
42883b83   Alexey Boroda   -Order form beta ...
166
167
    <div class="form-group">
      <br>
17569d93   Alexey Boroda   -Order product lo...
168
169
170
  
  
      
42883b83   Alexey Boroda   -Order form beta ...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
      <div class="row">
        <div class="col-sm-6">
            
            <?= $form->field($model, 'deadline')
                     ->widget(
                         DatePicker::className(),
                         [
                
                         ]
                     ) ?>
            
            <?php
                if ($user->isAdmin()) {
                    echo $form->field($model, 'pay')
                              ->widget(
                                  SwitchInput::className(),
b0c7d586   Alexey Boroda   -Bykov fixes
187
                                  [
42883b83   Alexey Boroda   -Order form beta ...
188
189
190
191
192
                                      'name'          => 'pay',
                                      'pluginOptions' => [
                                          'onText'  => \Yii::t('app', 'Оплачено'),
                                          'offText' => \Yii::t('app', 'Не оплачено'),
                                      ],
b0c7d586   Alexey Boroda   -Bykov fixes
193
194
                                  ]
                              );
42883b83   Alexey Boroda   -Order form beta ...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
                }
            ?>
            
            <?= $form->field($model, 'reason')
                     ->dropDownList(
                         Order::REASONS,
                         [ 'prompt' => 'Выберите причину' ]
                     ) ?>
            
            <?= $form->field($model, 'label')
                     ->dropDownList(
                         ArrayHelper::map(
                             Label::find()
                                  ->asArray()
                                  ->all(),
                             'id',
                             'label'
                         ),
                         [ 'prompt' => 'Выберите метку' ]
                     ); ?>
            
            <?= $form->field($model, 'name') ?>
            
85958295   Alexey Boroda   -Phone 1 opened f...
218
            <?= $form->field($model, 'phone') ?>
42883b83   Alexey Boroda   -Order form beta ...
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
            
            <?= $form->field($model, 'phone2') ?>
            
            <?= $form->field($model, 'email')
                     ->textInput([ 'readonly' => $user->isAdmin() ? false : true ]) ?>
            
            <?= $form->field(
                $model,
                'numbercard'
            )
                     ->textInput([ 'readonly' => true ]) ?>
            
            <?= $form->field($model, 'comment')
                     ->textarea([ 'rows' => '3' ]) ?>
            <?= $form->field($model, 'delivery')
                     ->dropDownList(
                         ArrayHelper::map(
                             Delivery::find()
                                     ->joinWith('lang')
                                     ->asArray()
                                     ->all(),
                             'id',
                             'lang.title'
                         ),
                         [ 'prompt' => \Yii::t('app', 'Выберите доставку ...') ]
                     ) ?>
            
            <?php
                
                if ($user->isAdmin()) {
                    echo $form->field($model, 'manager_id')
                              ->dropDownList(
                                  ArrayHelper::map(
                                      User::find()
                                          ->asArray()
                                          ->all(),
                                      'id',
                                      'username'
                                  ),
                                  [ 'prompt' => \Yii::t('app', 'Менеджер') ]
                              );
                }
            ?>
  
          <h2><?php echo \Yii::t('app', 'Отправить смс'); ?></h2>
            <?php
                echo Select2::widget(
                    [
                        'id'            => 'sms-template-selector',
                        'name'          => 'select-sms-template',
                        'data'          => ArrayHelper::map(
                            SmsTemplate::find()
                                       ->asArray()
                                       ->all(),
                            'text',
                            'title'
                        ),
                        'options'       => [ 'placeholder' => \Yii::t('app', 'Выберите шаблон') ],
                        'pluginOptions' => [
                            'allowClear' => true,
                        ],
                    ]
                );
            
            ?>
          <br>
            <?php
                echo Html::textarea(
                    'sms-text',
                    '',
                    [
                        'rows'  => 3,
                        'id'    => 'sms-text-area',
                        'class' => 'form-control',
                    ]
                );
            ?>
          <br>
          <div class="row">
            <div class="col-md-6">
                <?php
                    if ($model->isNewRecord) {
                        echo Html::button(
                            \Yii::t('app', 'Отправить'),
                            [
                                'class' => 'btn btn-warning disabled',
                            ]
                        );
                    } else {
                        echo Html::button(
                            \Yii::t('app', 'Отправить'),
                            [
                                'class' => 'btn btn-warning',
                                'id'    => 'send-sms-action',
                            ]
                        );
                    }
                ?>
            </div>
            <div class="col-md-6">
                <?php
                    echo Html::radioList(
                        'send-phone',
                        '1',
                        [
                            '1' => 'Первый номер',
                            '2' => 'Второй номер',
                        ]
                    );
                ?>
            </div>
6f14188b   Alexey Boroda   -Product card fixed
330
          </div>
42883b83   Alexey Boroda   -Order form beta ...
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
  
        </div>
        <div class="col-sm-6">
            
            <?= $form->field($model, 'declaration') ?>
            
            <?= $form->field($model, 'stock') ?>
            
            <?= $form->field($model, 'consignment') ?>
            
            <?= $form->field($model, 'payment')
                     ->dropDownList(
                         ArrayHelper::map(
                             OrderPayment::find()
                                         ->where([ 'status' => OrderPayment::ACTIVE ])
                                         ->asArray()
                                         ->all(),
                             'id',
                             'short'
                         ),
b522bd6c   Alexey Boroda   -View bug fix
351
352
353
354
                         [
                           'prompt' => 'Способ оплаты ...',
                           'disabled' => $model->payment == 10 ? 'disabled' : false,
                         ]
42883b83   Alexey Boroda   -Order form beta ...
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
                     ); ?>
            
            <?= $form->field($model, 'insurance') ?>
            
            <?= $form->field($model, 'amount_imposed') ?>
            
            <?= $form->field($model, 'shipping_by')
                     ->dropDownList(
                         ArrayHelper::getColumn(Order::SHIPPING_BY, 'label'),
                         [ 'prompt' => 'Оплата доставки ...' ]
                     ); ?>
            
            <?= $form->field($model, 'city') ?>
            
            <?= $form->field($model, 'adress') ?>
            
            <?= $form->field($model, 'body')
                     ->textarea([ 'rows' => '3' ]) ?>
            
            <?= $form->field($model, 'check') ?>
            
            <?= $form->field($model, 'sms') ?>
            
            <?= $form->field($model, 'delivery_cost') ?>
  
        </div>
e0906f08   Alexey Boroda   -Fixing existing ...
381
      </div>
17569d93   Alexey Boroda   -Order product lo...
382
383
384
  
  
      
42883b83   Alexey Boroda   -Order form beta ...
385
    </div>
e0906f08   Alexey Boroda   -Fixing existing ...
386
  </div>
2ad65823   Alexey Boroda   -Added date range...
387
  
17569d93   Alexey Boroda   -Order product lo...
388
389
390
    </div><!-- /.box-body -->
  </div><!-- /.box -->
  
e861ae92   Alexey Boroda   -Add column to pa...
391
  <?php ActiveForm::end(); ?>
17569d93   Alexey Boroda   -Order product lo...
392
393
394
395
  
  
  <div class="box box-default">
    <div class="box-header with-border">
f23a9b6b   Alexey Boroda   -Quick fix
396
      <h3 class="box-title">Товары</h3>
17569d93   Alexey Boroda   -Order product lo...
397
398
399
400
401
402
403
      <div class="box-tools pull-right">
        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
        </button>
      </div>
    </div>
    <div class="box-body">
  
7520dc0e   Alexey Boroda   -Grid with input ...
404
  <div class="container">
93a0cd0b   Yarik   Credits
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
      <div class="row">
          <?php
              echo GridView::widget(
                  [
                      'dataProvider' => $dataProvider,
                      'rowOptions'   => function ($model) {
                          if ($model->removed) {
                              return [ 'class' => 'danger' ];
                          } else {
                              return [];
                          }
                      },
                      'layout'       => '{items}{pager}',
                      'columns'      => [
                          [
                              'class' => SerialColumn::className(),
                          ],
                          'sku',
                          [
                              'attribute' => 'product_name',
                              'content'   => function ($model) {
                                  if (!empty( $model->product_name )) {
                                      
                                      if (empty( $model->productVariant )) {
                                          return '';
                                      }
                                      
                                      return Html::a(
                                          StringHelper::truncate($model->product_name, 10, '...'),
                                          '#',
                                          [
                                              'onclick'        => 'event.preventDefault();',
                                              'data-toggle'    => 'popover',
                                              'data-placement' => 'right',
                                              'data-html'      => 'true',
                                              'data-content'   => Html::img(
                                                      $model->productVariant->imageUrl,
                                                      [
                                                          'class' => 'img-rounded',
                                                      ]
                                                  ) . Html::tag('p', $model->product_name),
                                          ]
                                      );
                                  } else {
                                      return '';
                                  }
                              },
                          ],
                          [
                              'attribute' => 'productVariant.product.brand.lang.title',
                              'label'     => 'Брэнд',
                          ],
                          [
                              'attribute' => 'productVariant.lang.title',
                              'label'     => \Yii::t('app', 'Цвет'),
                              'content'   => function ($model) {
2976f2f0   Alexey Boroda   -Remove sku order...
461
                                  
93a0cd0b   Yarik   Credits
462
                                  if (empty( $model->productVariant )) {
2976f2f0   Alexey Boroda   -Remove sku order...
463
                                      return '';
93a0cd0b   Yarik   Credits
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
                                  }
                                  
                                  if (preg_match('@.*\.(png|jpg|gif)@i', $model->productVariant->lang->title)) {
                                      return '';
                                  } else {
                                      return $model->productVariant->lang->title;
                                  }
                              },
                          ],
                          [
                              'attribute' => 'productVariant.size',
                              'label'     => 'Размер',
                          ],
                          'price',
                          [
                              'class'           => 'kartik\grid\EditableColumn',
                              'attribute'       => 'count',
                              'editableOptions' => [
                                  'header'       => \Yii::t('app', 'Количество'),
                                  'inputType'    => kartik\editable\Editable::INPUT_SPIN,
                                  'options'      => [
                                      'pluginOptions' => [
                                          'min' => 0,
                                          'max' => 5000,
                                      ],
                                  ],
                                  'pluginEvents' => [
                                      'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }',
                                  ],
                              ],
                              'format'          => [
                                  'decimal',
                                  0,
                              ],
                              'pageSummary'     => false,
                          ],
                          'sum_cost',
                          [
                              'class'           => 'kartik\grid\EditableColumn',
                              'attribute'       => 'booking',
                              'editableOptions' => [
                                  'header'       => \Yii::t('app', 'Бронь'),
                                  'inputType'    => kartik\editable\Editable::INPUT_TEXT,
                                  'options'      => [
                                      'class'         => 'booking-typeahead',
                                      'pluginOptions' => [
                                          'min' => 0,
                                          'max' => 20,
                                      ],
                                  ],
                                  'pluginEvents' => [
                                      'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }',
                                  ],
                              ],
                              'format'          => [
                                  'text',
                              ],
                              'pageSummary'     => false,
                          ],
                          [
                              'class'           => 'kartik\grid\EditableColumn',
                              'attribute'       => 'status',
                              'editableOptions' => [
                                  'header'       => \Yii::t('app', 'Статус'),
                                  'inputType'    => kartik\editable\Editable::INPUT_TEXT,
                                  'options'      => [
                                      'class'         => 'status-typeahead',
                                      'pluginOptions' => [
                                          'min' => 0,
                                          'max' => 20,
                                      ],
                                  ],
                                  'pluginEvents' => [
                                      'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }',
                                  ],
                              ],
                              'format'          => [
                                  'text',
                              ],
                              'pageSummary'     => false,
                          ],
                          [
                              'class'           => 'kartik\grid\EditableColumn',
                              'attribute'       => 'return',
                              'editableOptions' => [
                                  'header'       => \Yii::t('app', 'Возврат'),
                                  'inputType'    => kartik\editable\Editable::INPUT_CHECKBOX,
                                  'options'      => [],
                                  'pluginEvents' => [
                                      'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }',
                                  ],
                              ],
                              'format'          => [
                                  'boolean',
                              ],
                              'pageSummary'     => false,
                          ],
                          [
                              'content' => function ($model) {
                                  
                                  if (empty( $model->productVariant )) {
                                      return '<i class="glyphicon glyphicon-remove"></i>';
                                  }
                                  
                                  $content = '<table class="table"><tbody><tr><th>Склад</th><th>кол.</th></tr>';
                                  foreach ($model->productVariant->variantStocks as $stock) {
                                      $content .= '<tr><td>' . $stock->stock->title . '</td><td>' . $stock->quantity . '</td></tr>';
                                  }
                                  return Html::a(
                                      '<i class="glyphicon glyphicon-home"></i>',
                                      '#',
                                      [
                                          'onclick'        => 'event.preventDefault();',
                                          'data-toggle'    => 'popover',
                                          'data-placement' => 'left',
                                          'data-html'      => 'true',
                                          'data-content'   => $content . '</tbody></table>',
                                      ]
                                  );
                              },
                          ],
                          [
                              'class'    => 'yii\grid\ActionColumn',
                              'template' => '{delete}',
                              'buttons'  => [
                                  'delete' => function ($url, $product) {
                                      if ($product->removed) {
                                          return '';
                                      } else {
                                          return Html::a(
                                              Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-trash' ]),
                                              [
                                                  'delete-product',
                                                  'id' => $product->id,
                                              ],
                                              [
                                                  'class' => 'delete-button',
93a0cd0b   Yarik   Credits
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
                                              ]
                                          );
                                      }
                                  },
                              ],
                          ],
                      ],
                      'responsive'   => true,
                      'hover'        => true,
                      'pjax'         => true,
                      'pjaxSettings' => [
                          'options' => [
                              'scrollTo' => 'false',
                              'id'       => 'order-products-grid',
                          ],
                      ],
                  ]
              );
          ?>
      </div>
e0906f08   Alexey Boroda   -Fixing existing ...
621
  </div>
2ad65823   Alexey Boroda   -Added date range...
622
  <div class="container">
42883b83   Alexey Boroda   -Order form beta ...
623
      <?php Pjax::begin([ 'id' => 'total-cost' ]); ?>
93a0cd0b   Yarik   Credits
624
625
626
627
      <h2>Сумма заказа : <span class="label label-success"><?php echo $model->total; ?><?php echo \Yii::t(
                  'app',
                  'грн'
              ) ?></span></h2>
42883b83   Alexey Boroda   -Order form beta ...
628
629
630
      <?php Pjax::end(); ?>
  </div>
  <div class="container">
93a0cd0b   Yarik   Credits
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
      <div class="row">
          <?php $newProductForm = ActiveForm::begin(
              [
                  'action' => yii\helpers\Url::to([ 'add' ]),
                  'id'     => 'add-product-form',
              ]
          );
              $newOrderProduct = new OrderProduct();
          ?>
          <div class="col-md-8">
              <?php echo $newProductForm->field($newOrderProduct, 'id')
                                        ->widget(
                                            Select2::className(),
                                            [
                                                'options'       => [ 'placeholder' => 'Search for a product ...' ],
                                                'pluginOptions' => [
                                                    'allowClear'         => true,
                                                    'disabled'           => $model->isNewRecord ? true : false,
                                                    'minimumInputLength' => 3,
                                                    'language'           => [
                                                        'errorLoading' => new JsExpression(
                                                            "function () { return 'Waiting for results...'; }"
                                                        ),
                                                    ],
                                                    'ajax'               => [
                                                        'url'      => \yii\helpers\Url::to([ 'find-product' ]),
                                                        'dataType' => 'json',
                                                        'data'     => new JsExpression(
                                                            'function(params) { return {q:params.term}; }'
                                                        ),
                                                    ],
                                                    'escapeMarkup'       => new JsExpression(
                                                        'function (markup) { return markup; }'
2ad65823   Alexey Boroda   -Added date range...
664
                                                    ),
93a0cd0b   Yarik   Credits
665
666
667
668
669
                                                    'templateResult'     => new JsExpression(
                                                        'function(data) { return data.sku; }'
                                                    ),
                                                    'templateSelection'  => new JsExpression(
                                                        'function (data) { return data.sku; }'
2ad65823   Alexey Boroda   -Added date range...
670
671
                                                    ),
                                                ],
93a0cd0b   Yarik   Credits
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
                                            ]
                                        )
                                        ->label('Артикул');
              
              ?>
          </div>
          <div class="col-md-2">
              <?php echo $newProductForm->field(
                  $newOrderProduct,
                  'count'
              )
                                        ->input(
                                            'number',
                                            [
                                                'disabled' => $model->isNewRecord ? true : false,
                                            ]
                                        ); ?>
          </div>
          <div class="col-md-2" style="margin-top: 23px">
              <?php echo Html::submitButton(
                  \Yii::t('app', 'Добавить'),
                  [
                      'class' => $model->isNewRecord ? 'btn btn-primary disabled' : 'btn btn-primary',
                  ]
              ) ?>
          </div>
          <?php echo $newProductForm->field($newOrderProduct, 'order_id')
                                    ->hiddenInput(
2ad65823   Alexey Boroda   -Added date range...
700
                                        [
93a0cd0b   Yarik   Credits
701
                                            'value' => $model->id,
2ad65823   Alexey Boroda   -Added date range...
702
                                        ]
93a0cd0b   Yarik   Credits
703
704
705
                                    )
                                    ->label(false) ?>
          <?php ActiveForm::end(); ?>
2ad65823   Alexey Boroda   -Added date range...
706
      </div>
93a0cd0b   Yarik   Credits
707
      
17569d93   Alexey Boroda   -Order product lo...
708
709
710
711
712
713
714
715
  
  
  </div>
  
    </div><!-- /.box-body -->
  </div><!-- /.box -->
      
      
93a0cd0b   Yarik   Credits
716
      <br>
17569d93   Alexey Boroda   -Order product lo...
717
  <div class="container">
93a0cd0b   Yarik   Credits
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
      <div class="row">
          <?= Html::button(
              $model->isNewRecord ? \Yii::t('app', 'Создать') : \Yii::t('app', 'Сохранить'),
              [
                  'class' => $model->isNewRecord ? 'btn btn-success btn-lg' : 'btn btn-primary btn-lg',
                  'id'    => 'page-submit',
              ]
          ) ?>
          <?= Html::a(
              \Yii::t('app', 'Печать'),
              yii\helpers\Url::to(
                  [
                      'order/print',
                      'order_id' => $model->id,
                  ]
              ),
b0c7d586   Alexey Boroda   -Bykov fixes
734
              [
93a0cd0b   Yarik   Credits
735
736
737
738
739
740
741
742
743
744
745
746
                  'class'  => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg',
                  'target' => '_blank',
              ]
          ) ?>
          <?= Html::a(
              \Yii::t('app', 'Выйти'),
              yii\helpers\Url::to(
                  [
                      'close-order',
                      'id' => $model->id,
                  ]
              ),
b0c7d586   Alexey Boroda   -Bykov fixes
747
              [
93a0cd0b   Yarik   Credits
748
                  'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg',
b0c7d586   Alexey Boroda   -Bykov fixes
749
750
751
              ]
          ) ?>
      </div>
2ad65823   Alexey Boroda   -Added date range...
752
  </div>
01185786   Alexey Boroda   -Sms in process
753
754
  <br>
  <br>