<div class="coupon-type-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create ') . Yii::t('app', 'Coupon Type'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'name', 'money', 'min_amount', ['attribute' => 'type', 'format' => 'html', 'value' => function ($model) { return \common\models\CouponType::labels($model->type); }, 'filter' => Html::activeDropDownList($searchModel, 'type', \common\models\CouponType::labels(), ['class' => 'form-control', 'prompt' => Yii::t('app', 'PROMPT_STATUS')])], 'started_at:date', 'ended_at:date', 'created_at:date', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {delete} {car-type}', 'buttons' => ['car-type' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-usd"></span>', $url, ['title' => Yii::t('app', 'Send Coupon')]); }], 'urlCreator' => function ($action, $model, $key, $index) { if ($action === 'view') { return ['view', 'id' => $model->id]; } else { if ($action === 'update') { return ['update', 'id' => $model->id]; } else { if ($action === 'delete') { return ['delete', 'id' => $model->id]; } else { if ($action === 'car-type') { return ['send', 'id' => $model->id]; } }
<?php use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model common\models\CouponType */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Coupon Types'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="coupon-type-view"> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', 'money', 'min_amount', ['attribute' => 'type', 'value' => \common\models\CouponType::labels($model->type)], 'min_goods_amount', 'started_at:datetime', 'ended_at:datetime', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'created_by', 'value' => $model->createdBy->username], ['attribute' => 'updated_by', 'value' => $model->updatedBy->username]]]); ?> </div>
?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 64]); ?> <?php echo $form->field($model, 'money')->textInput(['maxlength' => 10]); ?> <?php echo $form->field($model, 'min_amount')->textInput(['maxlength' => 10]); ?> <?php echo $form->field($model, 'type')->dropDownList(\common\models\CouponType::labels()); ?> <?php echo $form->field($model, 'min_goods_amount')->textInput(['maxlength' => 10]); ?> <div class="form-group field-car-started_at"> <?php echo Html::activeLabel($model, 'started_at', ['class' => 'col-lg-1 control-label']); ?> <div class="col-lg-3"> <?php echo \yii\jui\DatePicker::widget(['model' => $model, 'attribute' => 'started_at', 'dateFormat' => 'yyyy-MM-dd']); ?> </div>