/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Gudang::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(['Gudang_ID' => $this->Gudang_ID]); $query->andFilterWhere(['like', 'Nama', $this->Nama])->andFilterWhere(['like', 'Alamat', $this->Alamat]); return $dataProvider; }
<div class="blok-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'Blok_ID')->textInput(['disabled' => false]); ?> <?php echo $form->field($model, 'Nama')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'Gudang_ID')->dropDownList(ArrayHelper::map(Gudang::find()->all(), 'Gudang_ID', 'Nama'), ['prompt' => 'Select Gudang']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
/** * @return \yii\db\ActiveQuery */ public function getGudang() { return $this->hasOne(Gudang::className(), ['Gudang_ID' => 'Gudang_ID']); }
public function actionGudangdelete($id) { $model = Gudang::findOne($id)->delete(); $this->layout = $this->CheckSession(); return $this->redirect(['warehouse/gudangindex']); }
<?php use yii\helpers\Html; use yii\grid\GridView; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use app\models\warehouse\Gudang; $roleModel = new Gudang(); /* @var $this yii\web\View */ /* @var $searchModel app\models\GudangSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Data Gudang'; $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>