echo $form->field($model, 'is_delete')->checkbox(); ?> <?php echo $form->field($model, 'is_hot')->checkbox(); ?> <?php echo $form->field($model, 'is_promote')->checkbox(); ?> <?php echo $form->field($model, 'is_check')->checkbox(); ?> <?php echo $form->field($model, 'status')->dropDownList(ShopProduct::getStatus()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
use common\models\ShopProduct; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\ShopProductSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'Shop Product'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="shop-product-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Shop Product')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'title', ['attribute' => 'relation_game', 'value' => function ($model) { return $model->relationGame ? $model->relationGame->name : null; }], 'description:ntext', ['attribute' => 'category_id', 'value' => function ($model) { return $model->category ? $model->category->title : null; }, 'filter' => \yii\helpers\ArrayHelper::map(\common\models\ShopCategory::find()->all(), 'id', 'title')], 'price', ['label' => Yii::t('common', 'Thumbnail'), 'format' => 'html', 'value' => function ($dataProvider) { return Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $dataProvider->thumbnail_path, 'w' => 100], true), ['class' => 'img-rounded pull-left img-responsive']); }], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'is_on_sale', 'enum' => [Yii::t('common', 'Not'), Yii::t('common', 'Yes')]], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => ShopProduct::getStatus()], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\widgets\DetailView; use common\models\ShopProduct; /* @var $this yii\web\View */ /* @var $model common\models\ShopProduct */ $this->title = $model->title; $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Shop Product'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="shop-product-view"> <p> <?php echo Html::a(Yii::t('backend', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('backend', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('backend', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['title', ['attribute' => 'relation_game', 'value' => $model->relationGame ? $model->relationgame->name : null], 'slug', 'description:ntext', ['attribute' => 'category_id', 'value' => $model->category->title], 'price', 'jifen', 'content:html', 'keywords', 'thumbnail_base_url:url', 'thumbnail_path', 'img_base_url:url', 'img_path', 'product_number', 'return_jifen', ['attribute' => 'is_on_sale', 'value' => $model->is_on_sale == ShopProduct::IS_ON_SALE_UP ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_delete', 'value' => $model->is_delete == ShopProduct::IS_DELETE_YES ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_hot', 'value' => $model->is_hot == ShopProduct::IS_HOT_YES ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_promote', 'value' => $model->is_promote == ShopProduct::IS_PROMOTE_YES ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_check', 'value' => $model->is_check == ShopProduct::IS_CHECK_YES ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => ArrayHelper::getValue(ShopProduct::getStatus(), $model->status)]]]); ?> </div>