/** * Show the form for editing the specified itemcategory. * * @param int $id * @return Response */ public function edit($id) { $itemcategory = Itemcategory::find($id); return View::make('itemcategories.edit', compact('itemcategory')); }
<?php echo app\widgets\GridView::widget(array('id' => 'item-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'ajaxUpdate' => TRUE, 'ajaxType' => 'POST', 'columns' => array('id', 'name', array('name' => 'category_id', 'filter' => \yii\helpers\ArrayHelper::map(Itemcategory::find()->All(), 'id', 'name'), 'value' => 'isset($data->Category)?$data->Category->name:0'), 'parent_item_id', 'isProduct', 'saleprice', array('class' => 'yii\\grid\\ActionColumn')))); ?>
<?php $form = kartik\form\ActiveForm::begin(array('id' => 'item-template-form', 'enableAjaxValidation' => false)); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->field($model, 'name', array('class' => 'span5', 'maxlength' => 255)); ?> <?php $models = Itemcategory::find()->All(); $list = \yii\helpers\ArrayHelper::map($models, 'id', 'name'); $options = array("class" => 'span5', 'id' => ucfirst($this->id) . '_Itemcategory_id'); $select = \yii\helpers\Html::dropDownList(ucfirst($this->id) . '[Itemcategory_id]', 0, $list, $options); ?> <label for="ItemTemplate_Itemcategory_id" class="required">Item Category <span class="required">*</span></label> <?php echo $select; ?> <?php //echo $form->field($model,'AccType_id',array('class'=>'span5')); if (isset($items)) { $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('app', 'Add new'), 'type' => 'success', 'options' => array('onclick' => '$("#addnew").dialog("open"); return false;'))); echo app\widgets\GridView::widget(array('id' => 'acc-templateItem-grid', 'dataProvider' => $items->search(), 'filter' => $items, 'columns' => array(array('name' => 'eavFields_id', 'value' => '$data->EavFields->name'), array('class' => 'yii\\grid\\ActionColumn', 'template' => '{remove}', 'buttons' => array('remove' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'url' => '$data->id', 'options' => array('onclick' => 'deleteTempItm(this);return false;'))))))); } ?>