<th>积分余额</th> </tr> <?php foreach ($models as $item) { ?> <tr> <td><?php echo Yii::$app->formatter->asDate($item->created_at); ?> </td> <td><?php echo $item->point > 0 ? '+' . $item->point : $item->point; ?> </td> <td><?php echo \common\models\PointLog::getTypeLabels($item->type); ?> </td> <td><?php echo $item->remark; ?> </td> <td><?php echo $item->balance; ?> </td> </tr> <?php } ?> </tbody>
<?php use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model common\models\PointLog */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Point Logs'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="point-log-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', ['attribute' => 'user_id', 'value' => $model->user ? $model->user->username : '******'], ['attribute' => 'type', 'value' => \common\models\PointLog::getTypeLabels($model->type)], 'point', 'remark', 'balance', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'created_by', 'value' => $model->createdBy->username], ['attribute' => 'updated_by', 'value' => $model->updatedBy->username]]]); ?> </div>
$this->params['breadcrumbs'][] = $this->title; ?> <div class="point-log-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('app', 'Create ') . Yii::t('app', 'Point Log'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'user_id', 'value' => function ($model) { return $model->user ? $model->user->username : '******'; }], ['attribute' => 'type', 'format' => 'html', 'value' => function ($model) { if ($model->type === PointLog::POINT_TYPE_BOUGHT) { $class = 'label-success'; } elseif ($model->type === PointLog::POINT_TYPE_COMMENT) { $class = 'label-warning'; } else { $class = 'label-danger'; } return '<span class="label ' . $class . '">' . PointLog::getTypeLabels($model->type) . '</span>'; }, 'filter' => Html::activeDropDownList($searchModel, 'type', PointLog::getTypeLabels(), ['class' => 'form-control', 'prompt' => Yii::t('app', 'PROMPT_STATUS')])], 'point', 'remark', 'balance', 'created_at:date', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
/* @var $model common\models\PointLog */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="point-log-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'user_id')->textInput(); ?> <?php echo $form->field($model, 'type')->dropDownList(\common\models\PointLog::getTypeLabels()); ?> <?php echo $form->field($model, 'point')->textInput(); ?> <?php echo $form->field($model, 'remark')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'balance')->textInput(); ?> <div class="form-group">