Example #1
0
 public function search($params)
 {
     $query = UomModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_uom' => $this->id_uom, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_uom', $this->cd_uom])->andFilterWhere(['like', 'nm_uom', $this->nm_uom])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdUom()
 {
     return $this->hasOne(Uom::className(), ['id_uom' => 'id_uom']);
 }
Example #3
0
$form = ActiveForm::begin();
?>
    <div class="panel panel-primary">
        <div class="panel-heading">Product Uoms</div>
        <div class="panel-body">
            <?php 
$id_input = Html::getInputId($model, 'id_product');
$field = $form->field($model, 'id_product', ['template' => "{label}\n{input}\n{text}\n{hint}\n{error}"]);
$field->labelOptions['for'] = $id_input;
$field->input('hidden', ['id' => 'id_product']);
$field->parts['{text}'] = AutoComplete::widget(['model' => $model, 'attribute' => 'idProduct[nm_product]', 'options' => ['class' => 'form-control', 'id' => $id_input], 'clientOptions' => ['source' => Url::toRoute(['product/auto-product']), 'select' => new JsExpression('function(event,ui){$(\'#id_product\').val(ui.item.did)}'), 'open' => new JsExpression('function(event,ui){$(\'#id_product\').val(\'\')}')]]);
echo $field;
?>

            <?php 
echo $form->field($model, 'id_uom')->dropDownList(ArrayHelper::map(Uom::find()->all(), 'id_uom', 'nm_uom'), ['style' => 'width:200px;']);
?>

            <?php 
echo $form->field($model, 'isi')->textInput();
?>
        </div>
    </div>



    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
 /**
  * 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.');
     }
 }