$form = ActiveForm::begin(['layout' => 'horizontal']); ?> <?php echo $form->field($model, 'bill_number')->textInput(['disabled' => true]); ?> <?php echo $form->field($model, 'total_amount')->textInput(['maxlength' => true, 'disabled' => true]); ?> <?php echo $form->field($model, 'total_payable')->textInput(['maxlength' => true, 'disabled' => true]); ?> <?php echo $form->field($model, 'status')->dropDownList(Custom::getOrderStatusArray()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'Cancel'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to cancel this order?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['bill_number', ['attribute' => 'member_id', 'value' => $model->member->memberProfiles[0]->name], 'total_amount', 'total_payable', ['attribute' => 'has_due', 'value' => Custom::getYesNoArray()[$model->has_due]], 'created_date', 'updated_date', ['attribute' => 'status', 'value' => Custom::getOrderStatusArray()[$model->status]]]]); ?> </div> <div class="clearfix"></div> <div class="product-order-cart panel panel-default"> <div class="panel-heading"><h3>Ordered Items</h3></div> <div class="panel-body"> <?php if (!empty($model->carts)) { ?>
<div class="product-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Yii::t('app', 'Profile'), ['profile'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'bill_number', 'total_amount', ['attribute' => 'status', 'format' => 'raw', 'value' => function ($model) { return Custom::getOrderStatusArray()[$model->status]; }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {delete}', 'buttons' => ['view' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['title' => Yii::t('app', 'See order details')]); }, 'delete' => function ($url, $model) { if ($model->status != -1) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('app', 'Cancel order')]); } else { return ''; } }], 'urlCreator' => function ($action, $model, $key, $index) { if ($action === 'view') { return Url::to(['order', 'id' => $model->id]); } if ($action === 'delete') { return Url::to(['cancel', 'id' => $model->id]); }