Blame view

views/order/index.php 2.59 KB
2a050410   Yarik   Order
1
2
  <?php
      
a1da4203   Alexey Boroda   -Date fixed
3
      use artbox\order\models\Order;
2a050410   Yarik   Order
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
      use yii\helpers\Html;
      use yii\grid\GridView;
      use yiister\gentelella\widgets\Panel;
      
      /**
       * @var \yii\web\View                    $this
       * @var \artbox\order\models\OrderSearch $searchModel
       * @var \yii\data\ActiveDataProvider     $dataProvider
       * @var array                            $labels
       */
      
      $this->title = Yii::t('order', 'Orders');
      $this->params[ 'breadcrumbs' ][] = $this->title;
  ?>
  <div class="order-index">
      
      <?php
          $xPanel = Panel::begin(
              [
                  'header' => $this->title,
              ]
          );
      ?>
    <p>
        <?= Html::a(Yii::t('order', 'Create Order'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
    </p>
      <?= GridView::widget(
          [
              'dataProvider' => $dataProvider,
              'filterModel'  => $searchModel,
              'columns'      => [
                  [ 'class' => 'yii\grid\SerialColumn' ],
a1da4203   Alexey Boroda   -Date fixed
36
      
2a050410   Yarik   Order
37
38
39
40
41
42
43
44
45
46
                  'id',
                  'user_id',
                  'name',
                  'phone',
                  'email:email',
                  [
                      'attribute' => 'label_id',
                      'value'     => 'label.lang.title',
                      'filter'    => $labels,
                  ],
a1da4203   Alexey Boroda   -Date fixed
47
48
49
50
51
52
53
54
55
56
57
58
59
                  [
                      'attribute' => 'created_at',
                      'value'     => function ($model) {
                          /**
                           * @var Order $model
                           */
                          if (empty($model->created_at)) {
                              return \Yii::$app->formatter->asText('');
                          } else {
                              return date('d M, Y H:i:s', $model->created_at);
                          }
                      },
                  ],
2a050410   Yarik   Order
60
61
62
63
64
65
66
67
68
                  [
                      'attribute' => 'count',
                      'value'     => function ($model) {
                          /**
                           * @var \artbox\order\models\Order $model
                           */
                          return count($model->orderProducts);
                      },
                  ],
a1da4203   Alexey Boroda   -Date fixed
69
      
b12f37d7   Alexey Boroda   -Order products s...
70
71
72
                  [ 'class'    => 'yii\grid\ActionColumn',
                    'template' => '{view} {update} {delete} {print}',
                    'buttons'  => [
7b952362   Anastasia   price and count u...
73
74
75
76
77
78
79
                        'print' => function ($url) {
                      return Html::a(
                      '<span class="glyphicon glyphicon-print"></span>',
                      $url);
                  },
                    ]
                  ],
2a050410   Yarik   Order
80
81
82
83
84
85
86
              ],
          ]
      ); ?>
      <?php
          $xPanel::end();
      ?>
  </div>