Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Mtcountries::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(['country_id' => $this->country_id, 'country_created' => $this->country_created, 'country_updated' => $this->country_updated, 'country_status' => 'ACTIVE']);
     $query->andFilterWhere(['like', 'country_name', $this->country_name])->andFilterWhere(['like', 'country_status', $this->country_status]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProvinceCountry()
 {
     return $this->hasOne(Mtcountries::className(), ['country_id' => 'province_country_id']);
 }
Exemplo n.º 3
0
use yii\helpers\ArrayHelper;
use yii\widgets\ActiveForm;
use common\models\Mtcountries;
use common\models\Mtprovinces;
?>

<?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => '{label}<div class="col-sm-10">{input}<div class="help-block">{error}</div></div>', 'labelOptions' => ['class' => 'col-sm-2 control-label']]]);
?>
<div class="box-body mt-cities-create">
		<?php 
echo $form->errorSummary($model);
?>
		
		<?php 
echo $form->field($model, 'city_country_id')->dropDownList(ArrayHelper::map(Mtcountries::find()->all(), 'country_id', 'country_name'), ['prompt' => 'Select Country', 'onchange' => '$.post("/admin/configurations/regional/provinces/list?id=' . '"+$(this).val(),function(data){
						$("select#mtcities-city_province_id").html(data);
					});'])->label('Country');
?>
    <?php 
echo $form->field($model, 'city_province_id')->dropDownList(ArrayHelper::map(Mtprovinces::find()->all(), 'province_id', 'province_name'), ['prompt' => 'Select Province'])->label('Province');
?>
    <?php 
echo $form->field($model, 'city_name')->textInput(['maxlength' => true]);
?>

    <div class="box-footer">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success pull-right' : 'btn btn-primary pull-right']);
?>
        <?php 
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCityCountry()
 {
     return $this->hasOne(Mtcountries::className(), ['country_id' => 'city_country_id']);
 }
Exemplo n.º 5
0
use yii\widgets\ActiveForm;
use common\models\Mtcountries;
/* @var $this yii\web\View */
/* @var $model common\models\Mtprovinces */
/* @var $form yii\widgets\ActiveForm */
?>

<?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => '{label}<div class="col-sm-10">{input}<div class="help-block">{error}</div></div>', 'labelOptions' => ['class' => 'col-sm-2 control-label']]]);
?>
<div class="box-body mt-countries-create">
		<?php 
echo $form->errorSummary($model);
?>
    <?php 
echo $form->field($model, 'province_country_id')->dropDownList(ArrayHelper::map(Mtcountries::find()->all(), 'country_id', 'country_name'), ['prompt' => 'Select Country'])->label('Country');
?>
    <?php 
echo $form->field($model, 'province_name')->textInput(['maxlength' => true]);
?>
	  <?php 
//echo $form->field($model, 'province_status')->dropDownList([ 'ACTIVE' => 'ACTIVE', 'INACTIVE' => 'INACTIVE', ], ['prompt' => 'Status'])->label('Status')
?>

    <div class="box-footer">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success pull-right' : 'btn btn-primary pull-right']);
?>
        <?php 
echo Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']);
?>
Exemplo n.º 6
0
 protected function findModel($id)
 {
     if (($model = Mtcountries::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }