<?php include("header.php");

//echo'<pre>';print_r($_GET);exit;
$sqlads=mysql_query("select * from tbl_ads where ads_id='".$_GET['adid']."'");
$resads=mysql_fetch_assoc($sqlads);


$sqmct=mysql_query("select * from tbl_maincategory where mcid='".$resads['maincategory']."'");
$resmct=mysql_fetch_assoc($sqmct);

$sqmc=mysql_query("select * from tbl_category where cid='".$resads['category']."'");
$resmc=mysql_fetch_assoc($sqmc);


$sqms=mysql_query("select * from tbl_subcategory where mcid='".$resads['subcategory']."'");
$resms=mysql_fetch_assoc($sqms);


$squser=mysql_query("select * from tbl_users where userid='".$resads['posted_userid']."'");
$reuser=mysql_fetch_assoc($squser);


$sqcitss=mysql_query("select * from tbl_cities where city_id='".$reuser['city']."'");
$rscitss=mysql_fetch_assoc($sqcitss);




?>
 
<div class="main-container">
<div class="container">
<ol class="breadcrumb pull-left">
<li><a href="#"><i class="icon-home fa"></i></a></li>
<li><a href="<?php echo $actual_link."products" ?>">All Ads</a></li>
<li><a><?php echo $resmct['name'];?></a></li>
<li><a><?php echo $resmc['name'];?></a></li>
<li><a><?php echo $resms['name'];?></a></li>
</ol>
<div class="pull-right backtolist"><a href="<?php echo $actual_link."products" ?>"> <i class="fa fa-angle-double-left"></i> Back to Results</a></div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-9 page-content col-thin-right">
<div class="inner inner-box ads-details-wrapper">
<h2> <?php echo $resads['title'];?> <!--<small class="label label-default adlistingtype">Company ad</small>--> </h2>
<span class="info-row"> <span class="date"><i class=" icon-clock"> </i> <?php echo date('d M Y',strtotime($resads['postdate']));?> </span> - <span class="category"><?php echo $resmct['name'];?> </span>- <span class="item-location"><i class="fa fa-map-marker"></i> <?php echo $rscitss['cityname'];?> </span> </span>
<div class="ads-image">
<h1 class="pricetag"> <i class="fa fa-inr"></i> <?php echo $resads['price'];?></h1>
<ul class="bxslider">
<?php if($resads['file1']!=="")
{?>
<li><img src="<?php echo $actual_link."postedfile/".$resads['file1'];?>"  alt="img"/></li>
<?php } ?>
<?php if($resads['file2']!=="")
{?>
<li><img src="<?php echo $actual_link."postedfile/".$resads['file2'];?>"  alt="img"/></li>
<?php } ?>
<?php if($resads['file3']!=="")
{?>
<li><img src="<?php echo $actual_link."postedfile/".$resads['file3'];?>"  alt="img"/></li>
<?php } ?>
<?php if($resads['file4']!=="")
{?>
<li><img src="<?php echo $actual_link."postedfile/".$resads['file4'];?>"  alt="img"/></li>
<?php } ?>
<?php if($resads['file5']!=="")
{?>
<li><img src="<?php echo $actual_link."postedfile/".$resads['file5'];?>"  alt="img"/></li>
<?php } ?>
</ul>
<?php if($resads['file1']!=="")
{?>
<div id="bx-pager">
<a class="thumb-item-link" data-slide-index="0" href="#"><img src="<?php echo $actual_link."postedfile/".$resads['file1'];?>" alt="img"/></a>
<?php } ?>
<?php if($resads['file2']!=="")
{?>
<a class="thumb-item-link" data-slide-index="1" href="#"><img src="<?php echo $actual_link."postedfile/".$resads['file2'];?>" alt="img"/></a>
<?php } ?>
<?php if($resads['file3']!=="")
{?>
<a class="thumb-item-link" data-slide-index="2" href="#"><img src="<?php echo $actual_link."postedfile/".$resads['file3'];?>" alt="img"/></a>
<?php } ?>
<?php if($resads['file4']!=="")
{?>
<a class="thumb-item-link" data-slide-index="2" href="#"><img src="<?php echo $actual_link."postedfile/".$resads['file4'];?>" alt="img"/></a>
<?php } ?>
<?php if($resads['file5']!=="")
{?>
<a class="thumb-item-link" data-slide-index="2" href="#"><img src="<?php echo $actual_link."postedfile/".$resads['file5'];?>" alt="img"/></a>
<?php } ?>
</div>
</div>
 
<div class="Ads-Details">
<h5 class="list-title"><strong>Ads Details</strong></h5>
<div class="row">
<div class="ads-details-info col-md-8">
<p><strong><?php echo ucfirst($resads['title']);?></strong> </p>
<h4>Description</h4>
<ul class="list-circle">
<li><?php echo ucfirst($resads['description']);?></li>
</ul>


