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