<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use common\modules\banners\entities\BannerPlace;
use common\modules\banners\helpers\BannerHelper;

/* @var $this yii\web\View */
/* @var $place \common\modules\banners\entities\BannerPlace */

$this->title = $place->title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('banners', 'Places'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="place-view">

    <p>
	    <?= Html::a(Yii::t('banners','Places'), ['index'], ['class' => 'btn btn-default']) ?>
        <?= Html::a(Yii::t('buttons', 'Edit'), ['update', 'id' => $place->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a(Yii::t('buttons', 'Delete'), ['delete', 'id' => $place->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
                'method' => 'post',
            ],
        ]) ?>
    </p>

	<div class="row">
		<div class="col-md-9">

		    <div class="box">
		        <div class="box-body">
		            <?= DetailView::widget([
		                'model' => $place,
		                'attributes' => [
		                    'id',
		                    'title',
		                    'width',
			                'height',
			                [
			                	'attribute' => 'active',
				                'format' => 'raw',
				                'value' => function(BannerPlace $place) {
									return BannerHelper::statusLabel($place->active);
				                }
			                ],
		                ],
		            ]) ?>
		        </div>
		    </div>
		</div>

		<div class="col-md-3">
			<div class="box box-default">
				<div class="box-header with-border"><?= Yii::t('banners', 'Insert Code') ?></div>
				<div class="box-body">

					<?php
					$code = Html::encode(
						"<?= \common\modules\\banners\widgets\BannerWidget::widget(['id' => ".$place->id."]) ?>");
					?>
					<p><?= Yii::t('banners', 'For template') ?></p>
					<pre><?= $code ?></pre>

					<?php
					$code = Html::encode(
						"[?= \common\modules\\banners\widgets\BannerWidget::widget(['id' => ".$place->id."]) ?]");
					?>
					<p><?= Yii::t('banners', 'For editor') ?></p>
					<pre><?= $code ?></pre>
				</div>
			</div>
		</div>
	</div>
</div>