<meta charset="UTF-8"> 
<style>.select2-container .select2-selection--single{ height:36px; }.select2-container--default .select2-selection--single .select2-selection__rendered { line-height:35px; } </style>
<?php  defined('MW_PATH') || exit('No direct script access allowed');  
$hooks->doAction('before_view_file_content', $viewCollection = new CAttributeCollection(array(
    'controller'    => $this,
    'renderContent' => true,
)));

// and render if allowed
if ($viewCollection->renderContent) {
    /**
     * This hook gives a chance to prepend content before the active form or to replace the default active form entirely.
     * Please note that from inside the action callback you can access all the controller view variables 
     * via {@CAttributeCollection $collection->controller->data}
     * In case the form is replaced, make sure to set {@CAttributeCollection $collection->renderForm} to false 
     * in order to stop rendering the default content.
     * @since 1.3.3.1
     */
    $hooks->doAction('before_active_form', $collection = new CAttributeCollection(array(
        'controller'    => $this,
        'renderForm'    => true,
    )));
    
    // and render if allowed
    if ($collection->renderForm) {
		if(Yii::app()->isAppNAme('backend')){
			  $form = $this->beginWidget('CActiveForm',array('focus'=>array($model,Yii::app()->controller->focus),));
		}else{
        $form = $this->beginWidget('CActiveForm',array('focus'=>array($model,Yii::app()->controller->focus),
        	'enableAjaxValidation'=>true,
			'clientOptions' => array(
			'validateOnSubmit'=>true, 

			),
        )); 
		}
        ?>
        
        <div class="box box-primary">
            <div class="box-header">
                <div class="pull-left">
                    <h3 class="box-title"><span class="glyphicon glyphicon-star"></span> <?php echo $pageHeading;?></h3>
                </div>
                 
                <div class="clearfix"><!-- --></div>
            </div>
            <div class="box-body">
                <?php 
                /**
                 * This hook gives a chance to prepend content before the active form fields.
                 * Please note that from inside the action callback you can access all the controller view variables 
                 * via {@CAttributeCollection $collection->controller->data}
                 * @since 1.3.3.1
                 */
                $hooks->doAction('before_active_form_fields', new CAttributeCollection(array(
                    'controller'    => $this,
                    'form'          => $form    
                )));
                ?>
          
                  <style>
            a.section-box {
    display: inline-block;
    text-align: center !important;
    color: #FFF;
    border-radius: 3px;
    width: 132px;
    height: 132px;
    margin-bottom: 1.5em;
    padding: 0;
    background-color: #f1f1f1;
    text-decoration: none;
    float:left;
    margin-right:15px;
}
a.section-box span {
    font-size: 3.125em;
    line-height: 1.2em;
    margin: .75em 0 0;
    display: block;
}
a.section-box h3 {
    color: #FFF;
}
.section-box h3 {
    font-size: 12px;
    color: #7b8385;
    font-weight: 400;
    margin-bottom: 4em;
}
#tax-categories {
    text-align: center !important;
    margin-top: .75em;
    vertical-align: middle;
}
#tax-categories ul {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
#tax-categories ul li a {
    -moz-transition-property: all;
    -webkit-transition-property: all;
    display: inline-block;
}
#tax-categories ul.sale a {
    background-color: #30a3d8;
}
#tax-categories ul li a {
    width: 134px;
    height: 72px;
    border-radius: 3px;
    margin: 0 1.5em 1.5em 0;
    float: left;
    padding: 0 10px;
    line-height: 72px;
    transition-property: all;
    transition-duration: .2s;
}
#tax-categories ul li a span {
    display: inline-block;
    text-decoration: none;
    letter-spacing: .05em;
    color: #FFF;
    width: 100%;
    margin: 0;
    vertical-align: middle;
    line-height: 1;
    padding-top: 2px;
    word-wrap: break-word;
}
breadcrumbs-container li::before {
    display: inline-block;
}

 
 
