<?php
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="trigger-trigger-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('Добавить триггер', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            [
                'attribute' => 'active',
                'value' => function($model) {
                        return ($model->active==1) ? 'Активен' : 'Не активен';
                    }
            ],
            'name',
            'description:html',
            [
                'attribute' => 'owner_id',
                'value' => function($model) {
                        /** @var $model common\modules\triggers\models\TriggerTrigger */
                        return $model->owner->fio;
                    }
            ],
            'date_create:datetime',
            'timeout',
            'message_template_id',
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{update}{delete}',
            ],
        ],
    ]); ?>
</div>
