Blame view

artweb/artbox-catalog/views/variant/_form.php 4.32 KB
16f1e516   mzavalniuk   add artbox-catalo...
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  <?php
      
      use artbox\catalog\models\Variant;
      use artbox\catalog\models\VariantLang;
      use artbox\catalog\models\VariantOptionGroupCompl;
      use artbox\catalog\models\VariantOptionGroupExcl;
      use yii\bootstrap\Tabs;
      use yii\helpers\Html;
      use yii\web\View;
      use yii\widgets\ActiveForm;
      
      /**
       * @var VariantLang[]             $modelLangs
       * @var Variant                   $model
       * @var ActiveForm                $form
       * @var View                      $this
       * @var VariantOptionGroupCompl[] $groups_compl
       * @var VariantOptionGroupExcl[]  $groups_excl
       * @var \artbox\stock\models\Shop $shops;
       */
  ?>
  
  <div class="variant-form">
      
      <?php $form = ActiveForm::begin(); ?>
      
      <?php
          echo Tabs::widget(
              [
                  'items'   => [
                      [
                          'label'   => \Yii::t('catalog', 'Common'),
                          'content' => $this->render(
                              '_form_common',
                              [
                                  'form'       => $form,
                                  'model'      => $model,
                                  'modelLangs' => $modelLangs,
                              ]
                          ),
                          'active'  => true,
                      ],
                      [
                          'label'         => \Yii::t('catalog', 'Options'),
                          'content'       => $this->render(
                              '_form_options',
                              [
                                  'form'         => $form,
                                  'model'        => $model,
                                  'modelLangs'   => $modelLangs,
                                  'groups_compl' => $groups_compl,
                                  'groups_excl'  => $groups_excl,
                              ]
                          ),
                          'headerOptions' => [
                              'class'               => ( empty( $groups_compl ) && empty( $groups_excl ) ) ? 'disabled' : '',
                              'data-toggle'         => ( empty( $groups_compl ) && empty( $groups_excl ) ) ? 'tooltip' : '',
                              'data-placement'      => ( empty( $groups_compl ) && empty( $groups_excl ) ) ? 'top' : '',
                              'data-original-title' => ( empty( $groups_compl ) && empty( $groups_excl ) ) ? \Yii::t(
                                  'catalog',
                                  'Product must not be new and have categories with option groups'
                              ) : '',
                          ],
                      ],
  
                      [
                          'label'         => \Yii::t('catalog', 'Stock'),
                          'content'       => $this->render(
                              '_form_stock',
                              [
                                  'form'         => $form,
                                  'model'        => $model,
                                  'modelLangs'   => $modelLangs,
                                  'shops'        => $shops,
                              ]
                          ),
                          'headerOptions' => [
                              'class'               => ( !class_exists( '\artbox\stock\models\VariantToShop' ) ) ? 'disabled' : '',
                              'data-toggle'         => (!class_exists( '\artbox\stock\models\VariantToShop' ) ) ? 'tooltip' : '',
                              'data-placement'      => ( !class_exists( '\artbox\stock\models\VariantToShop' ) ) ? 'top' : '',
                              'data-original-title' => ( !class_exists( '\artbox\stock\models\VariantToShop' ) ) ? \Yii::t(
                                  'catalog',
                                  'You haven\'t this module'
                              ) : '',
                          ],
                      ],
                      
                  ],
                  'options' => [
                      'class' => 'bar_tabs',
                  ],
              ]
          );
      ?>
      
      <div class="form-group">
          <?= Html::submitButton(
              $model->isNewRecord ? Yii::t('catalog', 'Create') : Yii::t('catalog', 'Update'),
              [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
          ) ?>
      </div>
      
      <?php ActiveForm::end(); ?>
  
  </div>