<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

$this->title = Yii::t('app', 'Training For') . ' ' . $model->trainingRequest->full_name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Trainings'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="trainings-view">

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

    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            [
                'attribute' => 'serial_number',
                'value' => function($model){
                    return $model->trainingRequest->serial_number;
                }
            ],
            [
                'attribute' => 'trainee_full_name',
                'value' => function($model){
                    return $model->trainingRequest->full_name;
                }
            ],
            [
                'attribute' => 'trainee_mother_name',
                'value' => function($model){
                    return $model->trainingRequest->mother_name;
                }
            ],
            'approved_date',
            'start_date',
            'end_date',
            [
                'attribute' => 'branch_id',
                'value' => function($model){
                    return $model->branch->branch;
                }
            ]
        ],
    ]) ?>

</div>
