Blame view

views/order/update.php 2.11 KB
e0906f08   Alexey Boroda   -Fixing existing ...
1
  <?php
6f14188b   Alexey Boroda   -Product card fixed
2
      /**
7520dc0e   Alexey Boroda   -Grid with input ...
3
4
5
       * @var Order              $model
       * @var View               $this
       * @var ActiveDataProvider $dataProvider
6f14188b   Alexey Boroda   -Product card fixed
6
7
8
       */
      
      use artweb\artbox\ecommerce\models\Order;
7520dc0e   Alexey Boroda   -Grid with input ...
9
      use yii\data\ActiveDataProvider;
e0906f08   Alexey Boroda   -Fixing existing ...
10
      use yii\helpers\Html;
6f14188b   Alexey Boroda   -Product card fixed
11
      use yii\web\View;
e0906f08   Alexey Boroda   -Fixing existing ...
12
      
b522bd6c   Alexey Boroda   -View bug fix
13
      $this->title = 'Обновить заказ #' . $model->id;
db3040d3   Alexey Boroda   -Order module alm...
14
15
16
17
      $this->params[ 'breadcrumbs' ][] = [
          'url'   => yii\helpers\Url::to([ '/ecommerce/order/index' ]),
          'label' => \Yii::t('app', 'Заказы'),
      ];
b522bd6c   Alexey Boroda   -View bug fix
18
19
20
21
      $this->params[ 'breadcrumbs' ][] = [
          'url'   => yii\helpers\Url::to([ '/ecommerce/order/view', 'id' => $model->id, ]),
          'label' => \Yii::t('app', 'Заказ #') . $model->id,
      ];
e0906f08   Alexey Boroda   -Fixing existing ...
22
      $this->params[ 'breadcrumbs' ][] = $this->title;
d57c8c00   Alexey Boroda   -Blocking in process
23
24
25
26
27
28
29
30
      
      $js = '
  $.ajax({
    type: "POST",
    url: "/admin/ecommerce/order/block-order",
    data: {
      id: ' . $model->id . '
    },
99de237f   Alexey Boroda   -Order block core...
31
    success: function(data) {
b0c7d586   Alexey Boroda   -Bykov fixes
32
33
34
35
    var message = data.time;
    if (data.user != "") {
      message += "  " + data.user;
    }
3bb55546   Alexey Boroda   -Fixing bugs
36
    $.notify({
b0c7d586   Alexey Boroda   -Bykov fixes
37
  	message:  message
3bb55546   Alexey Boroda   -Fixing bugs
38
          },{
99de237f   Alexey Boroda   -Order block core...
39
  	type: "info"
3bb55546   Alexey Boroda   -Fixing bugs
40
      });
d57c8c00   Alexey Boroda   -Blocking in process
41
42
    }
  });';
deaedeb0   Alexey Boroda   -Order module tas...
43
      
d57c8c00   Alexey Boroda   -Blocking in process
44
45
      $this->registerJs($js, View::POS_READY);
      
b0c7d586   Alexey Boroda   -Bykov fixes
46
47
48
      $js = '
      window.onbeforeunload = function(e) {
          $.ajax({
793ad526   Alexey Boroda   -Brain fuck! with...
49
              type: "POST",
b0c7d586   Alexey Boroda   -Bykov fixes
50
51
52
53
54
              url: "/admin/ecommerce/order/exit-order",
              data: {
                  id: ' . $model->id . ',
              },
              success: function() {
b0c7d586   Alexey Boroda   -Bykov fixes
55
56
57
58
59
60
              }
          });
  };
  ';
      
      $this->registerJs($js, View::POS_READY);
3bee3445   Alexey Boroda   -Order history ready
61
62
63
64
65
66
67
68
69
70
71
72
    
      if (!empty(\Yii::$app->session->getFlash('label_update'))) {
        $js = '
  $.notify({
      message: "Статус заказа обновлен"
  }, {
      type : "warning"
  })
  ';
        $this->registerJs($js, View::POS_READY);
      }
      
e0906f08   Alexey Boroda   -Fixing existing ...
73
  ?>
6f14188b   Alexey Boroda   -Product card fixed
74
  <div class="order-update">
ac55606a   Alexey Boroda   -Card translation...
75
    <div class="container callout bg-olive">
deaedeb0   Alexey Boroda   -Order module tas...
76
77
78
79
80
      <h1><?php echo Html::encode($this->title) ?> | <?php echo date(
              'd-m-Y G:i',
              $model->created_at
          ); ?> | <?php echo $model->manager->username; ?></h1>
    </div>
e0906f08   Alexey Boroda   -Fixing existing ...
81
      
6f14188b   Alexey Boroda   -Product card fixed
82
83
      <?= $this->render(
          '_form',
e0906f08   Alexey Boroda   -Fixing existing ...
84
          [
7520dc0e   Alexey Boroda   -Grid with input ...
85
86
              'model'        => $model,
              'dataProvider' => $dataProvider,
e0906f08   Alexey Boroda   -Fixing existing ...
87
88
          ]
      ) ?>
6f14188b   Alexey Boroda   -Product card fixed
89
  </div>