#tax-breadcrumbs-container li .breadcrumb {

    margin: .75em 0 !important;;

}
#tax-breadcrumbs-container li .breadcrumb span {  color: red; text-indent:5px;  } 
#tax-breadcrumbs-container li .breadcrumb {

    text-decoration: none;
    color: #424648;
    background-color: #e8e6e4;
    font-size: 1.125em;
    line-height: 1.33333em;
    padding: .28125em .5em  .28125em;
    margin:   0 !important; ;
    transition-property: all;
    transition-duration: .2s;
    font-weight: normal;
	font-size: 15px;
	background: unset !important;
	

}
ol, ul {
    list-style: none;
    margin: 0;
padding: 0;
}
.ss-navigatedown{
	line-height: 32px;
	margin-top:10px;

display: inline-block;

background: #eee;
}
.ss-navigatedown-ul { margin-bottom:60px; margin-bottom:20px;}
.ss-navigatedown i { color:red; }.dev_3 { display:none;}
     
       
            </style>
					   
                <div class="clearfix"><!-- --></div>
                <ol class="progtrckr" data-progtrckr-steps="4">
					<li class="progtrckr-done"><?php echo $this->tag->getTag('choose-ad-type','Choose Ad Type');?></li> 
					<li class="progtrckr-done"><?php echo $this->tag->getTag('enter-details','Enter Details');?></li> 
					<li class="progtrckr-todo"><?php echo $this->tag->getTag('choose-location','Choose Location');?></li> 
					<li class="progtrckr-todo"><?php echo $this->tag->getTag('done','Done');?></li> 
				</ol>
                <div class="content_place_an_ad">
					
					<div class="content_head"  ><?php echo $this->tag->getTag('step','Step');?> 2 : <?php echo $this->tag->getTag('enter-details','Enter Details');?></div>
					 
				   <div style="clear:both"></div>
				      
				     <div class="content_content">
									 
								 	<div style="max-width:600px;margin:auto;">	
										<div class="margin-top-15 margin-left-10 margin-bottom-15 dev_<?php echo $model->section_id;?>"><?php echo   Yii::app()->user->getState("place_holder".$pot);?></div>
									<?php $this->renderPartial('root.apps.backend.views.offplan._detail_field',compact('form'));?> 
									 <?php 
									 if(Yii::App()->isAppNAme('frontend')){
									 $model->user_id= $this->app->user->getId();
									 }
									 echo $form->hiddenField($model,'user_id');?>
									 <?php echo $form->hiddenField($model,'section_id');?>
									 <?php echo $form->hiddenField($model,'category_id');?>
									 <?php echo $form->hiddenField($model,'sub_category_id');?>
									 <?php echo $form->hiddenField($model,'country');?>
									 <?php echo $form->hiddenField($model,'listing_type');?>
									
									    <?php echo $form->hiddenField($model, 'location_latitude', $model->getHtmlOptions('location_latitude')); ?>
									   <?php echo $form->hiddenField($model, 'location_longitude', $model->getHtmlOptions('location_longitude')); ?>
									 
										        
									   <?php $this->renderPartial('root.apps.backend.views.offplan._moredetails',compact('form'));?>
								
								<div class="clearfix"><!-- --></div> 
							 	<div class="form-group col-lg-6">
										<?php echo $form->labelEx($model, 'state');?>
										<?php echo $form->dropDownList($model, 'state', CHtml::listData( States::model()->findAllByAttributes(array('country_id'=>'65946')) ,'state_id','state_name')    , $model->getHtmlOptions('state' ,array('empty'=>"Select City", "onChange"=>"getSubCommunityUrl(this)",'class'=>' form-control') )); ?>
										<?php echo $form->error($model, 'state');?>
										</div> 
										<div class="form-group col-lg-6">
										<?php echo $form->labelEx($model, 'community_id');?> 
										<?php echo $form->dropDownList($model, 'community_id', CHtml::listData( Community::model()->findAllByAttributes(array('community_id'=>$model->community_id)) ,'community_id','community_name')    , $model->getHtmlOptions('community_id' ,array('empty'=>"Select Communtiy", "onChange"=>"getSubCommunity(this)",'class'=>'autoSelect_community1 form-control') )); ?>
										<?php echo $form->error($model, 'community_id');?>
										</div> 
									 
										<div class="form-group col-lg-6">		
										<?php echo $form->labelEx($model, 'sub_community_id');?>
										
										<?php echo $form->dropDownList($model, 'sub_community_id',  CHtml::listData( SubCommunity::model()->findAllByAttributes(array('sub_community_id'=>$model->sub_community_id)) ,'sub_community_id','sub_community_name')   ,$model->getHtmlOptions('sub_community_id',array('empty'=>"Select SubCommunity" , 'class'=>'autoSelect_sub_community form-control' ) )); ?>
										<?php echo $form->error($model, 'sub_community_id');?>
										</div>		
									 
									 
								<?php
