/** * 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, 'region_id' => $this->region_id]); $query->andFilterWhere(['like', 'province_code', $this->province_code])->andFilterWhere(['like', 'province_description', $this->province_description])->andFilterWhere(['like', 'provincecol', $this->provincecol]); return $dataProvider; }
/** * 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->joinWith('country'); $query->andFilterWhere(['province_id' => $this->province_id, 'mi_country.flag_active' => 1]); $query->andFilterWhere(['like', 'country_name', $this->country_id])->andFilterWhere(['like', 'province_name', $this->province_name]); return $dataProvider; }
public function getProvince($id = NULL) { return $id == NULL ? Province::all() : Province::find($id); }
echo $form->field($model, 'experience')->textInput(); ?> </div> </div> <div class="page-header"> <h4>ข้อมูลสำหรับการติดต่อ </h4> </div> <?php echo $form->field($model, 'address')->textInput(); ?> <div class="row"> <div class="col-sm-4 col-md-4"> <?php echo $form->field($model, 'province')->dropdownList(ArrayHelper::map(Province::find()->all(), 'PROVINCE_ID', 'PROVINCE_NAME'), ['id' => 'ddl-province', 'prompt' => 'เลือกจังหวัด']); ?> </div> <div class="col-sm-4 col-md-4"> <?php echo $form->field($model, 'amphur')->widget(DepDrop::classname(), ['options' => ['id' => 'ddl-amphur'], 'data' => $amphur, 'pluginOptions' => ['depends' => ['ddl-province'], 'placeholder' => 'เลือกอำเภอ...', 'url' => Url::to(['/employee/get-amphur'])]]); ?> </div> <div class="col-sm-4 col-md-4"> <?php echo $form->field($model, 'district')->widget(DepDrop::classname(), ['data' => $district, 'pluginOptions' => ['depends' => ['ddl-province', 'ddl-amphur'], 'placeholder' => 'เลือกตำบล...', 'url' => Url::to(['/employee/get-district'])]]); ?> </div> </div>
?> <div class="contact-form"> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'firstname')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'lastname')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'address')->textarea(['rows' => 6]) ?> <div class="form-group"> <?= Html::label('จังหวัด','province');?> <?= Html::dropDownList('province',$province, ArrayHelper::map(Province::find() ->orderBy('province_name ASC') ->all(),'id','province_name'), [ 'class'=>'form-control', 'id'=>'province', 'prompt'=>'-เลือกจังหวัด-', 'onchange'=>' $.get("'.Url::toRoute('base/loaddistrict').'", {id:$(this).val()}) .done(function(data){ $("select#district").html(data); }); ' ] );?>
$form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'city_code')->textInput(['maxlength' => 32]); ?> <?php echo $form->field($model, 'city_description')->textInput(['maxlength' => 32]); ?> <?php echo $form->field($model, 'citycol')->textInput(['maxlength' => 45]); ?> <?php echo $form->field($model, 'province_id')->dropdownList(ArrayHelper::map(Province::find()->all(), 'id', 'province_description'), ['prompt' => 'Choose a province']); ?> <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>
<div class="form-group"> <label class="col-sm-3 control-label">Country</label> <div class="col-sm-6"> <?php echo $form->field($model, 'country_id')->label(false)->dropDownList(ArrayHelper::map(Country::find()->all(), 'country_id', 'country_name'), ['prompt' => 'Select Country Name', 'class' => 'form-control']); ?> </div> </div><!--/form-group--> <div class="form-group"> <label class="col-sm-3 control-label">Province</label> <div class="col-sm-6"> <?php echo $form->field($model, 'province_id')->label(false)->dropDownList(ArrayHelper::map(Province::find()->all(), 'province_id', 'province_name'), ['prompt' => 'Select Province Name', 'class' => 'form-control']); ?> </div> </div><!--/form-group--> <div class="form-group"> <label class="col-sm-3 control-label">Customer</label> <div class="col-sm-6"> <?php echo $form->field($model, 'customer_id')->label(false)->dropDownList(ArrayHelper::map(Customer::find()->all(), 'customer_id', 'first_name'), ['prompt' => 'Select Customer Name', 'class' => 'form-control']); ?> </div> </div><!--/form-group--> <div class="form-group">