123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?php
- use common\models\Master;
- use slavkovrn\lightbox\LightBoxWidget;
- 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\Master */
- $this->title = $model->name;
- $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Masters'), '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', 'Create Goods Index'), ['/goods-index/create','entity' => Master::className(),'entity_id'=>$model->id,'origin'=>Yii::$app->request->url], ['class' => 'btn btn-success', 'title' => Yii::t('common', 'Create Goods Index'), 'target' => '_blank']) ?>
- <?= 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="nav-tabs-custom">
- <ul class="nav nav-tabs">
- <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">大师信息</a></li>
- <li><a href="#tab_2" data-toggle="tab" aria-expanded="true">关联商品</a></li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane active" id="tab_1">
- <?= 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;
- }
- ],
- [
- 'attribute' => 'banner',
- 'format' => 'raw',
- 'value' => function ($model) {
- $images = [];
- foreach ($model->banner as $index => $banner) {
- $images[$index] = ['src' => $banner, 'title' => ''];
- }
- return $model->banner ? LightBoxWidget::widget([
- 'id' => 'banner', // 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;
- }
- ],
- [
- 'attribute' => 'picture',
- 'format' => 'raw',
- 'value' => function ($model) {
- $images = [];
- foreach ($model->picture as $index => $picture) {
- $images[$index] = ['src' => $picture, 'title' => ''];
- }
- return $model->picture ? LightBoxWidget::widget([
- 'id' => 'picture', // 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;
- }
- ],
- [
- 'attribute' => 'vid',
- 'format' => 'raw',
- 'value' => function ($model){
- return '<iframe frameborder="0" src="https://v.qq.com/txp/iframe/player.html?vid='.$model->vid.'" allowFullScreen="true"></iframe>';
- }
- ],
- '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',
- 'fields',
- 'works',
- 'tel',
- 'created_at:datetime',
- 'updated_at:datetime',
- [
- 'attribute' => 'status',
- 'value' => function ($model) {
- return Master::getStatusList($model->status);
- },
- ],
- ],
- ]) ?>
- </div>
- <!-- 管理商品列表管理-->
- <div class="tab-pane " id="tab_2">
- <?= GridView::widget([
- 'dataProvider' => $index['data'],
- //'filterModel' => $searchModel,
- 'columns' => [
- 'id',
- 'goods_id',
- 'entity',
- 'entity_id',
- 'attribute',
- [
- 'class' => 'common\helpers\DiyActionColumn',
- 'template' => '{update} {delete}',
- 'buttons' => [
- 'update' => function ($url, $model, $key) {
- return Html::a(Yii::t('yii', 'Update'), Url::to(['/goods-index/update', 'id' => $model->id,'origin'=>Yii::$app->request->url]), [
- 'class' => 'btn btn-success btn-xs',
- 'title' => Yii::t('common', 'Update Goods Index'),
- 'target' => '_blank'
- ]);
- },
- 'delete' => function ($url, $model, $key) {
- return Html::a('删除', Url::to(['/goods-index/delete', 'id' => $model->id,'origin'=>Yii::$app->request->url]), [
- 'class' => 'btn btn-success btn-xs',
- 'title' => Yii::t('common', '删除关联商品'),
- 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
- 'data-method' => 'post',
- ]);
- },
- ],
- ],
- ],
- ]); ?>
- </div>
- </div>
- </div>
|