use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel backend\models\master\search\Product */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Products'; $this->params['breadcrumbs'][] = $this->title; ?> <p class="pull-right"> <?php echo Html::a('Create', ['create'], ['class' => 'btn btn-default']); ?> <?php echo Html::a('<i class="fa fa-download"></i>', ['csv-download', 'id' => $searchModel->id, 'params' => $_GET], ['class' => 'btn btn-default', 'title' => 'CSV Download', 'data' => ['method' => 'post']]); ?> </p><br> <div class="product-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'code', 'name', ['header' => 'Product Group', 'attribute' => 'group_id', 'value' => 'group.name', 'format' => 'raw', 'filter' => backend\models\master\ProductGroup::selectOptions()], ['header' => 'Product Category', 'attribute' => 'category_id', 'value' => 'category.name', 'format' => 'raw', 'filter' => \backend\models\master\Category::selectOptions()], ['attribute' => 'status', 'value' => 'nmStatus', 'filter' => $searchModel::enums('STATUS_')], 'edition:date', ['header' => 'stockable', 'class' => 'yii\\grid\\CheckboxColumn', 'checkboxOptions' => function ($model, $key, $index, $column) { return ['value' => $model->id, 'checked' => $model->stockable]; }], 'created_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>
<div class="product-form"> <?php $form = ActiveForm::begin(); ?> <div class="row"> <div class="col-lg-4"> <?php echo $form->field($model, 'code')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> </div> <div class="col-lg-4"> <?php echo $form->field($model, 'group_id')->dropDownList(backend\models\master\ProductGroup::selectOptions(), ['prompt' => '-- select --', 'style' => 'width:60%']); ?> <?php echo $form->field($model, 'category_id')->dropDownList(\backend\models\master\Category::selectOptions(), ['prompt' => '-- select --', 'style' => 'width:60%']); ?> </div> <div class="col-lg-4"> <?php echo $form->field($model, 'Edition')->widget('yii\\jui\\DatePicker', ['dateFormat' => 'dd-MM-yyyy', 'options' => ['class' => 'form-control', 'style' => 'width:40%;']]); ?> <?php echo $form->field($model, 'stockable')->checkbox(); echo $form->field($model, 'status')->dropDownList($model::enums('STATUS_'), ['prompt' => '-- select status--', 'style' => 'width:40%']); ?> </div>