<?php
include_once 'includes/processes.php';
$Process = new Login_Process;
$Process->check_status($_SERVER['SCRIPT_NAME']);
$addProduct = $Process->addProduct($_POST['add_product']);
if(!isset($_SESSION['level1_cat'])) {
	header("location:sell.php");
}
?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
  <title>Sell a Product | SellerHQ</title>

  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">

  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,700">
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,300,700">
  <link rel="stylesheet" href="./css/font-awesome.min.css">
  <link rel="stylesheet" href="./js/libs/css/ui-lightness/jquery-ui-1.9.2.custom.min.css">
  <link rel="stylesheet" href="./css/bootstrap.min.css">
  
  <!-- Plugin CSS -->
  <link rel="stylesheet" href="./js/plugins/fileupload/bootstrap-fileupload.css">
  <link rel="stylesheet" href="./js/plugins/select2/select2.css"> 
  <link rel="stylesheet" href="./js/plugins/icheck/skins/minimal/blue.css">
  <link rel="stylesheet" href="./js/plugins/datepicker/datepicker.css">
  <link rel="stylesheet" href="./js/plugins/simplecolorpicker/jquery.simplecolorpicker.css">
  <link rel="stylesheet" href="./js/plugins/timepicker/bootstrap-timepicker.css">

    <!-- App CSS -->
  <link rel="stylesheet" href="./css/target-admin.css">
  <link rel="stylesheet" href="./css/custom.css">


  <script type="text/javascript" src="//code.jquery.com/jquery-1.8.3.js"></script>
  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  <![endif]-->
	<style>
	label {
		font-weight: 1;
	}
	 .small-size {
	font-size: 12px;
}
	</style>
</head>

<body>

 <?php include"includes/header.php"; ?>

<div class="container">

  <div class="content">

    <div class="content-container">

      

      <div class="content-header">
        <h2 class="content-header-title">Review Your Product and Submit</h2>
        <ol class="breadcrumb">
          <li><a href="sell.php">Choose Product Category</a></li>
          <li><a href="product_details.php">Give Product Description</a></li>
          <li class="active">Review Your Product and Submit</li>
        </ol>
      </div> <!-- /.content-header -->
		
		<?php if(isset($addProduct)): ?>
		<div class="portlet">
      
        <div class="portlet-header">
      
          <h3>
            <i class="fa fa-tasks"></i>
            Product Submitted
          </h3>
      
        </div> <!-- /.portlet-header -->
      
        <div class="portlet-content">
      
			<div class="form-horizontal">
				<div class="small-size">
					<?php echo $addProduct;?>
				</div>
			</div>
      
        </div> <!-- /.portlet-content -->
      
      </div> <!-- /.portlet -->
	  <?php else: ?>
	  
		<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
		
      <div class="portlet">
      
        <div class="portlet-header">
      
          <h3>
            <i class="fa fa-tasks"></i>
            Product Image Review
          </h3>
      
        </div> <!-- /.portlet-header -->
      
        <div class="portlet-content">
			<div class="form-horizontal">
				<?php 
				for($i=0;$i<count($_SESSION['prod_img']);$i++) { 
						echo "<div class='col-sm-3' id='img".$i."'>               
					   <div class='fileupload fileupload-new' data-provides='fileupload'>
						  <div class='fileupload-new thumbnail' style='width: 200px; height: 150px;'><img src='http://www.nativeafrika.com/prod_img/".$_SESSION['prod_img'][$i]."' alt='Placeholder' /></div>
						  <div class='fileupload-preview fileupload-exists thumbnail' style='max-width: 200px; max-height: 150px; line-height: 20px;'></div>
						</div></div>";
				}	 
			?>
			
			
			</div>
			
      
        </div> <!-- /.portlet-content -->
      
      </div> <!-- /.portlet -->
	  
      <div class="portlet">
      
        <div class="portlet-header">
      
          <h3>
            <i class="fa fa-tasks"></i>
            Product Details Review
          </h3>
      
        </div> <!-- /.portlet-header -->
      
        <div class="portlet-content">
      
			<div class="form-horizontal">
				<div class="small-size">
					<?php echo' <h3>Product Name</h3><blockquote><p>'.$_SESSION['prod_name'].'</p></blockquote>';?>
					<?php echo' <h3>Product Description</h3><blockquote><p>'.$_SESSION['prod_desc'].'</p></blockquote>';?>
					<?php echo' <h3>Price</h3><blockquote><p>Normal Price: N'.number_format($_SESSION['prod_price']).'<br /> Special Price: N'.number_format($_SESSION['special_price']).'</p></blockquote>';?>
					<?php echo' <h3>Product Weigth(kg)</h3><blockquote><p>'.$_SESSION['weigth'].'kg</p></blockquote>';?>
					<?php echo' <h3>Product Condition</h3><blockquote><p>'.$_SESSION['condition'].'</p></blockquote>';?>
					<?php echo' <h3>Product Quantity</h3><blockquote><p>'.$_SESSION['qty'].'</p></blockquote>';?>
					<?php echo' <h3>Product Brand</h3><blockquote><p>'.$_SESSION['brand'].'</p></blockquote>';?>
					<?php echo' <h3>Product Sizes</h3><blockquote><p>'.$_SESSION['size'].'</p></blockquote>';?>
				</div>
			</div>
      
        </div> <!-- /.portlet-content -->
      
      </div> <!-- /.portlet -->
	  
      <div class="portlet">
      
        <div class="portlet-header">
      
          <h3>
            <i class="fa fa-tasks"></i>
           Product Features & Specification Review
          </h3>
      
        </div> <!-- /.portlet-header -->
      
        <div class="portlet-content">
      
			<div class="form-horizontal">
				<div class="small-size">
					<?php 
						for($i=0;$i<count($_SESSION['feature_spec']);$i++) { 
							echo'<blockquote><p>'.$_SESSION['feature_spec'][$i].'</p></blockquote>';
						} 
					?>
				</div>
			</div>
      
        </div> <!-- /.portlet-content -->
      
      </div> <!-- /.portlet -->
	  
      <div class="portlet">
      
        <div class="portlet-header">
      
          <h3>
            <i class="fa fa-tasks"></i>
			Return Policy
          </h3>
      
        </div> <!-- /.portlet-header -->
      
        <div class="portlet-content">
      
			<div class="form-horizontal">
				<div class="small-size">
					<?php 
						if($_SESSION['return_policy']=="yes"){ 
							echo "<div class=\"alert alert-success\">I will accept returns for this item for 7 days after I deliver</div>";
						}else{
							echo "<div class=\"alert alert-danger\">I will not accept returns for this item for 7 days after I deliver</div>(Tips: If you offer returns, your sales will be higher)"; 
						} 
					?>
				</div>
			</div>
      
        </div> <!-- /.portlet-content -->
      
      </div> <!-- /.portlet -->

		<a href="product_details.php" class="btn bnt-default">Back</a>
	  <button type="submit" name="add_product" class="btn btn-success">Submit Product</button>
	</form>
	<?php endif; ?>
    </div> <!-- /.content-container -->
      
  </div> <!-- /.content -->