<h4>Desire Listing </h4>
<ul>
<?php 
$derireps=explode(",",$resads['desire_products']);
$Edes_maincat=explode(",",$resads['des_maincat']);
$Edes_cat=explode(",",$resads['des_cat']);
$Edes_subcat=explode(",",$resads['des_subcat']);

foreach($derireps as $key=>$desp)
{
	
	
	$sqlmain1=mysql_query("select * from tbl_maincategory where mcid='".$Edes_maincat[$key]."'");
	$resmain1=mysql_fetch_assoc($sqlmain1);
	
	
	
	$sqlcat1=mysql_query("select * from tbl_category where cid='".$Edes_cat[$key]."'");
	$rescat1=mysql_fetch_assoc($sqlcat1);
	
	
	
	$sqlsubcat1=mysql_query("select * from tbl_subcategory where sid='".$Edes_subcat[$key]."'");
	$ressubcat1=mysql_fetch_assoc($sqlsubcat1);
	
	
	$desire_products=$desp;
	
	$des_maincat=$resmain1['name'];
	
	$des_cat=$rescat1['name'];
	
	$des_subcat=$ressubcat1['name'];
	
	
	?>
	<li><p class="no-margin"><strong>Ad Name:</strong> <?php echo ucfirst($desp);?></p>
    	<p class="no-margin"><strong>Maincategory Name:</strong> <?php echo ucfirst($des_maincat);?></p>
        <p class="no-margin"><strong>Category Name:</strong> <?php echo ucfirst($des_cat);?></p>
        <p class="no-margin"><strong>Subcategory Name:</strong> <?php echo ucfirst($des_subcat);?></p>
    
    </li>
    <br>
    
	<?php
	
}
?> 



</ul>

</div>
<div class="col-md-4">
<aside class="panel panel-body panel-details">
<ul>
<li>
<p class=" no-margin "><strong>Price:</strong> <i class="fa fa-inr"></i> <?php echo $resads['price'];?></p>
</li>

<li>
<p class=" no-margin "><strong>Main Category:</strong>  <?php echo $resmct['name'];?></p>
 </li>
 
 <li>
<p class=" no-margin "><strong>Category:</strong>  <?php echo $resmc['name'];?></p>
 </li>
 
 <li>
<p class=" no-margin "><strong>Sub Category:</strong>  <?php echo $resms['name'];?></p>
 </li>

<li>
<p class="no-margin"><strong>Location:</strong> <?php echo $rscitss['cityname'];?> </p>
</li>
<li>
<p class=" no-margin "><strong>Type:</strong> <?php echo ucfirst($resads['type']);?></p>
</li>
<li>
<p class="no-margin"><strong>Negotiable:</strong> <?php  if($resads['negotiable']=="on") { echo "Yes";};?></p>
</li>

<li><p class="no-margin"><strong>Condition:</strong> <?php echo ucfirst($resads['conditions']);?></p></li>

<li><p class="no-margin"><strong>Transaction:</strong> <?php echo ucfirst($resads['exchange_type']);?></p></li>

</ul>
</aside>
<div class="ads-action">
<!--<ul class="list-border">
<li><a href="#"> <i class=" fa fa-user"></i> More ads by User </a> </li>
<li><a href="#"> <i class=" fa fa-heart"></i> Save ad </a> </li>
<li><a href="#"> <i class="fa fa-share-alt"></i> Share ad </a> </li>
<li><a href="#reportAdvertiser" data-toggle="modal"> <i class="fa icon-info-circled-alt"></i> Report abuse </a> </li>
</ul>-->
</div>
</div>
</div>
<div class="content-footer text-left"> 
<?php 
if($resads['admin_status']=="Approved")
{
?>
<a class="btn  btn-default" data-toggle="modal" href="<?php echo $actual_link."prodreq/".$_GET['adid']?>"><i class=" icon-mail-2"></i> Make Query </a>

<?php 
if(isset($_SESSION['cid']))
{
	if($_SESSION['cid']!==$resads['posted_userid'])
	{?>
	<a class="btn btn-success  Clickchat" id="<?php echo $_GET['adid'];?>"> <i class="fa fa-comment"></i> <span>Chat</span> </a> 
	<?php  
	}
}
else
{
   ?>
	<a class="btn btn-success  Clickchat" id="<?php echo $_GET['adid'];?>"> <i class="fa fa-comment"></i> <span>Chat</span> </a>
   <?php
}

?> 

<?php if($reuser['hidenumber']=="on")
{
?>
<a class="btn  btn-info"><i class=" icon-phone-1"></i> <?php echo $reuser['number'];?> </a>
<?php } ?> 
<?php } ?>
 </div>
