/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = BienesModelos::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id_modelo' => $this->id_modelo, 'id_marca' => $this->id_marca]);
     $query->andFilterWhere(['like', 'descripcion', $this->descripcion]);
     return $dataProvider;
 }
 public function actionMarcas($id_marca)
 {
     echo HtmlHelpers::dropDownList(\app\modules\bienes\models\BienesModelos::className(), 'id_marca', $id_marca, 'id_modelo', 'descripcion');
 }
 /**
  * Finds the BienesModelos model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return BienesModelos the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = BienesModelos::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBienesModelos()
 {
     return $this->hasMany(BienesModelos::className(), ['id_marca' => 'id_marca']);
 }
Beispiel #5
0
                    
                        <?php 
$Marcas = ArrayHelper::map(\app\modules\bienes\models\BienesMarcas::find()->all(), 'id_marca', 'marca');
echo $form->field($model, 'codigo_marca')->dropDownList($Marcas, ['prompt' => 'Porfavor elija una', 'onchange' => '
                        $.get( "' . Url::toRoute('bienes/marcas') . '", { id_marca: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'codigo_modelo') . '" ).html(data);
                            }
                        );
                    ']);
?>
                     </div>
             <div class="col-md-6 column">
             
                        <?php 
$Modelos = ArrayHelper::map(\app\modules\bienes\models\BienesModelos::find()->all(), 'id_modelo', 'descripcion');
echo $form->field($model, 'codigo_modelo')->dropDownList($Modelos, ['prompt' => 'Porfavor elija una']);
?>
                    </div>   </div>
        <?php 
echo $form->field($model, 'ano_fabricacion')->textInput(array('onKeyPress' => 'return soloNumeros(event)', 'maxlength' => '4'));
?>
        
        <div class="main row" style="text-align:center;">
                <div class="col-md-4 column">
          <?php 
echo $form->field($model, 'codigo_color')->widget(Select2::classname(), ['model' => $BienesColor, 'attribute' => 'descripcion', 'data' => Arrayhelper::map($BienesColor::find()->all(), 'id_color', 'descripcion'), 'options' => ['placeholder' => 'Seleccione un Color ...'], 'pluginOptions' => ['allowClear' => true]])->label('Color del Bien');
?>
                           </div>
             <div class="col-md-4 column">
        <?php