Blame view

views/order/_form.php 27 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() {
f36d238b   Alexey Boroda   -Order publish fi...
125
126
127
128
129
130
131
132
133
134
135
136
    $.ajax({
      url: "/admin/ecommerce/order/publish-order",
      type: "GET",
      data: {
          id: {$model->id}
      },
      success: function (data) {
      
      },
      error: function () {
      }
    });
b0c7d586   Alexey Boroda   -Bykov fixes
137
138
139
140
141
142
    $('#main-form').trigger('submit');
  });
  JS;
      
      $this->registerJs($js, View::POS_READY);
  
e0906f08   Alexey Boroda   -Fixing existing ...
143
144
  ?>
  
f2d1c773   Alexey Boroda   -Images popup fix...
145
146
147
148
149
150
  <?php $form = ActiveForm::begin(
      [
          'id'      => 'main-form',
  //        'options' => [ 'class' => 'form-inline' ],
      ]
  ); ?>
6f14188b   Alexey Boroda   -Product card fixed
151
  <div class="container">
42883b83   Alexey Boroda   -Order form beta ...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
    <div class="form-group">
      <br>
      <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
170
                                  [
42883b83   Alexey Boroda   -Order form beta ...
171
172
173
174
175
                                      'name'          => 'pay',
                                      'pluginOptions' => [
                                          'onText'  => \Yii::t('app', 'Оплачено'),
                                          'offText' => \Yii::t('app', 'Не оплачено'),
                                      ],
b0c7d586   Alexey Boroda   -Bykov fixes
176
177
                                  ]
                              );
42883b83   Alexey Boroda   -Order form beta ...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
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
                }
            ?>
            
            <?= $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') ?>
            
            <?= $form->field($model, 'phone')
                     ->textInput([ 'readonly' => $user->isAdmin() ? false : true ]) ?>
            
            <?= $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
314
          </div>
42883b83   Alexey Boroda   -Order form beta ...
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
  
        </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'
                         ),
                         [ 'prompt' => 'Способ оплаты ...' ]
                     ); ?>
            
            <?= $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 ...
362
      </div>
42883b83   Alexey Boroda   -Order form beta ...
363
    </div>
e0906f08   Alexey Boroda   -Fixing existing ...
364
  </div>
2ad65823   Alexey Boroda   -Added date range...
365
  
e861ae92   Alexey Boroda   -Add column to pa...
366
367
368
  <?php ActiveForm::end(); ?>
  <br>
  <br>
7520dc0e   Alexey Boroda   -Grid with input ...
369
  <div class="container">
42883b83   Alexey Boroda   -Order form beta ...
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
    <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(),
                        ],
f2d1c773   Alexey Boroda   -Images popup fix...
387
                        'sku',
42883b83   Alexey Boroda   -Order form beta ...
388
389
390
391
392
393
394
395
                        [
                            'attribute' => 'product_name',
                            'content'   => function($model) {
                                if (!empty($model->product_name)) {
                                    return Html::a(
                                        StringHelper::truncate($model->product_name, 10, '...'),
                                        '#',
                                        [
f2d1c773   Alexey Boroda   -Images popup fix...
396
397
398
399
400
401
402
403
404
405
                                            '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),
42883b83   Alexey Boroda   -Order form beta ...
406
407
408
409
410
411
412
                                        ]
                                    );
                                } else {
                                    return '';
                                }
                            },
                        ],
43127bab   Alexey Boroda   -Order translatio...
413
414
                        [
                            'attribute' => 'productVariant.product.brand.lang.title',
f2d1c773   Alexey Boroda   -Images popup fix...
415
                            'label'     => 'Брэнд',
43127bab   Alexey Boroda   -Order translatio...
416
                        ],
42883b83   Alexey Boroda   -Order form beta ...
417
418
419
420
421
422
423
424
425
426
427
                        [
                            'attribute' => 'productVariant.lang.title',
                            'label'     => \Yii::t('app', 'Цвет'),
                            'content'   => function($model) {
                                if (preg_match('@.*\.(png|jpg|gif)@i', $model->productVariant->lang->title)) {
                                    return '';
                                } else {
                                    return $model->productVariant->lang->title;
                                }
                            },
                        ],
43127bab   Alexey Boroda   -Order translatio...
428
                        [
f2d1c773   Alexey Boroda   -Images popup fix...
429
430
                            'attribute' => 'productVariant.size',
                            'label'     => 'Размер',
43127bab   Alexey Boroda   -Order translatio...
431
                        ],
