Blame view

common/modules/product/views/variant/index.php 4.35 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
      
      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
       */
      
8af13427   Yarik   For leha commit.
18
      $this->title = Yii::t('product', 'Variants for ') . $product->lang->title;
4e55ce81   Yarik   Another one admin...
19
20
21
      $this->params[ 'breadcrumbs' ][] = [
          'label' => Yii::t('product', 'Products'),
          'url'   => [ '/product/manage/index' ],
d8c1a2e0   Yarik   Big commit artbox
22
      ];
4e55ce81   Yarik   Another one admin...
23
      $this->params[ 'breadcrumbs' ][] = [
8af13427   Yarik   For leha commit.
24
          'label' => $product->lang->title,
4e55ce81   Yarik   Another one admin...
25
26
          'url'   => [
              '/product/manage/view',
8af13427   Yarik   For leha commit.
27
              'id' => $product->id,
4e55ce81   Yarik   Another one admin...
28
29
          ],
      ];
5c2eb7c8   Yarik   Big commit almost...
30
      $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>
8af13427   Yarik   For leha commit.
37
38
39
40
41
42
43
44
45
46
          <?= Html::a(
              Yii::t('product', 'Create Variant'),
              Url::toRoute(
                  [
                      'create',
                      'product_id' => $product->id,
                  ]
              ),
              [ 'class' => 'btn btn-success' ]
          ) ?>
d8c1a2e0   Yarik   Big commit artbox
47
      </p>
8af13427   Yarik   For leha commit.
48
49
50
51
52
      <?= GridView::widget(
          [
              'dataProvider' => $dataProvider,
              'filterModel'  => $searchModel,
              'columns'      => [
4428da8c   Yarik   Almost all databa...
53
                  'id',
8af13427   Yarik   For leha commit.
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
                  [
                      'attribute' => 'variantName',
                      'value'     => 'lang.title',
                  ],
                  'sku',
                  'price',
                  'price_old',
                  'stock',
                  'image.imageUrl:image',
                  [
                      '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,
4428da8c   Yarik   Almost all databa...
73
                                          'id'         => $model->id,
8af13427   Yarik   For leha commit.
74
75
76
77
78
79
80
81
82
83
84
85
86
87
                                      ]
                                  ),
                                  [
                                      'title' => \Yii::t('app', "Просмотр"),
                                  ]
                              );
                          },
                          'update' => function ($url, $model) {
                              return Html::a(
                                  '<span class="glyphicon glyphicon-pencil"></span>',
                                  Url::to(
                                      [
                                          'update',
                                          'product_id' => $model->product_id,
4428da8c   Yarik   Almost all databa...
88
                                          'id'         => $model->id,
8af13427   Yarik   For leha commit.
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
                                      ]
                                  ),
                                  [
                                      'title' => \Yii::t('app', "Редактировать"),
                                  ]
                              );
                          },
                          'delete' => function ($url, $model) {
                              
                              return Html::a(
                                  '<span class="glyphicon glyphicon-trash"></span>',
                                  Url::to(
                                      [
                                          'delete',
                                          'product_id' => $model->product_id,
4428da8c   Yarik   Almost all databa...
104
                                          'id'         => $model->id,
8af13427   Yarik   For leha commit.
105
106
107
108
109
110
111
112
113
114
115
                                      ]
                                  ),
                                  [
                                      'title'        => Yii::t('yii', 'Delete'),
                                      'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'),
                                      'data-method'  => 'post',
                                  ]
                              );
                              
                          },
                      ],
d8c1a2e0   Yarik   Big commit artbox
116
117
                  ],
              ],
8af13427   Yarik   For leha commit.
118
119
          ]
      ); ?>
d8c1a2e0   Yarik   Big commit artbox
120
  </div>