Created
March 20, 2016 09:51
-
-
Save mdmunir/63cb106122d77b138358 to your computer and use it in GitHub Desktop.
Contoh Tabular Input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use yii\helpers\Html; | |
| use yii\widgets\ActiveForm; | |
| use mdm\widgets\GridInput; | |
| /* @var $this yii\web\View */ | |
| /* @var $model app\models\Order */ | |
| /* @var $form yii\widgets\ActiveForm */ | |
| ?> | |
| <div class="order-form"> | |
| <?php $form = ActiveForm::begin(); ?> | |
| <?= $form->field($model, 'date')->widget(\yii\jui\DatePicker::className(),[ | |
| 'dateFormat' => 'yyyy-MM-dd', | |
| 'options'=>['class'=>'form-control'] | |
| ]) ?> | |
| <?= $form->field($model, 'keterangan')->textInput(['maxlength' => true]) ?> | |
| <div class="form-group"> | |
| <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' | |
| : 'btn btn-primary']) | |
| ?> | |
| </div> | |
| <div class="form-group"> | |
| <?= | |
| GridInput::widget([ | |
| 'allModels' => $model->orderItems, | |
| 'model' => \app\models\OrderItem::className(), | |
| 'form' => $form, | |
| 'columns' => [ | |
| ['class' => 'mdm\widgets\SerialColumn'], | |
| 'product', | |
| 'qty', | |
| ['class' => 'mdm\widgets\ButtonColumn'] | |
| ], | |
| 'hiddens'=>[ | |
| 'id' | |
| ] | |
| ]) | |
| ?> | |
| </div> | |
| <?php ActiveForm::end(); ?> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use yii\helpers\Html; | |
| use yii\widgets\DetailView; | |
| use yii\grid\GridView; | |
| /* @var $this yii\web\View */ | |
| /* @var $model app\models\Order */ | |
| $this->title = $model->id; | |
| $this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']]; | |
| $this->params['breadcrumbs'][] = $this->title; | |
| ?> | |
| <div class="order-view"> | |
| <h1><?= Html::encode($this->title) ?></h1> | |
| <p> | |
| <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
| <?= 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> | |
| <?= DetailView::widget([ | |
| 'model' => $model, | |
| 'attributes' => [ | |
| 'id', | |
| 'date', | |
| 'keterangan', | |
| ], | |
| ]) ?> | |
| <?= GridView::widget([ | |
| 'dataProvider'=>new yii\data\ActiveDataProvider([ | |
| 'query'=>$model->getOrderItems(), | |
| 'pagination'=>false | |
| ]), | |
| 'columns'=>[ | |
| 'id', | |
| 'product', | |
| 'qty' | |
| ] | |
| ]) ?> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment