Blame view

views/tax-group/index.php 3.95 KB
2f25da09   Yarik   first commit
1
2
3
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
  <?php

      use artweb\artbox\ecommerce\models\TaxGroup;

      use artweb\artbox\ecommerce\models\TaxGroupSearch;

      use yii\data\ActiveDataProvider;

      use yii\helpers\Html;

      use yii\grid\GridView;

      use yii\helpers\Url;

      use yii\web\View;

      

      /**

       * @var View               $this

       * @var integer            $level

       * @var ActiveDataProvider $dataProvider

       * @var TaxGroupSearch     $searchModel

       * @var TaxGroup           $model

       */

      

      $this->title = $level ? Yii::t('rubrication', 'Modification Groups') : Yii::t('rubrication', 'Product Groups');

      $this->params[ 'breadcrumbs' ][] = $this->title;

  ?>

  

  <div class="tax-group-index">

      

      <h1><?= Html::encode($this->title) ?></h1>

      <p>

          <?= Html::a(

              Yii::t('rubrication', 'Create Group'),

              Url::to(

                  [

2e22f66f   Yarik   Links fixed
30
                      'tax-group/create',

2f25da09   Yarik   first commit
31
32
33
34
35
36
37
38
39
40
                      'level' => $level,

                  ]

              ),

              [ 'class' => 'btn btn-success' ]

          ) ?>

      </p>

      

      <?= GridView::widget(

          [

              'dataProvider' => $dataProvider,

2e22f66f   Yarik   Links fixed
41
              'filterModel'  => $searchModel,

2f25da09   Yarik   first commit
42
43
              'columns'      => [

                  [ 'class' => 'yii\grid\SerialColumn' ],

fb4fa156   Alexey Boroda   -Modifications gr...
44
                  'sort',

2f25da09   Yarik   first commit
45
46
                  [

                      'attribute' => 'is_filter',

2e22f66f   Yarik   Links fixed
47
48
                      'format'    => 'boolean',

                      'filter'    => \Yii::$app->formatter->booleanFormat,

2f25da09   Yarik   first commit
49
50
51
                  ],

                  [

                      'attribute' => 'groupName',

2e22f66f   Yarik   Links fixed
52
                      'value'     => 'lang.title',

2f25da09   Yarik   first commit
53
54
                  ],

                  [

fb4fa156   Alexey Boroda   -Modifications gr...
55
56
                      'attribute' => 'alias',

                      'value'     => 'lang.alias'

2f25da09   Yarik   first commit
57
58
                  ],

                  [

fb4fa156   Alexey Boroda   -Modifications gr...
59
60
                      'attribute' => 'description',

                      'value'     => 'lang.description'

2f25da09   Yarik   first commit
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
                  ],

                  [

                      'class'      => 'yii\grid\ActionColumn',

                      'template'   => '{update} {options} {delete}',

                      'buttons'    => [

                          'options' => function ($url, $model) {

                              return Html::a(

                                  '<span class="glyphicon glyphicon-th-list"></span>',

                                  $url,

                                  [

                                      'title' => Yii::t('rubrication', 'Options'),

                                  ]

                              );

                          },

                      ],

                      'urlCreator' => function ($action, $model, $key, $index) use ($level) {

                          if ($action === 'options') {

2e22f66f   Yarik   Links fixed
78
79
80
81
82
83
                              $url = Url::to(

                                  [

                                      'tax-option/index',

                                      'group' => $model->id,

                                  ]

                              );

2f25da09   Yarik   first commit
84
85
86
87
                              return $url;

                          } elseif ($action === 'update') {

                              $url = Url::to(

                                  [

2e22f66f   Yarik   Links fixed
88
                                      'tax-group/update',

2f25da09   Yarik   first commit
89
90
91
92
93
94
95
96
                                      'level' => $level,

                                      'id'    => $model->id,

                                  ]

                              );

                              return $url;

                          } elseif ($action === 'delete') {

                              $url = Url::to(

                                  [

2e22f66f   Yarik   Links fixed
97
                                      'tax-group/delete',

2f25da09   Yarik   first commit
98
99
100
101
102
103
104
105
106
107
108
109
110
111
                                      'level' => $level,

                                      'id'    => $model->id,

                                  ]

                              );

                              return $url;

                          }

                          return '';

                      },

                  ],

              ],

          ]

      ); ?>

  </div>