/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PermitApp::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, 'gender' => $this->gender, 'age' => $this->age, 'province' => $this->province, 'country' => $this->country, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'start_province' => $this->start_province, 'start_border_point' => $this->start_border_point, 'target_province' => $this->target_province, 'out_province' => $this->out_province, 'out_border_point' => $this->out_border_point, 'request_chanel' => $this->request_chanel, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'cretaed_by' => $this->cretaed_by, 'updated_by' => $this->updated_by, 'approve_status' => $this->approve_status, 'approve_by' => $this->approve_by, 'approve_date' => $this->approve_date, 'approve_comment' => $this->approve_comment, 'dlt_office' => $this->dlt_office, 'dlt_br' => $this->dlt_br]); $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'passport', $this->passport])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'telephone', $this->telephone])->andFilterWhere(['like', 'car_enroll_country', $this->car_enroll_country])->andFilterWhere(['like', 'plates_number', $this->plates_number]); return $dataProvider; }
?> <div class="permit-app-form"> <?php $form = ActiveForm::begin(); ?> <div class="row"> <?php echo $form->errorSummary($model); ?> </div> <div class="row"> <div class="col-xs-4"> <?php echo $form->field($model, 'gender')->inline()->radioList(PermitApp::itemAlias('sex')); ?> </div> <div class="col-xs-4"> <label>ชื่อ - นามสกุล</label><?php echo $form->field($model, 'fullname')->textInput(['maxlength' => true])->label(false); ?> </div> <div class="col-xs-4"> <?php echo $form->field($model, 'age')->textInput(); ?> </div> </div> <div class="row"> <div class="col-xs-4">
/** * Finds the PermitApp model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return PermitApp the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = PermitApp::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }