
		<div class="clearfix"><!-- --></div>
	  	  <div class=" ">
		<div class="form-group col-lg-12 margin-top-15">
		<?php echo $form->labelEx($model, 'amenities');?>
		<div class="container34">
		<?php
		$amenities_array=	 CHtml::listData(Amenities::model()->ListData2(),'amenities_id','amenities_name');

		echo CHtml::checkBoxList('amenities',$model->amenities ,$amenities_array);                                              
		?>
		</div>
		<?php echo $form->error($model, 'amenities');?>
		</div>    
		<div class="clearfix"><!-- --></div>    
        <?php
        if(defined('OFFPLAN')){
        ?>
        <div class="form-group col-lg-12">
		<?php echo $form->labelEx($model, 'state');?>
		<?php $mer =  array_merge($model->getHtmlOptions('state'),array('empty'=>$this->tag->gettag('select_area',"Select City"),'class'=>'form-control selectt2','onchange'=>'loadcity2(this)')); ?>
		<?php echo $form->dropDownList($model, 'state', CHtml::listData(States::model()->getStateWithCountry_2('65946'),'state_id','state_name') , $mer ); ?>
		<?php echo $form->error($model, 'state');?>
		</div> 
        <?php
        }else{
         echo $form->hiddenField($model, 'state', $model->getHtmlOptions('state'));  
        }
        ?>
        
		<div class="clearfix"><!-- --></div> 
		   
		<div class="form-group col-lg-12">
		<?php echo $form->labelEx($model, 'city');?>
		<?php $mer =  array_merge($model->getHtmlOptions('city'),array('empty'=>$this->tag->gettag('select_area',"Select Area"),'class'=>'form-control selectt2','onchange'=>'loadComunities(this)')); ?>
		<?php echo $form->dropDownList($model, 'city', CHtml::listData(City::model()->ListDataForJSONParent($model->state,false),'city_id','city_name') , $mer ); ?>
		<?php echo $form->error($model, 'city');?>
		</div> 
			<div class="clearfix"><!-- --></div> 
			<?php
			 $parent = empty($model->city) ? 'A' : $model->city; 
        $parent2 = empty($model->city_2) ? 'A' : $model->city_2; 
	 $parent3 = empty($model->city_3) ? 'A' : $model->city_3; 
	 $parent_data = CHtml::listData(City::model()->ListDataForJSONParent('',false,$parent),'city_id','city_name');
	 $parent_data2 = CHtml::listData(City::model()->ListDataForJSONParent('',false,$parent2),'city_id','city_name') ;
	  $parent_data3 = CHtml::listData(City::model()->ListDataForJSONParent('',false,$parent3),'city_id','city_name') ;
 
	?>
		<div class="form-group col-lg-12 <?php echo  empty($parent_data) ? 'hide' : '';?>" id="p1">
		<?php echo $form->labelEx($model, 'city_2');
		
       	?>
		<?php $mer =  array_merge($model->getHtmlOptions('city_2'),array('empty'=>$this->tag->gettag('please_select',"Please Select"),'class'=>'form-control selectt2','onchange'=>'loadComunities2(this)')); ?>
		<?php echo $form->dropDownList($model, 'city_2', $parent_data, $mer ); ?>
		<?php echo $form->error($model, 'city_2');?>
		</div> 
			<div class="clearfix"><!-- --></div> 
		<div class="form-group col-lg-12 <?php echo  empty($parent_data2) ? 'hide' : '';?>"  id="p2">
		<?php echo $form->labelEx($model, 'city_3');?>
		<?php $mer =  array_merge($model->getHtmlOptions('city_3'),array('empty'=>$this->tag->gettag('please_select',"Please Select"),'class'=>'form-control selectt2','onchange'=>'loadComunities3(this)')); ?>
		<?php echo $form->dropDownList($model, 'city_3',$parent_data2 , $mer ); ?>
		<?php echo $form->error($model, 'city_3');?>
		</div> 
			<div class="clearfix"><!-- --></div>
					<div class="clearfix"><!-- --></div> 
		<div class="form-group col-lg-12 <?php echo  empty($parent_data3) ? 'hide' : '';?>"  id="p3">
		<?php echo $form->labelEx($model, 'city_4');?>
		<?php $mer =  array_merge($model->getHtmlOptions('city_4'),array('empty'=>$this->tag->gettag('please_select',"Please Select"),'class'=>'form-control selectt2')); ?>
		<?php echo $form->dropDownList($model, 'city_4',$parent_data3 , $mer ); ?>
		<?php echo $form->error($model, 'city_4');?>
		</div> 
			<div class="clearfix"><!-- --></div>
 </div> 	<div class="clearfix"><!-- --></div>
 <script>
 function loadcity2(k){
          $('#<?php echo $model->modelName;?>_city').val('').change();
          $('#<?php echo $model->modelName;?>_city').html('<option value="">Loading..</option>');
         $('#<?php echo $model->modelName;?>_city').select2();
      
         $.get('<?php echo Yii::app()->createUrl('ajax/load_city_parent');?>', {'state_id':$(k).val()},function(data){
            
            $('#<?php echo $model->modelName;?>_city').html(data);
            $('#<?php echo $model->modelName;?>_city').select2();
         })
     }
     function loadComunities(k){
         $('#p1').addClass('hide');
         $('#p2').addClass('hide');
         $('#p3').addClass('hide');
         $('#<?php echo $model->modelName;?>_city_2').html('<option value="">Loading..</option>');
         $('#<?php echo $model->modelName;?>_city_4').html('<option value="">Loading..</option>');
         $('#<?php echo $model->modelName;?>_city_2').select2();
          $('#<?php echo $model->modelName;?>_city_3').html('<option value="">Loading..</option>');
         $('#<?php echo $model->modelName;?>_city_3').select2();
      
         $.get('<?php echo Yii::app()->createUrl('ajax/load_city1');?>', {'parent_id':$(k).val()},function(data){
             if(data !=''){  $('#p1').removeClass('hide');}
            $('#<?php echo $model->modelName;?>_city_2').html(data);
            $('#<?php echo $model->modelName;?>_city_2').select2();
         })
     }
      function loadComunities2(k){
  ;
         $('#p2').addClass('hide');$('#p3').addClass('hide');
         $('#<?php echo $model->modelName;?>_city_3').html('<option value="">Loading..</option>');
          $('#<?php echo $model->modelName;?>_city_4').html('<option value="">Loading..</option>');
         $('#<?php echo $model->modelName;?>_city_3').select2();
         $.get('<?php echo Yii::app()->createUrl('ajax/load_city1');?>', {'parent_id':$(k).val()},function(data){
             if(data !=''){  $('#p2').removeClass('hide');}
            $('#<?php echo $model->modelName;?>_city_3').html(data);
            $('#<?php echo $model->modelName;?>_city_3').select2();
         })
     }
      function loadComunities3(k){
  ;
         $('#p3').addClass('hide');
         $('#<?php echo $model->modelName;?>_city_4').html('<option value="">Loading..</option>');
         $('#<?php echo $model->modelName;?>_city_4').select2();
         $.get('<?php echo Yii::app()->createUrl('ajax/load_city1');?>', {'parent_id':$(k).val()},function(data){
             if(data !=''){  $('#p3').removeClass('hide');}
            $('#<?php echo $model->modelName;?>_city_4').html(data);
            $('#<?php echo $model->modelName;?>_city_4').select2();
         })
     }
 </script>
