<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\components\RoleDefinition;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = $model->username;
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/user', 'Users'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">

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

    <?php if ( RoleDefinition::isAdmin()) {?>
    <p>
        <?= Html::a(Yii::t('backend/user', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
    </p>
    <?php }?>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'username',
            'email:email',
            'statusHuman',
            'created_at:datetime',
        	[
        		'attribute' => 'role',
        		'value' => $model->roleString
    ]
        ],
    ]) ?>

</div>
