<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
$this->title = $model->template_name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Email Templates'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

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

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

    <?php if(Yii::$app->session->hasFlash('template_variables_saved')): ?>
        <div class="alert alert-success">
            <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
            <?= Yii::$app->session->getFlash('template_variables_saved') ?>
        </div>
    <?php endif; ?>

    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-expanded']) ?>
        <!-- <?= Html::a(Yii::t('app', 'Managing Variables'), ['managing-variables', 'id' => $model->id], ['class' => 'btn btn-purple btn-expanded']) ?> -->
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'template_name',
            [
                'attribute' => 'dedicated_for',
                'value' => function($model){
                    return Yii::t('app', $model->dedicated_for);
                }
            ],
            [
                'attribute' => 'is_active',
                'value' => function($model){
                    return $model->is_active == 0 ? Yii::t('app', 'No') : Yii::t('app', 'Yes');
                }
            ],
            [
                'attribute' => 'content',
                'format' => 'raw'
            ]
        ],
    ]) ?>

</div>
