<section class="featured portfolio">
		<div class="container">
<p>&nbsp;</p>




<script type="text/javascript">
function submitform() {
    
	
  // document.getElementById("formr_ids").submit();
  var a =  document.getElementById("category_id").value;
  var b =  document.getElementById("dist_id").value;
  
  if(a ==0 || b ==0) { 
  
  if(a ==0) { document.getElementById("category_id").style.borderColor  = "red"; document.getElementById("valodator_id1").style.display  = "block"; }
  if(b ==0) { document.getElementById("dist_id").style.borderColor  = "red";  document.getElementById("valodator_id2").style.display  = "block"; }
    
 
  event.preventDefault(); }
  else { }
  
  
 
}
</script>


<style>
.inpu_ht { border:1px solid #ffffff;}
.valodator { color:#ffffff; position:absolute; font-size:10px; top:-15px; display:none;}

@media (max-width:768px){

.padd_less { margin-top:20px;}

}
</style>


<div class="col-md-12">
<div class="row">

<div class="col-md-12 box_tiros">

<form name="sub_mit" method="post"   id="formr_ids" >
<div class="row">

<!--<div class="col-md-2 padd_less">
<select name="buy" class="form-control inpu_ht">
<option  value="0" >Select</option>
<option value="1" >Buy</option>
<option value="2"  >Rent</option>
</select>
</div>
-->


<div class="col-md-2 padd_less">
<span class="valodator"  id="valodator_id1" >This field is required </span>
<select  name="type" id="category_id" class="form-control inpu_ht" required="required" >
<option value="0" >Property Type</option>
<?php if($category): foreach($category as $sub_cat):?>
<option value="<?php echo $sub_cat['id'] ; ?>"  <?php if($type==$sub_cat['id']) { echo 'selected="selected"'; } ?> ><?=$sub_cat['title']?></option>
<?php endforeach; endif; ?>
</select>
</div>


<div class="col-md-3 padd_less">

<select  name="stype" id="subcategory_id" class="form-control inpu_ht">
<option value="0" >Property Type</option>
<?php if($subcat): foreach($subcat as $sub_cat2):?>
<option value="<?php echo $sub_cat2['id'] ; ?>" <?php if($stype==$sub_cat2['id']) { echo 'selected="selected"'; } ?>  ><?=$sub_cat2['title']?></option>
<?php endforeach; endif; ?>
</select>
</div>


<div class="col-md-2 padd_less">
<span class="valodator" id="valodator_id2" >This field is required </span>
<select name="district" class="form-control inpu_ht" id="dist_id" >
<option value="0" >District</option>
<?php if($district): foreach($district as $row_dist):?>
<option value="<?php echo $row_dist['id'] ; ?>" <?php if($district_id==$row_dist['id']) { echo 'selected="selected"'; } ?>  ><?=$row_dist['name']?></option>
<?php endforeach; endif; ?>
</select>
</div>


<div class="col-md-3 padd_less">
<select name="town" class="form-control inpu_ht" id="city_mainid" >
<option value="0" >Select City</option>
<?php if($town): foreach($town as $row_town):?>
<option value="<?php echo $row_town['id'] ; ?>" <?php if($town_id==$row_town['id']) { echo 'selected="selected"'; } ?>  ><?=$row_town['title']?></option>
<?php endforeach; endif; ?>
</select>
</div>

<div class="col-md-2 padd_less">
<!--<input type="submit" value=" " id="sub_mit" onclick="functionvali()" class="sub_mits" name="submit" />

-->
 <button  class="sub_mits"   onclick="submitform()" ></button>

</div>


</div>
</form>
</div>




</div>
</div>
        




<?php




$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri_segments = explode('/', $uri_path);


/*local uri_segments number*/

 $buy=$uri_segments[6];
 $property_type=$uri_segments[6];
 $subcat=$uri_segments[7];
 $dis_id=$uri_segments[8];
 $city=$uri_segments[9];
 $text=$uri_segments[10];


/*Live  uri_segments number*/

 /* $buy=$uri_segments[4];
  $property_type=$uri_segments[5];
  $dis_id=$uri_segments[6];
  $city=$uri_segments[7];
  $text=$uri_segments[8];
  */
  
  


if($property_type!=0) {
$sql1 ="SELECT * FROM shop_category where id=$property_type";
$query1 = $this->db->query($sql1);
if ($query1->num_rows() > 0) {
foreach($query1->result() as $row1) {
$ss_subcat=$row1->title;
}
}
}
else { $ss_subcat='';}


if($dis_id!=0) {
$sql2 ="SELECT * FROM districts where id=$dis_id";
$query2 = $this->db->query($sql2);
if ($query2->num_rows() > 0) {
foreach($query2->result() as $row2) {
$ss_dname=$row2->name;
}
}
}
else { $ss_dname='';}


if($city!=0) {
$sql3 ="SELECT * FROM city where id=$city ";
$query3 = $this->db->query($sql3);
if ($query3->num_rows() > 0) {
foreach($query3->result() as $row3) {
$ss_dcity=$row3->title;
}
}
}
else { $ss_dcity='';}



?>


<div class="col-md-12 padd_not">			
<h1 class="recent_s">properties : <span style="font-size:15px;"> <?php echo $ss_subcat; ?> <?php echo $ss_dname; ?>  <?php echo $ss_dcity; ?> </span></h1>

			<div class="row portfolio-items">

                
                <?php $i=1; if($allproduct): foreach($allproduct as $property):?>
                
                
                
                <div class="item col-lg-4 col-md-6 col-xs-12 landscapes sale">
					
                    <a href="<?php echo site_url( 'Pro/view/'.$property['aid'].'/'.$property['category_id'].'/1/'.url_title($property['title'], '-', TRUE) ) ; ?>">
                    
                    <div class="project-single">
						<div class="project-inner project-head">
							
                            
                            <div class="project-bottom">
								<h4>

<?=$property['title']?>
<span class="category read_more3" >Read More</span></h4>
							</div>
						
							<div class="homes">
								<!-- homes img -->
							
<?php if($property['featured']==1){ ?>
<div class="homes-tag button alt featured">Featured</div>
<?php  }?>
<?php if($property['code']==1){ ?>
<div class="homes-tag button alt sale">For Sale</div>
<?php } ?>
<?php if($property['code']==2){ ?>
<div class="homes-tag button alt sale rent" >For Rent</div>
<?php } ?>



									
									<div class="homes-price">
<?php
$subcat=$property->subcategory_id;
$sql1 ="SELECT * FROM `shop_subcategory` WHERE `id`='".$property['subcategory_id']."'";
$query1 = $this->db->query($sql1);
if ($query1->num_rows() > 0) {
foreach($query1->result() as $row1) {
echo $sub_title=$row1->title;
}
}
									
									
									
									?>
                                    
                                    
                                    
                                    </div>
                  
<div class="image_bd_d" style="background-image: url(<?php echo base_url('assets/images/'.$property['img']) ; ?>); background-size:cover;" > 
<!--<?php if($property['img']!='') { ?><img src="<?php echo base_url('assets/images/'.$property['img']) ; ?>" alt="<?=$property->title?>" title="<?=$property->title?>" class="img-responsive"><?php } else { ?>
<img src="<?php echo base_url('assets/website/images/pro.jpg') ; ?>" alt="home-1"  >
<?php } ?>-->
</div>
					
							</div>
						</div>
						<!-- homes content -->
						<div class="homes-content">
							<!-- homes address -->
							
                            <div class="titless"><h3> <?php echo $property['title']; ?></h3></div>
                           
                            
							<p class="homes-address mb-3">
								
									<i class="fa fa-map-marker"></i><span><?=$property['locations']?></span>
								
							</p>
							<!-- homes List -->
							<ul class="homes-list clearfix">
								<li>
									<i class="fa fa-bed" aria-hidden="true"></i>
									<span><?=$property['bed']?> Bedrooms</span>
								</li>
								<li>

                             <i class="fas fa-shower"></i>

									<span><?=$property['bath']?> Bathrooms</span>
								</li>
								<li>
									<i class="fas fa-warehouse" aria-hidden="true"></i>
									<span><?=$property['stock2']?> 
									<?php 
									if ($property['unit_id']==1) { echo "Sq-Ft";}
									if ($property['unit_id']==2) { echo "Sq-M";}
									if ($property['unit_id']==3) { echo "Sq-Yrd";}
									?></span>
								</li>
								<li>
									<i class="fa fa-object-group" aria-hidden="true"></i>
									<span><?=$property['land']?> 	<?php 
									if ($property['land_unit']==1) { echo "cent";}
									if ($property['land_unit']==2) { echo "acre";}
									?></span>
								</li>
							</ul>
							<!-- Price -->
							<div class="price-properties">
								<h3 class="title mt-3">
                           <i class="fa fa-inr" aria-hidden="true"></i> 
<?php
//echo $amount = $property->price;
/*setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%!i', $amount);
echo $amount;*/

?> 
<?php
$num = $property['price'];
$explrestunits = "" ;
    if(strlen($num)>3) {
        $lastthree = substr($num, strlen($num)-3, strlen($num));
        $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits
        $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
        $expunit = str_split($restunits, 2);
        for($i=0; $i<sizeof($expunit); $i++) {
            // creates each of the 2's group and adds a comma to the end
            if($i==0) {
                $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer
            } else {
                $explrestunits .= $expunit[$i].",";
            }
        }
        $thecash = $explrestunits.$lastthree;
    } else {
         $thecash = $num;
    }
    echo $thecash; // writes the final format where $currency is the currency symbol.

?>                                
                                
                        
                                </h3>
								<!--<div class="compare">
									<a href="#" title="Compare">
										<i class="fas fa-exchange-alt"></i>
									</a>
									<a href="#" title="Share">
										<i class="fas fa-share-alt"></i>
									</a>
									<a href="#" title="Favorites">
										<i class="fa fa-heart-o"></i>
									</a>
								</div>-->
							</div>
							<div class="footer">
								<!--<a href="agent-details.html" >
									<i class="fa fa-user"></i> 
                                    
                                    <?=$property['reg_user']?> 
                                    
                                    
								</a>-->
							
                                <i class="fa fa-calendar"></i>
                                
                                <?php
$s = $property['reg_date'];
$dt = new DateTime($s);
$date = $dt->format('d/m/Y');
$time = $dt->format('H:i:s');
echo $date;

//echo $property->La_modi_date;
?>
                        
							</div>
						</div>
					</div>
                    
                    </a>
                    
				</div>
			
                
             
                <?php $i++; endforeach; endif;
				
				
				if($i==1){ echo "<h3 style='text-align:center; color:#F00;padding-left:15px;' >No Results Found!</h3>";}
				
				
				 ?> 
                
                   
       
                 <div class="col-md-12 " >   <p class="pagination_style" ><?php echo $links;  ?></p></div>
                    
          
                
          
			</div>
		</div>
        </div>
        
        
	</section>













