| @@ 110-126 (lines=17) @@ | ||
| 107 | }, |
|
| 108 | 'price', |
|
| 109 | 'old_price', |
|
| 110 | 'active' => function (Product $model) { |
|
| 111 | if ($model === null || $model->active === null) { |
|
| 112 | return null; |
|
| 113 | } |
|
| 114 | if ($model->active === 1) { |
|
| 115 | $label_class = 'label-success'; |
|
| 116 | $value = 'Active'; |
|
| 117 | } else { |
|
| 118 | $value = 'Inactive'; |
|
| 119 | $label_class = 'label-default'; |
|
| 120 | } |
|
| 121 | return \yii\helpers\Html::tag( |
|
| 122 | 'span', |
|
| 123 | Yii::t('app', $value), |
|
| 124 | ['class' => "label $label_class"] |
|
| 125 | ); |
|
| 126 | }, |
|
| 127 | ], |
|
| 128 | ], |
|
| 129 | 'property-handler' => [ |
|
| @@ 159-175 (lines=17) @@ | ||
| 156 | 1 => Yii::t('app', 'Active'), |
|
| 157 | ], |
|
| 158 | 'format' => 'raw', |
|
| 159 | 'value' => function (Product $model) { |
|
| 160 | if ($model === null || $model->active === null) { |
|
| 161 | return null; |
|
| 162 | } |
|
| 163 | if ($model->active === 1) { |
|
| 164 | $label_class = 'label-success'; |
|
| 165 | $value = 'Active'; |
|
| 166 | } else { |
|
| 167 | $value = 'Inactive'; |
|
| 168 | $label_class = 'label-default'; |
|
| 169 | } |
|
| 170 | return \yii\helpers\Html::tag( |
|
| 171 | 'span', |
|
| 172 | Yii::t('app', $value), |
|
| 173 | ['class' => "label $label_class"] |
|
| 174 | ); |
|
| 175 | }, |
|
| 176 | ], |
|
| 177 | [ |
|
| 178 | 'class' => 'kartik\grid\EditableColumn', |
|