/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Province::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]); $query->andFilterWhere(['like', 'PRV_CODE', $this->PRV_CODE])->andFilterWhere(['like', 'PRV_DESC', $this->PRV_DESC])->andFilterWhere(['like', 'PRV_ABREV', $this->PRV_ABREV])->andFilterWhere(['like', 'PRV_ENG_DESC', $this->PRV_ENG_DESC])->andFilterWhere(['like', 'PRV_ABREV_ENG', $this->PRV_ABREV_ENG])->andFilterWhere(['like', 'UPD_USER_CODE', $this->UPD_USER_CODE])->andFilterWhere(['like', 'LAST_UPD_DATE', $this->LAST_UPD_DATE])->andFilterWhere(['like', 'CREATE_USER_CODE', $this->CREATE_USER_CODE])->andFilterWhere(['like', 'CREATE_DATE', $this->CREATE_DATE])->andFilterWhere(['like', 'REGION_CODE', $this->REGION_CODE])->andFilterWhere(['like', 'OLD_REGION_CODE', $this->OLD_REGION_CODE])->andFilterWhere(['like', 'TRS_JOB_CODE', $this->TRS_JOB_CODE])->andFilterWhere(['like', 'PRV_CODE_INSURE', $this->PRV_CODE_INSURE]); return $dataProvider; }
public function getProvince() { return @$this->hasOne(Province::className(), ['PRV_CODE' => 'off_code']); }
use backend\modules\configuration\models\Province; use kartik\widgets\Select2; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model backend\modules\configuration\models\BorderCheckpoint */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="border-checkpoint-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'border_province')->widget(Select2::classname(), ['data' => ArrayHelper::map(Province::find()->where(['BOR_FLAG' => 1])->all(), 'PRV_CODE', 'PRV_DESC'), 'options' => ['placeholder' => ' ด่านจังหวัด ...', 'id' => 'ddl-cat'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'border_thai')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'border_other')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'border_land')->textInput(['maxlength' => true]); ?> <div class="form-group">
/** * Finds the Province model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Province the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Province::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getTargetProvince() { return @$this->hasOne(Province::className(), ['PRV_CODE' => 'target_province']); }
echo Html::a('<i class="fa fa-plus-square"></i> Create New', ['/configuration/customs/create']); ?> </span> </div><!-- /.info-box-content --> </div><!-- /.info-box --> </div> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="edusec-link-box"> <span class="edusec-link-box-icon bg-light-blue-active"><i class="glyphicon glyphicon-list-alt"></i></span> <div class="edusec-link-box-content"> <span class="edusec-link-box-text"><?php echo Html::a('จังหวัด', ['/configuration/province']); ?> </span> <span class="edusec-link-box-number"><?php echo Province::find()->count(); ?> </span> <span class="edusec-link-box-desc"></span> <span class="edusec-link-box-bottom"><?php echo Html::a('<i class="fa fa-plus-square"></i> Create New', ['/state/create']); ?> </span> </div><!-- /.info-box-content --> </div><!-- /.info-box --> </div> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="edusec-link-box"> <span class="edusec-link-box-icon bg-light-blue-active"><i class="fa fa-building-o"></i></span> <div class="edusec-link-box-content"> <span class="edusec-link-box-text"><?php
<div class="border-checkpoint-index"> <div class="col-xs-12" style="padding-top: 10px;"> <div class="box"> <div class="box-header"> <p> <?php echo Html::a('เพิ่ม ด่านพรมแดน', ['create'], ['class' => 'btn btn-success pull-right']); ?> </p> </div><!-- /.box-header --> <div class="box-body table-responsive"> <div class="state-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'border_province', 'header' => 'ด่านจังหวัด', 'width' => '250px', 'value' => function ($model, $key, $index, $widget) { return $model->province->PRV_DESC; }, 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(Province::find()->where(['BOR_FLAG' => 1])->orderBy('PRV_DESC')->asArray()->all(), 'PRV_CODE', 'PRV_DESC'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'กรองตามจังหวัด'], 'group' => true], 'border_thai', 'border_other', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div> </div> </div> </div> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> </div>
public function getProvince() { return $this->hasOne(Province::className(), ['PRV_CODE' => 'border_province']); }