Blame view

common/modules/product/views/variant/index.php 3.4 KB
d8c1a2e0   Yarik   Big commit artbox
1
  <?php
4e55ce81   Yarik   Another one admin...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
      
      use common\modules\product\models\Product;
      use common\modules\product\models\ProductVariantSearch;
      use yii\data\ActiveDataProvider;
      use yii\helpers\Html;
      use yii\grid\GridView;
      use yii\helpers\Url;
      use yii\web\View;
      
      /**
       * @var View                 $this
       * @var ProductVariantSearch $searchModel
       * @var ActiveDataProvider   $dataProvider
       * @var Product              $product
       */
      
      $this->title = Yii::t('product', 'Variants for ').$product->lang->name;
      $this->params[ 'breadcrumbs' ][] = [
          'label' => Yii::t('product', 'Products'),
          'url'   => [ '/product/manage/index' ],
d8c1a2e0   Yarik   Big commit artbox
22
      ];
4e55ce81   Yarik   Another one admin...
23
24
25
26
27
28
29
30
      $this->params[ 'breadcrumbs' ][] = [
          'label' => $product->lang->name,
          'url'   => [
              '/product/manage/view',
              'id' => $product->product_id,
          ],
      ];
      $this->params['breadcrumbs'][] = \Yii::t('product', 'Variants');
d8c1a2e0   Yarik   Big commit artbox
31
32
  ?>
  <div class="product-index">
4e55ce81   Yarik   Another one admin...
33
      
d8c1a2e0   Yarik   Big commit artbox
34
      <h1><?= Html::encode($this->title) ?></h1>
4e55ce81   Yarik   Another one admin...
35
      
d8c1a2e0   Yarik   Big commit artbox
36
      <p>
4e55ce81   Yarik   Another one admin...
37
38
39
40
          <?= Html::a(Yii::t('product', 'Create Variant'), Url::toRoute([
              'create',
              'product_id' => $product->product_id,
          ]), [ 'class' => 'btn btn-success' ]) ?>
d8c1a2e0   Yarik   Big commit artbox
41
42
43
      </p>
      <?= GridView::widget([
          'dataProvider' => $dataProvider,
4e55ce81   Yarik   Another one admin...
44
45
46
          'filterModel'  => $searchModel,
          'columns'      => [
              'product_variant_id',
d8c1a2e0   Yarik   Big commit artbox
47
              [
4e55ce81   Yarik   Another one admin...
48
49
                  'attribute' => 'variant_name',
                  'value' => 'lang.name',
d8c1a2e0   Yarik   Big commit artbox
50
51
52
53
54
              ],
              'sku',
              'price',
              'price_old',
              'stock',
4e55ce81   Yarik   Another one admin...
55
              'image.imageUrl:image',
d8c1a2e0   Yarik   Big commit artbox
56
              [
4e55ce81   Yarik   Another one admin...
57
58
59
60
61
62
63
64
65
66
                  'class'   => 'yii\grid\ActionColumn',
                  'buttons' => [
                      'view'   => function($url, $model) {
                          return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', Url::to([
                              'view',
                              'product_id' => $model->product_id,
                              'id'         => $model->product_variant_id,
                          ]), [
                              'title' => \Yii::t('app', "Просмотр"),
                          ]);
d8c1a2e0   Yarik   Big commit artbox
67
                      },
4e55ce81   Yarik   Another one admin...
68
69
70
71
72
73
74
75
                      'update' => function($url, $model) {
                          return Html::a('<span class="glyphicon glyphicon-pencil"></span>', Url::to([
                              'update',
                              'product_id' => $model->product_id,
                              'id'         => $model->product_variant_id,
                          ]), [
                              'title' => \Yii::t('app', "Редактировать"),
                          ]);
d8c1a2e0   Yarik   Big commit artbox
76
                      },
4e55ce81   Yarik   Another one admin...
77
78
79
80
81
82
83
84
                      'delete' => function($url, $model) {
                          
                          return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::to([
                              'delete',
                              'product_id' => $model->product_id,
                              'id'         => $model->product_variant_id,
                          ]), [
                              'title'        => Yii::t('yii', 'Delete'),
d8c1a2e0   Yarik   Big commit artbox
85
                              'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'),
4e55ce81   Yarik   Another one admin...
86
                              'data-method'  => 'post',
d8c1a2e0   Yarik   Big commit artbox
87
                          ]);
4e55ce81   Yarik   Another one admin...
88
                          
d8c1a2e0   Yarik   Big commit artbox
89
90
91
92
93
94
                      },
                  ],
              ],
          ],
      ]); ?>
  </div>