if(Yii::app()->isAppName('backend')){
	?>
		<div class="clearfix"></div>
		<div class="clearfix"></div> 
		<div class="form-group col-lg-6">
		<?php echo $form->labelEx($model, 'status');?>
		<?php echo $form->dropDownList($model, 'status', $model->statusArray()    , $model->getHtmlOptions('community_id' ,array('class'=>'form-control selectt2') )); ?>
		<?php echo $form->error($model, 'status');?>
		</div> 
		<?php
		if(in_array($model->section_id,array(1,2))){ ?> 
                    
                    <div class="form-group col-lg-3">
                    <?php echo $form->labelEx($model, 's_r');?>
                    <?php echo $form->checkbox($model, 's_r'  , $model->getHtmlOptions('s_r' ,array('class'=>'form-control','style'=>'width:auto;') )); ?>
                    <?php echo $form->error($model, 's_r');?>
                    </div>
		<?php } ?> 
		
	<div class="clearfix"><!-- --></div>
		<div class="form-group col-lg-3 hide">
		<?php echo $form->labelEx($model, 'featured');?>
		<?php echo $form->checkBox($model, 'featured'    , $model->getHtmlOptions('featured' ,array('class'=>'form-control selectt2','style'=>'width:auto;','value'=>'Y', 'uncheckValue'=>'N') )); ?>
		<?php echo $form->error($model, 'featured');?>
		</div> 
		
		<div class="form-group col-lg-3 hide">
		<?php echo $form->labelEx($model, 'recmnded');?>
		<?php echo $form->checkBox($model, 'recmnded'    , $model->getHtmlOptions('recmnded' ,array('class'=>'form-control  ','style'=>'width:auto;','value'=>'1', 'uncheckValue'=>'0') )); ?>
		<?php echo $form->error($model, 'recmnded');?>
		</div> 
									 
		<div class="form-group col-lg-3 hide">
		<?php echo $form->labelEx($model, 'promoted');?>
		<?php echo $form->checkBox($model, 'promoted'    , $model->getHtmlOptions('promoted' ,array('class'=>'form-control  ','style'=>'width:auto;','value'=>'1', 'uncheckValue'=>'0') )); ?>
		<?php echo $form->error($model, 'promoted');?>
		</div> 
		<div class="form-group col-lg-3 hide">
		<?php echo $form->labelEx($model, 'is_new');?>
		<?php echo $form->checkBox($model, 'is_new'    , $model->getHtmlOptions('is_new' ,array('class'=>'form-control  ','style'=>'width:auto;','value'=>'1', 'uncheckValue'=>'0') )); ?>
		<?php echo $form->error($model, 'is_new');?>
		</div> 
									 <div class="clearfix"><!-- --></div>
		<div class="form-group col-lg-12 <?php echo  $model->user_id=='115' ? 'hide' : '';?> ">
		<?php echo $form->labelEx($model, 'user_id');?> 
		<?php $mer =  array_merge($model->getHtmlOptions('user_id'),array('empty'=>"Select Customer",'class'=>"autoSelect_customer form-control")); ?>
		<?php echo $form->dropDownList($model, 'user_id',  CHtml::listData(ListingUsers::model()->findAllByAttributes(array("user_id"=>$model->user_id)),'user_id','first_name') , $mer ); ?>
		<?php echo $form->error($model, 'user_id');?>
		</div>  
		<div class="clearfix"></div> 
	<?php } 
	
 
	
	?>

								<div class="clearfix"><!-- --></div> 
								</div>
							
                 <div class="clearfix"><!-- --></div> 
					 
				   </div>
				   </div>
				 
            
            </div>
              <div class="clearfix"></div>
            <div class="box-footer">
                <div class="pull-right">
                    <button type="submit" class="btn btn-primary btn-submit" data-loading-text="<?php echo Yii::t('app', 'Please wait, processing...');?>"><?php echo $this->tag->getTag('go-to-next', 'Go To Next');?></button>
                      <?php 
                    if(Yii::app()->isAppName('backend') and !$model->isNewRecord){
						?>
						 <input  type="submit" class="btn btn-primary  "  name="step_vlaue" value="Finish Update" >  
                   
						<?
					}
					?>
                </div>
                <div class="clearfix"><!-- --></div>
            </div>
        </div>
        <div class="clearfix"></div>
        <?php 
        $this->endWidget(); 
    }
    /**
     * This hook gives a chance to append content after the active form.
     * Please note that from inside the action callback you can access all the controller view variables 
     * via {@CAttributeCollection $collection->controller->data}
     * @since 1.3.3.1
     */
    $hooks->doAction('after_active_form', new CAttributeCollection(array(
        'controller'      => $this,
        'renderedForm'    => $collection->renderForm,
    )));
}
/**
 * This hook gives a chance to append content after the view file default content.
 * Please note that from inside the action callback you can access all the controller view
 * variables via {@CAttributeCollection $collection->controller->data}
 * @since 1.3.3.1
 */
