/** * 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; }
/** * @return \yii\db\ActiveQuery */ public function getJenisBarang() { return $this->hasOne(JenisBarang::className(), ['Jenis_Barang_ID' => 'Jenis_Barang']); }
<?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
<?php use yii\helpers\Html; use yii\grid\GridView; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use app\models\warehouse\JenisBarang; $roleModel = new JenisBarang(); /* @var $this yii\web\View */ /* @var $searchModel app\models\JenisBarangSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Data Jenis Barang'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="side"> <div class="sub-sidebar-wrapper"> <ul class="nav"> <?php echo Nav::widget(['items' => [['label' => 'Barang', 'url' => ['/warehouse/barangindex']], ['label' => 'Kemasan', 'url' => ['/warehouse/kemasanindex']], ['label' => 'Jenis Barang', 'url' => ['/warehouse/jenisbarangindex']], ['label' => 'Gudang', 'url' => ['/warehouse/gudangindex']], ['label' => 'Blok', 'url' => ['/warehouse/blokindex']], ['label' => 'Distributor', 'url' => ['warehouse/distributorindex']]]]); ?> </ul> </div> </div> <div class="col-md-12"> <div class="widget widget-green"> <div class="widget-title"> <div class="widget-controls"> <a href="#" class="widget-control widget-control-full-screen" data-toggle="tooltip" data-placement="top" title="" data-original-title="Full Screen"><i class="fa fa-expand"></i></a> <a href="#" class="widget-control widget-control-full-screen widget-control-show-when-full" data-toggle="tooltip" data-placement="left" title="" data-original-title="Exit Full Screen"><i class="fa fa-expand"></i></a> <a href="#" class="widget-control widget-control-refresh" data-toggle="tooltip" data-placement="top" title="" data-original-title="Refresh"><i class="fa fa-refresh"></i></a> <a href="#" class="widget-control widget-control-minimize" data-toggle="tooltip" data-placement="top" title="" data-original-title="Minimize"><i class="fa fa-minus-circle"></i></a>
public function actionJenisbarangdelete($id) { $model = JenisBarang::findOne($id)->delete(); $this->layout = $this->CheckSession(); return $this->redirect(['warehouse/jenisbarangindex']); }