public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Itemcategory::create([]);
     }
 }
Esempio n. 2
0
<?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'))));
?>





Esempio n. 3
0
 /**
  * Remove the specified itemcategory from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Itemcategory::destroy($id);
     return Redirect::route('itemcategories.index');
 }
Esempio n. 4
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     //$model->setEavAttributes(array('attribute1' => 'value1', 'attribute2' => 'value2'));
     if (isset($_POST['Item'])) {
         $model->attributes = $_POST['Item'];
         $model->deleteEavAttributes();
         if (isset($_POST['ItemeavE']) && isset($_POST['ItemeavE'])) {
             $model->setEavAttributes(array_combine($_POST['ItemeavE'], $_POST['ItemeavV']));
             ////saveEavAttributes
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $cat = CHtml::listData(Itemcategory::model()->findAll(), 'id', 'name');
     $units = CHtml::listData(Itemunit::model()->findAll(), 'id', 'name');
     $this->render('update', array('model' => $model, 'cat' => $cat, 'units' => $units));
 }
Esempio n. 5
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Itemcategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 6
0
 /**
  * Show the form for editing the specified item.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $item = Item::find($id);
     $itemcategories = Itemcategory::all();
     return View::make('items.edit', compact('item', 'itemcategories'));
 }
Esempio n. 7
0
<?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;')))))));
}
?>
Esempio n. 8
0
<?php

$this->widget('EExcelView', array('id' => 'item-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'ajaxUpdate' => TRUE, 'ajaxType' => 'POST', 'columns' => array('id', 'name', array('name' => 'category_id', 'filter' => CHtml::listData(Itemcategory::model()->findAll(), 'id', 'name'), 'value' => 'isset($data->Category)?$data->Category->name:0'), 'parent_item_id', 'isProduct', 'saleprice', array('class' => 'bootstrap.widgets.TbButtonColumn'))));
?>





Esempio n. 9
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'item-template-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
?>

	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 255));
?>

        <?php 
$models = Itemcategory::model()->findAll(array('order' => 'name'));
$list = CHtml::listData($models, 'id', 'name');
$htmlOptions = array("class" => 'span5', 'id' => ucfirst($this->id) . '_Itemcategory_id');
$select = CHtml::dropDownList(ucfirst($this->id) . '[Itemcategory_id]', 0, $list, $htmlOptions);
?>
            <label for="ItemTemplate_Itemcategory_id" class="required">Item Category <span class="required">*</span></label>
        <?php 
echo $select;
?>
            <?php 
//echo $form->textFieldRow($model,'AccType_id',array('class'=>'span5'));
if (isset($items)) {
    $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('app', 'Add new'), 'type' => 'primary', 'htmlOptions' => array('onclick' => '$("#addnew").dialog("open"); return false;')));
    $this->widget('EExcelView', array('id' => 'acc-templateItem-grid', 'dataProvider' => $items->search(), 'filter' => $items, 'columns' => array(array('name' => 'eavFields_id', 'value' => '$data->EavFields->name'), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{remove}', 'buttons' => array('remove' => array('label' => '<i class="glyphicon glyphicon-remove"></i>', 'url' => '$data->id', 'options' => array('onclick' => 'deleteTempItm(this);return false;')))))));
}
?>