<?php

use common\models\Compere;
use slavkovrn\lightbox\LightBoxWidget;
use yii\helpers\Html;
use yii\widgets\DetailView;

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

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Comperes'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box box-success">
    <div class="box-body">
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            [
                'attribute' => 'cover',
                'format' => 'raw',
                'value' => function ($model) {
                    $images = [               // images at popup window of prettyPhoto galary
                        1 => [
                            'src' => $model->cover,
                            'title' => '',
                        ],
                    ];
                    return $model->cover ? LightBoxWidget::widget([
                        'id' => 'cover',  // id of plugin should be unique at page
                        'class' => 'galary',    // class of plugin to define style
                        'height' => '100px',     // height of image visible in widget
                        'width' => '100px',      // width of image visible in widget
                        'images' => $images,
                    ]) : null;
                }
            ],
            'name',
            'desc',
            [
                'attribute' => 'province',
                'format' => 'raw',
                'value' => function ($model) {
                    return \common\models\Region::getNameById($model->province);
                },
            ],
            [
                'attribute' => 'city',
                'format' => 'raw',
                'value' => function ($model) {
                    return \common\models\Region::getNameById($model->city);
                },
            ],
            [
                'attribute' => 'area',
                'format' => 'raw',
                'value' => function ($model) {
                    return \common\models\Region::getNameById($model->area);
                },
            ],
            'address',
            'title',
            'works',
            'tel',
            'created_at',
            'updated_at',
            [
                'attribute' => 'status',
                'value' => function ($model) {
                    return Compere::getStatusList($model->status);
                },
            ],
        ],
    ]) ?>
    </div>
</div>