$hooks->doAction('after_view_file_content', new CAttributeCollection(array(
    'controller'        => $this,
    'renderedContent'   => $viewCollection->renderContent,
)));
?>
 <script>
 var UrlForAjx1;
 function commnity_url(){
    
	    UrlorAjx1 =  ajaxCommunityUrl ;
		  
		  
		   $(".autoSelect_community1").select2({
			  ajax: {
			  url:  UrlorAjx1,
			  dataType: 'json',
			  delay: 250,
			  data: function (params) {
			  return {
				q: params.term, // search term
				page: params.page
			  };
			},
			processResults: function (data, params) {
			  // parse the results into the format expected by Select2
			  // since we are using custom formatting functions we do not need to
			  // alter the remote JSON data, except to indicate that infinite
			  // scrolling can be used
			  params.page = params.page || 1;
			  return {
				results: data.items,
				pagination: {
				  more: (params.page * 30) < data.total_count
				}
			  };
			},
			cache: true
		  },
		  escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
		  minimumInputLength: 0,
		  //templateResult: formatRepo, // omitted for brevity, see the source of this page
		  //templateSelecti
 });
 }
 function getSubCommunityUrl(k){
     if($(k).val()!=''){
          $(".autoSelect_community1").empty();
         ajaxCommunityUrl = "<?php echo Yii::app()->createUrl('place_an_ad/community');?>/state_id/"+$(k).val();
         commnity_url(); 
     }
 }
ajaxCommunityUrl = "<?php echo Yii::app()->createUrl('place_an_ad/community');?>/state_id/<?php echo $model->state;?>";
ajaxDistrictUrl = "<?php echo Yii::app()->createUrl('place_an_ad/district');?>/state_id/<?php echo $model->state;?>";
ajaxCustomerUrl = "<?php echo Yii::app()->createUrl('place_an_ad/customer');?>";
ajaxSubCommunityUrl = "<?php echo Yii::app()->createUrl('place_an_ad/subCoummunity');?>";
$(function(){ $('select.selectt2').select2(); commnity_url();})
</script>
 
