</li> <li class="list-group-item clearfix"> <div class="label-wrapper border-right"> <label for=""><?php echo $model->attributeLabels()['status']; ?> </label> </div> <div style="padding-bottom: 5px; padding-top: 6px;" class="info-wrapper"> <button class="btn btn-<?php echo !$model->status ? 'danger' : 'success'; ?> " type="button"> <?php echo common\helpers\Custom::getStatusArray()[$model->status]; ?> </button> </div> </li> </ul> <div class="clearfix"></div> </div> </div> </div> </div>
use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Orders'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="order-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php // echo Html::a(Yii::t('app', 'Create Order'), ['create'], ['class' => 'btn btn-success']) ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'bill_number', ['attribute' => 'member.memberProfiles.name', 'value' => function ($model) { return $model->member->memberProfiles[0]->name; }], 'total_amount', 'total_payable', ['attribute' => 'order_status', 'value' => function ($model) { return common\helpers\Custom::getOrderStatusArray()[$model->status]; }], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
<div class="product-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('app', 'Create Product'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'display_name', 'name', 'purchase_price', 'selling_price', ['attribute' => 'in_home_slider', 'format' => 'raw', 'value' => function ($model) { $btn_class = $model->in_home_slider ? 'success' : 'danger'; $yes_no = common\helpers\Custom::getYesNoArray()[$model->in_home_slider]; return "<button class=\"btn btn-{$btn_class}\" type=\"button\">{$yes_no}</button>"; }], ['attribute' => 'top_rated', 'format' => 'raw', 'value' => function ($model) { $btn_class = $model->top_rated ? 'success' : 'danger'; $yes_no = common\helpers\Custom::getYesNoArray()[$model->top_rated]; return "<button class=\"btn btn-{$btn_class}\" type=\"button\">{$yes_no}</button>"; }], ['attribute' => 'is_private', 'format' => 'raw', 'value' => function ($model) { $btn_class = !$model->is_private ? 'success' : 'danger'; $yes_no = common\helpers\Custom::getYesNoArray()[$model->is_private]; return "<button class=\"btn btn-{$btn_class}\" type=\"button\">{$yes_no}</button>"; }], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>