42883b83   Alexey Boroda   -Order form beta ...
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
461
462
463
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
                        '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,
                        ],
                        [
43127bab   Alexey Boroda   -Order translatio...
517
                            //                          'label'   => \Yii::t('app', 'Склады'),
42883b83   Alexey Boroda   -Order form beta ...
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
                            'content' => function($model) {
                                $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',
                                                //                                              'data'  => [
                                                //                                                  'confirm' => 'Вы уверены, что хотите удалить этот элемент?',
                                                //                                                  'method'  => 'GET',
                                                //                                              ],
                                            ]
                                        );
                                    }
                                },
                            ],
                        ],
                    ],
                    'responsive'   => true,
                    'hover'        => true,
                    'pjax'         => true,
                    'pjaxSettings' => [
                        'options' => [
                            'scrollTo' => 'false',
                            'id'       => 'order-products-grid',
                        ],
                    ],
                ]
            );
        ?>
    </div>
e0906f08   Alexey Boroda   -Fixing existing ...
576
  </div>
2ad65823   Alexey Boroda   -Added date range...
577
  <div class="container">
42883b83   Alexey Boroda   -Order form beta ...
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
      <?php Pjax::begin([ 'id' => 'total-cost' ]); ?>
    <h2>Сумма заказа : <span class="label label-success"><?php echo $model->total; ?><?php echo \Yii::t(
                'app',
                'грн'
            ) ?></span></h2>
      <?php Pjax::end(); ?>
  </div>
  <div class="container">
    <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...'; }"
2ad65823   Alexey Boroda   -Added date range...
608
                                                    ),
42883b83   Alexey Boroda   -Order form beta ...
609
610
611
612
613
614
                                                ],
                                                'ajax'               => [
                                                    'url'      => \yii\helpers\Url::to([ 'find-product' ]),
                                                    'dataType' => 'json',
                                                    'data'     => new JsExpression(
                                                        'function(params) { return {q:params.term}; }'
2ad65823   Alexey Boroda   -Added date range...
615
616
                                                    ),
                                                ],
42883b83   Alexey Boroda   -Order form beta ...
617
618
619
620
621
622
623
624
625
626
627
                                                'escapeMarkup'       => new JsExpression(
                                                    'function (markup) { return markup; }'
                                                ),
                                                'templateResult'     => new JsExpression(
                                                    'function(data) { return data.sku; }'
                                                ),
                                                'templateSelection'  => new JsExpression(
                                                    'function (data) { return data.sku; }'
                                                ),
                                            ],
                                        ]
f2d1c773   Alexey Boroda   -Images popup fix...
628
629
                                    )
                                    ->label('Артикул');
42883b83   Alexey Boroda   -Order form beta ...
630
631
632
633
634
635
636
637
638
639
          
          ?>
      </div>
      <div class="col-md-2">
          <?php echo $newProductForm->field(
              $newOrderProduct,
              'count'
          )
                                    ->input(
                                        'number',
2ad65823   Alexey Boroda   -Added date range...
640
                                        [
42883b83   Alexey Boroda   -Order form beta ...
641
                                            'disabled' => $model->isNewRecord ? true : false,
2ad65823   Alexey Boroda   -Added date range...
642
                                        ]
42883b83   Alexey Boroda   -Order form beta ...
643
                                    ); ?>
2ad65823   Alexey Boroda   -Added date range...
644
      </div>
42883b83   Alexey Boroda   -Order form beta ...
645
646
      <div class="col-md-2" style="margin-top: 23px">
          <?php echo Html::submitButton(
43127bab   Alexey Boroda   -Order translatio...
647
              \Yii::t('app', 'Добавить'),
b0c7d586   Alexey Boroda   -Bykov fixes
648
              [
42883b83   Alexey Boroda   -Order form beta ...
649
                  'class' => $model->isNewRecord ? 'btn btn-primary disabled' : 'btn btn-primary',
b0c7d586   Alexey Boroda   -Bykov fixes
650
651
652
              ]
          ) ?>
      </div>
42883b83   Alexey Boroda   -Order form beta ...
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
        <?php echo $newProductForm->field($newOrderProduct, 'order_id')
                                  ->hiddenInput(
                                      [
                                          'value' => $model->id,
                                      ]
                                  )
                                  ->label(false) ?>
        <?php ActiveForm::end(); ?>
    </div>
  
    <br>
    <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,
                ]
            ),
            [
                '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(
                [
793ad526   Alexey Boroda   -Brain fuck! with...
689
                    'close-order',
42883b83   Alexey Boroda   -Order form beta ...
690
691
692
693
694
695
696
697
                    'id' => $model->id,
                ]
            ),
            [
                'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg',
            ]
        ) ?>
    </div>
b0c7d586   Alexey Boroda   -Bykov fixes
698
  
2ad65823   Alexey Boroda   -Added date range...
699
  </div>
01185786   Alexey Boroda   -Sms in process
700
701
  <br>
  <br>