<?php 
require_once("header.php");
require_once("session_check.php");

//FETCH DATA FROM DATABASE
$arr_order = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `pd_property` WHERE `property_id` = '".$_REQUEST['property_id']."'"));
if($arr_order['floor'] == 0)
{
    $flr = "Ground";
}
else
{
    $flr = $arr_order['floor'];
}

$get_location = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `pd_locations` WHERE `location_id` = '".$arr_order['location_id']."'"));
$get_type = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `pd_property_type` WHERE `type_id` = '".$arr_order['type_id']."'"));
$get_subtype = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `pd_property_subtype` WHERE `subtype_id` = '".$arr_order['subtype_id']."'"));
$get_otype = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `pd_ownership_type` WHERE `otype_id` = '".$arr_order['otype_id']."'"));
$fetch_record1 = mysqli_fetch_array(mysqli_query($connection,"SELECT * FROM `pd_brokers` WHERE `user_id` = '".$arr_order['broker_id']."'"));
?>

<?php require_once("left_panel.php");?>
<div class="content">
	<div class="workplace">
		<div class="row-fluid">
			<div class="span12">
				<div class="head clearfix">
					<div class="isw-documents"></div>					
					<h1>Property Details</h1>					
				</div>
				<form action="" method="post" enctype="multipart/form-data">
				<div class="block-fluid">
					<div class="row-form clearfix">
						<div class="span3">Cover Photo</div>
						<div class="span9"><img src="../uploads/property/<?php echo $arr_order['cover_photo'];?>" alt="" height="200" width="200"></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Category</div>
						<div class="span9"><?php echo stripslashes($get_type['type']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">subcategory</div>
						<div class="span9"><?php echo stripslashes($get_subtype['subtype']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Location</div>
						<div class="span9"><?php echo stripslashes($get_location['location']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Address</div>
						<div class="span9"><?php echo stripslashes($arr_order['address']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Pincode</div>
						<div class="span9"><?php echo stripslashes($arr_order['zip']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Landmark</div>
						<div class="span9"><?php echo stripslashes($arr_order['landmark']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Ownership Type</div>
						<div class="span9"><?php echo stripslashes($get_otype['otype']);?></div>
					</div>
					<?php if($arr_order['type_id'] == 1) { ?>
					<div class="row-form clearfix">
						<div class="span3">Carpet Area</div>
						<div class="span9"><?php echo stripslashes($arr_order['carpet_area']);?> sqft</div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">BHK</div>
						<div class="span9"><?php echo stripslashes($arr_order['bhk']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Floor</div>
						<div class="span9"><?php echo $flr;?> Floor</div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Bathroom</div>
						<div class="span9"><?php echo stripslashes($arr_order['bathroom']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Balcony</div>
						<div class="span9"><?php echo stripslashes($arr_order['balcony']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Furnishing Status</div>
						<div class="span9"><?php echo stripslashes($arr_order['furnishing_type']);?></div>
					</div>
					<?php } ?>
					<?php if($arr_order['type_id'] == 2) { ?>
					<div class="row-form clearfix">
						<div class="span3">Carpet Area</div>
						<div class="span9"><?php echo stripslashes($arr_order['carpet_area']);?> sqft</div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Floor</div>
						<div class="span9"><?php echo $flr;?> Floor</div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Bathroom</div>
						<div class="span9"><?php echo stripslashes($arr_order['bathroom']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Furnishing Status</div>
						<div class="span9"><?php echo stripslashes($arr_order['furnishing_type']);?></div>
					</div>
					<?php } ?>
					<?php if($arr_order['type_id'] == 3) { ?>
					<div class="row-form clearfix">
						<div class="span3">Total Area</div>
						<div class="span9"><?php echo stripslashes($arr_order['plot_area']);?> sqft</div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Open Sides</div>
						<div class="span9"><?php echo stripslashes($arr_order['open_sides']);?></div>
					</div>
					<?php } ?>
					<div class="row-form clearfix">
						<div class="span3">Total Price</div>
						<div class="span9">Rs.<?php echo stripslashes($arr_order['price']);?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Description</div>
						<div class="span9"><?php echo nl2br(stripslashes($arr_order['description']));?></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3"><b>Broker</b></div>
						<div class="span9"><b><?php echo stripslashes($fetch_record1['fname']);?>&nbsp;<?php echo stripslashes($fetch_record1['lname']);?><br>Phone No : <?php echo stripslashes($fetch_record1['phone']);?><br>Code : <?php echo stripslashes($fetch_record1['broker_code']);?></b></div>
					</div>
					<div class="row-form clearfix">
						<div class="span3">Post Date</div>
						<div class="span9"><?php echo date('d.m.Y h:i A',strtotime($arr_order['post_date']));?></div>
					</div>
				</div>
				<div>&nbsp;</div>
				<div class="head clearfix">
					<div class="isw-documents"></div>					
					<h1>Photo Gallery</h1>					
				</div>
				<div class="block-fluid">
				    <?php
				    $q = 1;
					$sql_photo = "SELECT * FROM `pd_property_photos` WHERE `photo_status` = 'Active' AND `property_id` = '".$_REQUEST['property_id']."' ORDER BY `photo_id` ASC";
					$exe_photo = mysqli_query($connection,$sql_photo);
					while($arr_photo = mysqli_fetch_array($exe_photo))
					{									
						?>
				    <div class="row-form clearfix">
						<div class="span3">Photo <?php echo $q;?></div>
						<div class="span9"><img src="../uploads/property/<?php echo $arr_photo['photo'];?>" alt="" height="200" width="200"></div>
					</div>
					<?php
					$q++;
					}
					?>
					<div class="row-form clearfix">
						<div class="span3">&nbsp;</div>
						<div class="span9">						
							<button class="btn" type="button" name="back" onclick="window.location.href='property_list.php'">Back To Properties List</button>
						</div>
					</div>
				</div>
				</form>
			</div>
		</div>
	</div>
</div> 

<?php require_once("footer.php"); ?>