view.php 2.28 KB
<?php
    
    use artbox\core\helpers\ImageHelper;
    use yii\helpers\Html;
    use yii\widgets\DetailView;
    use yiister\gentelella\widgets\Panel;
    
    /* @var $this yii\web\View */
    /* @var $model artbox\catalog\models\Brand */
    
    $this->title = $model->lang->title;
    $this->params[ 'breadcrumbs' ][] = [
        'label' => Yii::t('catalog', 'Brands'),
        'url'   => [ 'index' ],
    ];
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="brand-view">
    
    <?php
        $xPanel = Panel::begin(
            [
                'header' => Html::encode($this->title),
            ]
        );
    ?>
    <p>
        <?= Html::a(
            Yii::t('catalog', 'Update'),
            [
                'update',
                'id' => $model->id,
            ],
            [ 'class' => 'btn btn-primary' ]
        ) ?>
        <?= Html::a(
            Yii::t('catalog', 'Delete'),
            [
                'delete',
                'id' => $model->id,
            ],
            [
                'class' => 'btn btn-danger',
                'data'  => [
                    'confirm' => Yii::t('catalog', 'Are you sure you want to delete this item?'),
                    'method'  => 'post',
                ],
            ]
        ) ?>
    </p>
    
    <?= DetailView::widget(
        [
            'model'      => $model,
            'attributes' => [
                'id',
                [
                    'attribute' => 'image_id',
                    'label'     => \Yii::t('catalog', 'Image'),
                    'value'     => $model->image_id ? ImageHelper::set($model->image->getPath())
                                                                 ->setWidth(200)
                                                                 ->render() : null,
                    'format'    => 'image',
                ],
                'lang.title',
                [
                    'attribute' => 'lang.alias.value',
                    'label'     => \Yii::t('catalog', 'Alias'),
                ],
                'lang.description:html',
                'sort',
                'status:boolean',
                'created_at:datetime',
                'updated_at:datetime',
            ],
        ]
    ) ?>
    
    <?php
        $xPanel::end();
    ?>

</div>