Blame view

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