/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = JenisBarang::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(['Jenis_Barang_ID' => $this->Jenis_Barang_ID]); $query->andFilterWhere(['like', 'Nama', $this->Nama]); return $dataProvider; }
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'Kode_Barang')->textInput(['disabled' => false]); ?> <?php echo $form->field($model, 'Nama_Barang')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'Jenis_Barang')->dropDownList(ArrayHelper::map(JenisBarang::find()->all(), 'Jenis_Barang_ID', 'Nama'), ['prompt' => 'Select Jenis Barang']); ?> <?php echo $form->field($model, 'Kemasan_ID')->dropDownList(ArrayHelper::map(Kemasan::find()->all(), 'Kemasan_ID', 'Qty', 'Nama'), ['prompt' => 'Select Kemasan']); ?> <?php echo $form->field($model, 'Blok_ID')->dropDownList(ArrayHelper::map(Blok::find()->all(), 'Blok_ID', 'Nama'), ['prompt' => 'Select Blok']); ?> <?php echo $form->field($model, 'Kadaluarsa')->textInput(['maxlength' => 255, 'class' => 'form-control input-datepicker class'])->label('Kadaluarsa'); ?> <?php