Commit a1da4203127e9b58f54a29016e81e1587e4f9559
1 parent
1228053e
-Date fixed
Showing
1 changed file
with
16 additions
and
3 deletions
Show diff stats
views/order/index.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | + use artbox\order\models\Order; | |
| 3 | 4 | use yii\helpers\Html; |
| 4 | 5 | use yii\grid\GridView; |
| 5 | 6 | use yiister\gentelella\widgets\Panel; |
| ... | ... | @@ -32,7 +33,7 @@ |
| 32 | 33 | 'filterModel' => $searchModel, |
| 33 | 34 | 'columns' => [ |
| 34 | 35 | [ 'class' => 'yii\grid\SerialColumn' ], |
| 35 | - | |
| 36 | + | |
| 36 | 37 | 'id', |
| 37 | 38 | 'user_id', |
| 38 | 39 | 'name', |
| ... | ... | @@ -43,7 +44,19 @@ |
| 43 | 44 | 'value' => 'label.lang.title', |
| 44 | 45 | 'filter' => $labels, |
| 45 | 46 | ], |
| 46 | - 'created_at:datetime', | |
| 47 | + [ | |
| 48 | + 'attribute' => 'created_at', | |
| 49 | + 'value' => function ($model) { | |
| 50 | + /** | |
| 51 | + * @var Order $model | |
| 52 | + */ | |
| 53 | + if (empty($model->created_at)) { | |
| 54 | + return \Yii::$app->formatter->asText(''); | |
| 55 | + } else { | |
| 56 | + return date('d M, Y H:i:s', $model->created_at); | |
| 57 | + } | |
| 58 | + }, | |
| 59 | + ], | |
| 47 | 60 | [ |
| 48 | 61 | 'attribute' => 'count', |
| 49 | 62 | 'value' => function ($model) { |
| ... | ... | @@ -53,7 +66,7 @@ |
| 53 | 66 | return count($model->orderProducts); |
| 54 | 67 | }, |
| 55 | 68 | ], |
| 56 | - | |
| 69 | + | |
| 57 | 70 | [ 'class' => 'yii\grid\ActionColumn', |
| 58 | 71 | 'template' => '{view} {update} {delete} {print}', |
| 59 | 72 | 'buttons' => [ | ... | ... |