<?php

use common\models\Goods;
use slavkovrn\lightbox\LightBoxWidget;
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\Goods */
/* @var $goodsSkuProvider ActiveDataProvider */
/* @var $goodsAttrProvider ActiveDataProvider */


$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Goods'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<p>
    <?= Html::a(Yii::t('common', '更新商品'), ['update', 'id' => $model->id], ['class' => 'btn btn-success']) ?>

    <?= Html::a(Yii::t('common', '删除商品'), ['delete', 'id' => $model->id], [
        'class' => 'btn btn-danger',
        'data' => [
            'confirm' => Yii::t('common', 'Are you sure you want to delete this item?'),
            'method' => 'post',
        ],
    ]) ?>
</p>

<div class="box box-success">
    <div class="box-body">
        <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                'cat.title:text:分类',
                'store.name:text:商家',
                'name',
                'desc',
                'origin_price',
                'price',
                'actual_sales',
                'virtual_sales',
                'actual_views',
                'virtual_views',
                'stock',
                [
                    'attribute' => 'cover',
                    'format' => ['image'],
                    'contentOptions' => ['class' => 'media-content']
                ],
//                [
//                    'attribute' => 'banner',
//                    'format' => ['images'],
//                    'contentOptions' => ['class' => 'media-content']
//                ],
                [
                    'attribute' => 'picture',
                    'format' => ['images'],
                    'contentOptions' => ['class' => 'media-content']
                ],

                'created_at:datetime',
                'updated_at:datetime',

                [
                    'attribute' => 'status',
                    'value' => Goods::getStatusList($model->status),
                ],
            ],
        ]) ?>
    </div>
</div>


<?php
$js = <<<JS
    //layer相册
    layer.ready(function () {
        layer.photos({
            photos: '.media-content',
            shift: 5
        });
    });
JS;
$this->registerJs($js);
?>