<form id="uploadAtarFrm" method="post" enctype="multipart/form-data" action="<?php echo Yii::app()->createUrl('ajax/postAvatar',array('type'=>'avatar'));?>"  class="ng-pristine ng-valid">

<div class="uploadFile2 img_timelineUploadBG2 hide">

<input name="avatar" id="avatarImage" data-formats="<div class='uploadInfoFF height:'>Upload  <strong>160px</strong> width and <strong>height:160px</strong> images . Support only PNG,JPG,JPEG,GIF</div>"   class="custom-file-input" original-title="Upload Picture" type="file">

</div>

</form>
<script>

						var cropUrlAvatar = '<?php echo ASKAAN_PATH_BASE.'/index.php/ajax/image_crop/file_path/images/original_path/images/file_type/avatar/width/1350/height/500' ;?>';
 
						var cropUrlCoverImage = '<?php echo Yii::app()->createUrl('ajax/image_crop',array('file_path'=>'cover_image','original_path'=>'images','file_type'=>'cover_image','width'=>160,'height'=>'160'));?>';

						var currentUrlInAction ;

						var   $image2 ;

						var  imgX52;

						var  imgY52;

						var  widthX2  ;

						var  widthY2 ;

						</script>
 
	 <script>
	  
	   
	   function callCrop(t, e, a, n, r) {
	 alert(a)
    $("#" + e).attr("src", t), $image2 = $("#" + e), $image2.cropper("destroy"), $image2.cropper({
        aspectRatio: a,
         responsive:true,
        autoCropArea: 0,
        strict: !1,
        viewMode: 1,
        dragMode: "move",
        restore: !1,
        strict: !1,
        modal: !1,
        center: !0,
        highlight: !1,
        minCropBoxHeight: n,
        minCropBoxWidth: r,
        cropBoxMovable: !1,
        cropBoxResizable: !1,
        crop: function(t) {
            imgX52 = t.x, imgY52 = t.y, widthX2 = t.width, widthY2 = t.height
        }
    })
}

