/** * Lists all Baseline models. * @return mixed */ public function actionIndex() { /*$searchModel = new BaselineSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);*/ $dataProvider = new ActiveDataProvider(['query' => Baseline::find()->where(['tahun' => Yii::$app->session['tahun'], 'jenis' => Yii::$app->session['upt']])->orderBy('kode ASC'), 'pagination' => ['pageSize' => 20]]); return $this->render('index', ['dataProvider' => $dataProvider]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Baseline::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' => $this->id, 'jenis' => $this->jenis, 'wilayah' => $this->wilayah, 'kode' => $this->kode, 'volume' => $this->volume, 'harga_satuan' => $this->harga_satuan, 'harga_total' => $this->harga_total, 'tahun' => $this->tahun]); $query->andFilterWhere(['like', 'uraian', $this->uraian])->andFilterWhere(['like', 'satuan', $this->satuan]); return $dataProvider; }
} } /* Script condition untuk Dropdown * Form output hanya 1 untuk tiap target * Ketika format form sudah dibuat maka tidak bisa dibuat form lagi */ ?> <script src="jquery-latest.min.js" type="text/javascript"></script> <div class="outputbaseline-form"> <?php $form = ActiveForm::begin(['id' => 'dynamic-form']); ?> <?php echo $form->field($model, 'id_base_line')->dropDownList(ArrayHelper::map(Baseline::find()->where($stringcondition, $arraybaselinesudahselesai)->all(), 'id', 'uraian')); ?> <!-- Data global Form --> <?php DynamicFormWidget::begin(['widgetContainer' => 'dynamicform_wrapper_template', 'widgetBody' => '.container-items-template', 'widgetItem' => '.item-template', 'limit' => 20, 'min' => 0, 'insertButton' => '.add-item-template', 'deleteButton' => '.remove-item-template', 'model' => $template[0], 'formId' => 'dynamic-form', 'formFields' => ['id']]); ?> <div class="panel panel-default"> <div class="panel-heading"> <h4> <i class="glyphicon glyphicon-user"></i> Format tabel <button type="button" class="add-item-template btn btn-primary btn-sm pull-right"><i class="glyphicon glyphicon-plus"></i> Add</button> </h4> </div>