<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;



$this->title = Yii::t('app', 'Bidding ID');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="auctions-index">

    <div class="panel panel-primary">
        <div class="panel-heading"><span class="glyphicon glyphicon-th-large"></span><strong> <?= Html::encode($this->title) ?></strong></div>
        <div class="panel-body">

            <?php //Pjax::begin(); ?>
            <?= GridView::widget([
                'dataProvider' => $dataProvider,
                'columns' => [
                    ['class' => 'yii\grid\SerialColumn'],
                    //'id',
                    [
                        'attribute'    =>  'created_at',
                        'header' => Yii::t('app', 'Date ID'),
                        //'attribute' =>  'date_start',
                        //'header' => Yii::t('app', 'AuctionDate ID'),
                    ],
                    [
                        'attribute' =>  'auction.name',
                        'header' => Yii::t('app', 'AukName ID'),
                    ],
                    [
                        'attribute' =>  'lot.name',
                        'header' => Yii::t('app', 'Lot ID'),
                    ],
                    [
                        'attribute' =>  'user.at_org',
                        'header' => Yii::t('app', 'BidFrom ID'),
                    ],
                    'special_price',
                    [
                        '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',
                    ],
                    [
                        'class' => 'yii\grid\ActionColumn',
                        'template' => '{confirm} {reject} {download}',
                        'buttons' => [
                            'confirm' => function ($url,$model,$key) {
                                return Html::a('', ['confirm','id'=> $model['id']],['title'=>Yii::t('app','Confirm ID'),'class' => 'glyphicon glyphicon-ok-circle', 'style'=>'font-size: 25px;']);
                            },
                            'reject' => function ($url,$model,$key) {
                                return Html::a('', ['reject','id'=> $model['id']],['title'=>Yii::t('app','Reject ID'),'class' => 'glyphicon glyphicon-remove-circle', 'style'=>'font-size: 25px;']);
                            },
                            'delete' => function ($url,$model,$key) {
                                return Html::a('', 'delete?id=' . $model['id'], ['title' => Yii::t('app', 'Delete ID'), 'class' => 'glyphicon glyphicon-trash' , 'style'=>'font-size: 25px;']);
                            },
                            'download' => function ($url,$model,$key) {

                                return Html::a('', '/files/download?id='.$model['file_id'],['title'=>Yii::t('app','Download ID'),'class' => 'glyphicon glyphicon-circle-arrow-down', 'style'=>'font-size: 25px;']);
                            }
                        ],
                    ],
                ],
            ]); ?>
            <?php //Pjax::end(); ?>
        </div>
    </div>
</div>