</div>
</div>
 
</div>
 
<div class="col-sm-3  page-sidebar-right">
<aside>
<div class="panel sidebar-panel panel-contact-seller">
<div class="panel-heading">Contact Seller</div>
<div class="panel-content user-info">
<div class="panel-body text-center">
<div class="seller-info">
<h3 class="no-margin"><?php echo ucfirst($reuser['fullname']);?></h3>
<p>Location: <strong><?php echo $rscitss['cityname'];?></strong></p>
<!--<p> Joined: <strong>12 Mar 2009</strong></p>-->
</div>

<?php 
if($resads['admin_status']=="Approved")
{
?>

<div class="user-ads-action"> <a href="<?php echo $actual_link."prodreq/".$_GET['adid']?>" data-toggle="modal" class="btn   btn-default btn-block"><i class=" icon-mail-2"></i> Make Query </a>

<?php 
if(isset($_SESSION['cid']))
{
	if($_SESSION['cid']!==$resads['posted_userid'])
	{?>
	<br><a class="btn btn-success btn-block  Clickchat" id="<?php echo $_GET['adid'];?>"> <i class="fa fa-comment"></i> <span>Chat</span> </a> 
	<?php  
	}
}
else
{
   ?>
	<br><a class="btn btn-success btn-block  Clickchat" id="<?php echo $_GET['adid'];?>"> <i class="fa fa-comment"></i> <span>Chat</span> </a>
   <?php
}

?>
 

<?php if($reuser['hidenumber']=="on")
{
?>
<a class="btn  btn-info btn-block"><i class=" icon-phone-1"></i> <?php echo $reuser['number'];?> </a>
<?php } ?>

 </div>
<?php } ?>


</div>
</div>
</div>
<div class="panel sidebar-panel">
<div class="panel-heading">Safety Tips for Buyers</div>
<div class="panel-content">
<div class="panel-body text-left">
<ul class="list-check">
<li> Meet seller at a public place </li>
<li> Check the item before you buy</li>
<li> Pay only after collecting the item</li>
</ul>
<!--<p><a class="pull-right" href="#"> Know more <i class="fa fa-angle-double-right"></i> </a></p>-->
</div>
</div>
</div>
 
</aside>
</div>
 
</div>
</div>
</div>
 

 
<div class="modal fade" id="reportAdvertiser" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title"><i class="fa icon-info-circled-alt"></i> There's something wrong with this ads? </h4>
</div>
<div class="modal-body">
<form role="form">
<div class="form-group">
<label for="report-reason" class="control-label">Reason:</label>
<select name="report-reason" id="report-reason" class="form-control">
<option value="">Select a reason</option>
<option value="soldUnavailable">Item unavailable</option>
<option value="fraud">Fraud</option>
<option value="duplicate">Duplicate</option>
<option value="spam">Spam</option>
<option value="wrongCategory">Wrong category</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label for="recipient-email" class="control-label">Your E-mail:</label>
<input type="text" name="email" maxlength="60" class="form-control" id="recipient-email">
</div>
<div class="form-group">
<label for="message-text2" class="control-label">Message <span class="text-count">(300) </span>:</label>
<textarea class="form-control" id="message-text2"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary">Send Report</button>
</div>
</div>
</div>
</div>
 
 
<div class="modal fade" id="contactAdvertiser" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title"><i class=" icon-mail-2"></i> Contact advertiser </h4>
</div>
<div class="modal-body">
<form role="form">
<div class="form-group">
<label for="recipient-name" class="control-label">Name:</label>
<input class="form-control required" id="recipient-name" placeholder="Your name" data-placement="top" data-trigger="manual" data-content="Must be at least 3 characters long, and must only contain letters." type="text">
</div>
<div class="form-group">
<label for="sender-email" class="control-label">E-mail:</label>
<input id="sender-email" type="text" data-content="Must be a valid e-mail address (user@gmail.com)" data-trigger="manual" data-placement="top" placeholder="email@you.com" class="form-control email">
</div>
<div class="form-group">
<label for="recipient-Phone-Number" class="control-label">Phone Number:</label>
<input type="text" maxlength="60" class="form-control" id="recipient-Phone-Number">
</div>
<div class="form-group">
<label for="message-text" class="control-label">Message <span class="text-count">(300) </span>:</label>
<textarea class="form-control" id="message-text" placeholder="Your message here.." data-placement="top" data-trigger="manual"></textarea>
</div>
<div class="form-group">
<p class="help-block pull-left text-danger hide" id="form-error">&nbsp; The form is not valid. </p>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-success pull-right">Send message!</button>
</div>
</div>
</div>
</div>

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

