<?php

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

$this->title = Yii::t('app', 'Email Templates');
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="email-templates-index">

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

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            [
                'attribute' => 'template_name',
                'headerOptions' => ['style' => 'width: 40%'],
            ],
            [
                'attribute' => 'dedicated_for',
                'headerOptions' => ['style' => 'width: 40%'],
                'value' => function($model){
                    return Yii::t('app', $model->dedicated_for);
                }
            ],
            [
                'attribute' => 'is_active',
                'headerOptions' => ['style' => 'width: 10%'],
                'value' => function($model){
                    return $model->is_active == 0 ? Yii::t('app', 'No') : Yii::t('app', 'Yes');
                }
            ],
            [
                'class' => 'yii\grid\ActionColumn',
                'headerOptions' => ['style' => 'width: 10%'],
                'template' => '{view} {update}',
                'buttons' => [
                    'variables' => function($url, $model){
                        return Html::a('<span class="glyphicon glyphicon-tags"></span>',
                            ['managing-variables', 'id' => $model->id],
                            ['title' => Yii::t('app', 'Manage Variables')]);
                    }
                ]
            ],
        ],
    ]); ?>
</div>
