= GridView::widget([
'dataProvider' => $dataProvider,
// 'filterModel' => $searchModel,
'columns' => [
[
'header'=>'#id',
'attribute'=>'id',
'value'=>'id'
],
[
'attribute' => 'user.at_org',
'header' => Yii::t('app', 'BidFrom ID'),
],
[
'attribute'=>'status',
//'header' => Yii::t('app', 'Status ID'),
'value' => function($model){
$auction = $model->auction ? $model->auction->status : false;
if($auction){
$status_name = Auctions::statusNames()[$model->auction->status];
if($model->auction->status == 1){
return Html::a($status_name, ['#'], ['class' => 'label label-warning']);
}
if($model->auction->status == 2){
return Html::a($status_name, ['#'], ['class' => 'label label-danger']);
}
if($model->auction->status == 3){
return Html::a($status_name, ['#'], ['class' => 'label label-default']);
}
if($model->auction->status == 4){
return Html::a($status_name, ['#'], ['class' => 'label label-primary']);
}
}
if ($model->status==1)
{
//return Yii::t('app', 'Waiting ID');
return Html::a(Yii::t('app', 'Waiting ID'), ['#'], ['class' => 'label label-warning']);
}
if ($model->status==2)
{
//return Yii::t('app', 'Success ID');
return Html::a(Yii::t('app', 'Success ID'). ($model->auction ? ' | ' . (string)Auctions::statusNames()[$model->auction->status] : ''), ['#'], ['class' => 'label label-success']);
}
if ($model->status==3)
{
//return Yii::t('app', 'Rejected ID');
return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
}
if ($model->status==4)
{
//return Yii::t('app', 'Rejected ID');
return Html::a(Yii::t('app', 'Agree by organizer'), ['#'], ['class' => 'label label-info']);
}
},
'format' => 'raw',
],
[
'header'=>'Номер лоту',
'attribute'=>'lot.id',
'value'=>'lot.id'
],
[
'header'=>'Номер аукціону',
'attribute'=>'auction.id',
'value'=>'auction.id'
],
[
'attribute' => 'created_at',
'header' => Yii::t('app', 'Date ID'),
//'attribute' => 'date_start',
//'header' => Yii::t('app', 'AuctionDate ID'),
],
[
'attribute' => 'auction.date_start',
'header' => Yii::t('app', 'AuctionDate ID'),
],
'special_price',
[
'header' => Yii::t('app', 'Рахунки'),
'value' => function($model){
$status = true;
foreach($model->bills as $bill){
if( $bill->payed == 0 || $bill->payed == 2 ){
$status = false;
break;
}
}
if ($status)
{
return Html::a('Сплачено', ['view'], ['class' => 'label label-success']);
///return Html::a(Yii::t('app', 'WaitConfirm ID'), ['view'], ['class' => 'label label-warning']);
} else {
return Html::a('Не сплачено', ['/bills'], ['class' => 'label label-danger']);
}
},
'format' => 'raw',
],
[
'header' => Yii::t('app', 'Status ID'),
'value' => function($model){
if ($model['status']==0)
{
return Html::a(Yii::t('app', 'WaitConfirm ID'), ['#'], ['class' => 'label label-warning']);
}
if ($model['status']==1)
{
return Html::a(Yii::t('app', 'Success ID'), ['#'], ['class' => 'label label-success']);
}
if ($model['status']==2)
{
return Html::a(Yii::t('app', 'Rejected ID'), ['#'], ['class' => 'label label-danger']);
}
},
'format' => 'raw',
],
[
'header' => Yii::t('app', 'Назва аукціону'),
'attribute' => 'lot.name',
],
['class' => 'yii\grid\ActionColumn',
'template' => '
{auctions}
',
'buttons' => [
'auctions' => function ($url, $model, $key) {
if (!$model->auction) {
return null;
}
if ($model->auction->status != 2) {
// return null;
}
return Html::a(
'
',
['/auctions/view', 'id' => $model->auction->id],
[
'title' => 'Перейти до торгів'
]
);
},
],
],
],
]); ?>