function SaveCropedImageAvatar() {
    var t = $image2.cropper("getCropBoxData"),
        e = $image2.cropper("getData"),
        a = {
            imgUrl: $image2.attr("src"),
            imgX5: imgX52,
            imgY5: imgY52,
            widthX: widthX2,
            widthY: widthY2,
            cropW: t.width,
            cropH: t.height,
            rotate: e.rotate
        };
    $.get(currentUrlInAction, a, function(t) {
        if (dataParse = JSON.parse(t), "success" == dataParse.status) $("#modal_avatar").modal("hide"), "avatar" == dataParse.type && $("#avatar_background").css("background-image", "url(" + dataParse.full_url + ")"), "cover_image" == dataParse.type && $("#cr_image").attr("src",  dataParse.full_url), "team" == dataParse.type && ($("#bgTeam").css("background-image", "url(" + dataParse.full_url + ")"), $("#Teams_logo").val(dataParse.imgPath));
        else if ("failed" == dataParse.status) return alert(dataParse.message), !1
    })
}
var User_imageURl = '<?php echo Yii::app()->apps->getBaseUrl('uploads/images');?>'
function OpenCrop(k){
	$('#modal_avatar').modal('show');
	image = User_imageURl+'/'+$(k).attr('data-file');
    $(".widthfull-option").addClass("avatar");
     $("#modal_avataContent").html('  <img id="avtar_cropper_image" src="" alt="loading..."> ');
       currentUrlInAction = cropUrlAvatar ;
        
	callCrop(image, "avtar_cropper_image", "2.7", 1350, 500)
}
	 </script>
	 <div class="modal fade " id="modal_avatar"  aria-labelledby="modalLabel" role="dialog"  >
      <div class="modal-dialog widthfull-option" role="document"   style="width:100%;margin:auto;z-index:12222; ">
        <div class="modal-content">
          <div class="modal-header">
            <h4 class="modal-title pull-left" id="modal_avatarHead">Loading..</h5>
            <a href="#" class="close" data-dismiss="modal" aria-label="Close"><img src="/frontend/new-theme/images/closebtn.png" alt=""></a>
            
            <div class="clearfix"></div>
          </div>
          <div class="modal-body  "  style="background:#eee;  "   >
			  <div class="pull-left  docs-buttons widthfull-option-part"    style="width:100px;float:left">
		 

        <div class="btn-group">
          <button type="button" class="btn btn-primary" data-method="zoom" data-option="0.1" title="Zoom In" onclick="$('#avtar_cropper_image').cropper('zoom', 0.1)">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('zoom', 0.1)">
              <span class="fa fa-search-plus"></span>
            </span>
          </button>
          <button type="button" class="btn btn-primary" data-method="zoom" data-option="-0.1" title="Zoom Out"  onclick="$('#avtar_cropper_image').cropper('zoom', -0.1)">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('zoom', -0.1)">
              <span class="fa fa-search-minus"></span>
            </span>
          </button>
        </div>

        <div class="btn-group">
         <button type="button" class="btn btn-primary" data-method="move"  onclick="$('#avtar_cropper_image').cropper('move', '-10',  0)" title="Move Left">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$(#avtar_cropper_image).cropper('move', 0, -10)">
              <span class="fa fa-arrow-left"></span>
            </span>
          </button>
          <button type="button" class="btn btn-primary" data-method="move" data-option="10" data-second-option="0" title="Move Right" onclick="$('#avtar_cropper_image').cropper('move', 10, 0)">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('move', 10, 0)">
              <span class="fa fa-arrow-right"></span>
            </span>
          </button>
        
        </div>

        <div class="btn-group">
			  <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="-10" title="Move Up"  onclick="$('#avtar_cropper_image').cropper('move', 0, -10)" >
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('move', 0, -10)">
              <span class="fa fa-arrow-up"></span>
            </span>
          </button>
          <button type="button" class="btn btn-primary" data-method="move" data-option="0" data-second-option="10" title="Move Down"  onclick="$('#avtar_cropper_image').cropper('move', 0, 10)" >
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('move', 0, 10)">
              <span class="fa fa-arrow-down"></span>
            </span>
          </button>
           </div>
        <div class="btn-group">
          <button type="button" class="btn btn-primary" data-method="rotate" data-option="-45" title="Rotate Left"  onclick="$('#avtar_cropper_image').cropper('rotate', -45)" >
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('rotate', -45)">
              <span class="fa fa-rotate-left"></span>
            </span>
          </button>
          <button type="button" class="btn btn-primary" data-method="rotate" data-option="45" title="Rotate Right"  onclick="$('#avtar_cropper_image').cropper('rotate', 45)" >
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="" data-original-title="$('#avtar_cropper_image').cropper('rotate', 45)">
              <span class="fa fa-rotate-right"></span>
            </span>
          </button>
        </div>


 
       
			  </div>
			  <div class=" pull-left widthfull-option-part " style="float:left;width:calc(100% - 110px )">
			  <div  id="modal_avataContent"   style="width:100%;margin:0px auto;background:#eee;padding:0px 10px" ></div>
			  </div>
			 <div class="clearfix"></div>
		  </div>
		  <div class="modal-footer">
			  <div class="pull-right"><button class="btn btn-primary" style="display:none;" onclick="useWithout_Crop(this)" id="img_without_crop">Use Without Crop</button>  <button class="btn btn-primary" type="button" onclick="SaveCropedImageAvatar()">Crop and Save</button></div>
		  </div>      
	</div>
  </div>
</div>
 
