?> <?php $listDataCountry = yii\helpers\ArrayHelper::map(common\models\Country::find()->where(['is_status' => 1])->all(), 'id', 'country'); ?> <?php echo $form->field($model, 'country_id', ['inputOptions' => ['class' => 'form-control']])->dropDownList($listDataCountry, ['prompt' => Yii::t('app', '-- Select Country --'), 'onchange' => ' $.get("' . yii\helpers\Url::toRoute(['dependent/getregion']) . '", { id: $(this).val() }) .done(function(data){ $("#' . Html::getInputId($model, 'region_id') . '").html( data ); });'])->label(false); ?> <?php $listDataRegion = yii\helpers\ArrayHelper::map(common\models\Region::find()->where(['is_status' => 1])->all(), 'id', 'region'); ?> <?php if (isset($model->region_id)) { echo $form->field($model, 'region_id')->dropDownList($listDataRegion, ['prompt' => '-- Select Region --'])->label(false); } else { echo $form->field($model, 'region_id')->dropDownList(['prompt' => Yii::t('app', '--- Select Region ---')])->label(false); } ?> <?php echo $form->field($model, 'city', ['inputOptions' => ['placeholder' => 'City Name', 'class' => 'form-control']])->textInput(['maxlength' => true])->label(false); ?> <?php echo $form->field($model, 'is_status')->dropDownList(['1' => 'Active', '0' => 'Not Active'], ['prompt' => '-- Status --'])->label(false);
<!-- Country --> <?php $listDataCountry = yii\helpers\ArrayHelper::map(common\models\Country::find()->where(['is_status' => 1])->all(), 'id', 'country'); ?> <?php echo $form->field($model, 'country_id', ['inputOptions' => ['class' => 'form-control']])->dropDownList($listDataCountry, ['prompt' => Yii::t('app', '-- Select Country --'), 'onchange' => ' $.get("' . yii\helpers\Url::toRoute(['dependent/getregion']) . '", { id: $(this).val() }) .done(function(data){ $("#' . Html::getInputId($model, 'region_id') . '").html( data ); });']); ?> <!-- Region --> <?php $listDataRegion = yii\helpers\ArrayHelper::map(common\models\Region::find()->all(), 'id', 'region'); ?> <?php echo $form->field($model, 'region_id')->dropDownList($listDataRegion, ['prompt' => '-- Select Region --', 'onchange' => ' $.get("' . yii\helpers\Url::toRoute(['dependent/getcity']) . '", { id: $(this).val() }) .done(function(data){ $("#' . Html::getInputId($model, 'city_id') . '").html( data ); });']); ?> <!-- City --> <?php $listDataCity = \yii\helpers\ArrayHelper::map(\common\models\City::find()->all(), 'id', 'city');
?> </div> </div> <div class="row"> <div class="col-lg-12"> <h3 class="box-title" style="padding-bottom: 20px"> <i class="fa fa-th-list"></i> <?php echo Yii::t('app', 'List City'); ?> </h3> <div class="box view-item"> <div class="box-body"> <div class="city-index"> <?php yii\widgets\Pjax::begin(); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'city', ['attribute' => 'region_id', 'value' => 'region.region', 'filter' => yii\helpers\ArrayHelper::map(common\models\Region::find()->where(['is_status' => 1])->all(), 'id', 'region')], ['attribute' => 'country_id', 'value' => 'country.country', 'filter' => yii\helpers\ArrayHelper::map(common\models\Country::find()->where(['is_status' => 1])->all(), 'id', 'country')], ['attribute' => 'is_status', 'class' => '\\pheme\\grid\\ToggleColumn', 'enableAjax' => false, 'filter' => ['1' => 'Active', '0' => 'Not Active']], ['class' => 'common\\components\\CustomActionColumn']]]); ?> <?php yii\widgets\Pjax::end(); ?> </div> </div> </div> </div> </div>