Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UomModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUom()
 {
     return $this->hasOne(Uom::className(), ['id' => 'uom_id']);
 }
Example #3
0
 /**
  * Finds the Uom model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Uom the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Uom::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
use backend\models\master\Uom;
/* @var $this yii\web\View */
?>
<td >
    <span class="serial"></span>
    <a data-action="delete" title="Delete" href="#"><span class="glyphicon glyphicon-trash"></span></a>
        <?php 
echo Html::activeHiddenInput($model, "[{$key}]product_id", ['data-field' => 'product_id', 'id' => false]);
?>
</td>
<td>
    <span data-field="product"><?php 
echo Html::getAttributeValue($model, "[{$key}]product[name]");
?>
</span>
</td>
<td >
    <?php 
echo Html::activeTextInput($model, "[{$key}]qty", ['class' => 'form-control', 'data-field' => 'qty', 'size' => 5, 'id' => false, 'required' => true]);
?>
</td>
<td >
    <?php 
echo Html::activeTextInput($model, "[{$key}]price", ['class' => 'form-control', 'data-field' => 'price', 'size' => 9, 'id' => false, 'required' => true]);
?>
</td>
<td>
    <?php 
echo Html::activeDropDownList($model, "[{$key}]uom_id", Uom::selectOptions(), ['class' => 'form-control', 'data-field' => 'uom_id', 'id' => false]);
?>
</td>
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUoms()
 {
     return $this->hasMany(Uom::className(), ['id' => 'uom_id'])->viaTable('product_uom', ['product_id' => 'id']);
 }
Example #6
0
 */
?>
<div id="uom_record" class="pull-right" style="width: 40%; height: 180px; margin: 10px; padding: 10px; background-color: whitesmoke; overflow-y: scroll;">Update Logs:</div>
<table id="uomTable" class="table table-hover no-padding" style="width: 50%;">
    <thead>
        <tr>
            <th style="width: 10%;">No</th>
            <th style="width: 30%;">Uom Code</th>
            <th>Isi</th>
            <th style="text-align:center;">Action</th>
        </tr>
        <tr>
            <td>#</td>
            <td>
                <?php 
echo \yii\helpers\Html::dropDownList('id_uom', '', \backend\models\master\Uom::selectOptions(), ['prompt' => '-- Uoms --', 'class' => 'form-control uom']);
?>
            </td>
            <td>
                <?php 
echo \yii\helpers\Html::textInput('isi', '', ['class' => 'form-control isi']);
?>
            </td>
            <td style="text-align:center;">
                <?php 
echo \yii\helpers\Html::a('<i class="fa fa-plus"></i>', '#', ['class' => 'btn btn-default text-green', 'id' => 'uom_add']);
?>
            </td>
        </tr>
    </thead>
    <tbody>