| @@ 68-84 (lines=17) @@ | ||
| 65 | 'class' => UpdateEditable::className(), |
|
| 66 | 'modelName' => Navigation::className(), |
|
| 67 | 'allowedAttributes' => [ |
|
| 68 | 'active' => function (Navigation $model) { |
|
| 69 | if ($model === null || $model->active === null) { |
|
| 70 | return null; |
|
| 71 | } |
|
| 72 | if ($model->active === 1) { |
|
| 73 | $label_class = 'label-success'; |
|
| 74 | $value = 'Active'; |
|
| 75 | } else { |
|
| 76 | $value = 'Inactive'; |
|
| 77 | $label_class = 'label-default'; |
|
| 78 | } |
|
| 79 | return \yii\helpers\Html::tag( |
|
| 80 | 'span', |
|
| 81 | Yii::t('app', $value), |
|
| 82 | ['class' => "label $label_class"] |
|
| 83 | ); |
|
| 84 | }, |
|
| 85 | ], |
|
| 86 | ], |
|
| 87 | ]; |
|
| @@ 154-170 (lines=17) @@ | ||
| 151 | 1 => Yii::t('app', 'Active'), |
|
| 152 | ], |
|
| 153 | 'format' => 'raw', |
|
| 154 | 'value' => function (\app\widgets\navigation\models\Navigation $model) { |
|
| 155 | if ($model === null || $model->active === null) { |
|
| 156 | return null; |
|
| 157 | } |
|
| 158 | if ($model->active === 1) { |
|
| 159 | $label_class = 'label-success'; |
|
| 160 | $value = 'Active'; |
|
| 161 | } else { |
|
| 162 | $value = 'Inactive'; |
|
| 163 | $label_class = 'label-default'; |
|
| 164 | } |
|
| 165 | return \yii\helpers\Html::tag( |
|
| 166 | 'span', |
|
| 167 | Yii::t('app', $value), |
|
| 168 | ['class' => "label $label_class"] |
|
| 169 | ); |
|
| 170 | }, |
|
| 171 | ], |
|
| 172 | 'name', |
|
| 173 | 'url', |
|
| @@ 163-179 (lines=17) @@ | ||
| 160 | 1 => Yii::t('app', 'Active'), |
|
| 161 | ], |
|
| 162 | 'format' => 'raw', |
|
| 163 | 'value' => function (Product $model) { |
|
| 164 | if ($model === null || $model->active === null) { |
|
| 165 | return null; |
|
| 166 | } |
|
| 167 | if ($model->active === 1) { |
|
| 168 | $label_class = 'label-success'; |
|
| 169 | $value = 'Active'; |
|
| 170 | } else { |
|
| 171 | $value = 'Inactive'; |
|
| 172 | $label_class = 'label-default'; |
|
| 173 | } |
|
| 174 | return \yii\helpers\Html::tag( |
|
| 175 | 'span', |
|
| 176 | Yii::t('app', $value), |
|
| 177 | ['class' => "label $label_class"] |
|
| 178 | ); |
|
| 179 | }, |
|
| 180 | ], |
|
| 181 | [ |
|
| 182 | 'class' => 'kartik\grid\EditableColumn', |
|
| @@ 112-128 (lines=17) @@ | ||
| 109 | }, |
|
| 110 | 'price', |
|
| 111 | 'old_price', |
|
| 112 | 'active' => function (Product $model) { |
|
| 113 | if ($model === null || $model->active === null) { |
|
| 114 | return null; |
|
| 115 | } |
|
| 116 | if ($model->active === 1) { |
|
| 117 | $label_class = 'label-success'; |
|
| 118 | $value = 'Active'; |
|
| 119 | } else { |
|
| 120 | $value = 'Inactive'; |
|
| 121 | $label_class = 'label-default'; |
|
| 122 | } |
|
| 123 | return \yii\helpers\Html::tag( |
|
| 124 | 'span', |
|
| 125 | Yii::t('app', $value), |
|
| 126 | ['class' => "label $label_class"] |
|
| 127 | ); |
|
| 128 | }, |
|
| 129 | ], |
|
| 130 | ], |
|
| 131 | 'property-handler' => [ |
|