if (Yii::$app->user->can('couponEdit')) { ?> <p> <?php echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]); ?> </p> <?php } ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['Coupon_name', 'Coupon_description', 'expireDatetime', 'requireScore']]); ?> <?php if (\app\models\ParticipantHasCoupon::checkUserHasCoupon($model->id)) { echo Html::a('Taken', ['apply', 'id' => $model->id], ['class' => 'btn btn-warning', 'disabled' => 'disabled']); } else { if (\app\models\User::getScore() < $model->requireScore) { echo Html::a('Not enough score', ['apply', 'id' => $model->id], ['class' => 'btn btn-danger', 'disabled' => 'disabled']); } else { echo Html::a('Get it', ['apply', 'id' => $model->id], ['class' => 'btn btn-success']); } } ?> </div>
</h3> <span>Expire at <?php echo $row['expireDatetime']; ?> </span> </div> <div class="col-sm-3"> <span class="score"><?php echo $row['requireScore']; ?> </span> <span>score to get</span> </div> <div class="col-sm-2 text-center"> <?php if (\app\models\ParticipantHasCoupon::checkUserHasCoupon($row['id'])) { echo Html::a('Taken', ['apply', 'id' => $row['id']], ['class' => 'btn btn-warning', 'disabled' => 'disabled']); } else { if (\app\models\User::getScore() < $row['requireScore']) { echo Html::a('Not enough score', ['apply', 'id' => $row['id']], ['class' => 'btn btn-danger', 'disabled' => 'disabled']); } else { echo Html::a('Get it', ['apply', 'id' => $row['id']], ['class' => 'btn btn-success']); } } ?> </div> </div> <hr> </a> <?php }