</div> <!-- /.container -->

<?php include"includes/footer.php"; ?>


  <script src="./js/libs/jquery-1.10.1.min.js"></script>
  <script src="./js/libs/jquery-ui-1.9.2.custom.min.js"></script>
  <script src="./js/plugins/select2/select2.js"></script>
  <script src="./js/libs/bootstrap.min.js"></script>
  <script src="./js/plugins/fileupload/bootstrap-fileupload.js"></script>
  <script src="./js/plugins/ckeditor/ckeditor.js"></script>
  
  <!-- Plugin JS -->
  <script src="./js/plugins/icheck/jquery.icheck.js"></script>
  <script src="./js/plugins/datepicker/bootstrap-datepicker.js"></script>
  <script src="./js/plugins/timepicker/bootstrap-timepicker.js"></script>
  <script src="./js/plugins/simplecolorpicker/jquery.simplecolorpicker.js"></script>
  <script src="./js/plugins/autosize/jquery.autosize.min.js"></script>
  <script src="./js/plugins/textarea-counter/jquery.textarea-counter.js"></script>
  <!--[if lt IE 9]>
  <script src="./js/libs/excanvas.compiled.js"></script>
  <![endif]-->
  <!-- App JS -->  <!-- Plugin JS -->
  <script src="./js/demos/form-extended.js"></script>
  <script src="./js/target-admin.js"></script>
  
<script>
	function addFeature(divName){
		var counter = 0;
		var newdiv = document.createElement('div');
		newdiv.innerHTML = "<div class='col-sm-6' id='spec"+counter+"'><div class='form-group'> <div class='input-group'><input class='form-control' name = 'feature_spec[]' placeholder='Type in a Feature or Specification' required id='appendedInputButton' type='text'><span class='input-group-btn'> <button class='btn btn-secondary btn-sm' type='button' onclick='removeElement(\"spec"+counter+"\");'>remove!</button>  </span> </div> </div></div>";
		 document.getElementById(divName).appendChild(newdiv);
		 
		 counter++;
	}

	function removeElement(element_id) {
		var elementid = document.getElementById(element_id);
		elementid.remove();
	}
</script>

  
</body>
</html>
