<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\EventlogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

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

    <!-- <h1><?= Html::encode($this->title) ?></h1> -->
    <?php  //echo $this->render('_search', ['model' => $searchModel]); ?>


    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            'ip',
            [
                'attribute' => 'at_org',
                'value' => 'user.at_org',
            ],
            [
                'attribute' => 'name',
                'value' => function($model)
                {
                    return isset($model->lots->name) ? Html::a($model->lots->name, ['/auctions/view', 'id' => $model->auk_id]): '';
                },
                'format' => 'raw',

            ],
            [
                'attribute' => 'auk_id',
                'value' => function($model)
                {
                    if(empty($model->auk_id))
                    {
                        return false;
                    }
                    else
                    {
                        return Html::a(Yii::t('app','Download ID'),
                            ['/eventlog/tradelog', 'id' => $model->auk_id, 'user_id' => $model->user_id],
                            ['class' => 'glyphicon glyphicon-circle-arrow-down row1']);
                    }
                },
                'format' => 'raw',
            ],
            'action',
            'date',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
