<?php   session_start(); include 'xyz.php';?>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1">
		<?php  include 'inc/outl_toplinks.php'; ?>
		<link rel="stylesheet" type="text/css" href="css/outl_ulib.css">
</head>
	<body><?php include 'inc/outl_header.php';  include 'inc/outl_nav.php'; include 'process.php';  ?>
	



		


<!-- SECTION -->
		<div class="section">
			<!-- container -->
			<div class="container">
				<!-- row -->
				<div class="row">

					<!-- section title -->
					<div class="col-md-12">
						<div class="section-title"><h4 class="title">Customer Panel</h4><div class="section-nav">
								<ul class="section-tab-nav tab-nav">

<li class="active"><a data-toggle="tab" href="#menus1">Cart Items</a></li>
<li class=""><a data-toggle="tab" href="#menus2">Purchased</a></li>
<!-- <li class=""><a data-toggle="tab" href="#menus3">Accounts</a></li> -->
<li class=""><a data-toggle="tab" href="#menus4">Settings</a></li>
<!-- <li class=""><a data-toggle="tab" href="#menus5">Profile</a></li> -->
</ul></div></div></div>
					<!-- /section title -->

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

	<div class="tab-content">

<div id="menus1" class="tab-pane fade in active">
	<div class="row">

<?php 
if(QueryDB("SELECT COUNT(*) FROM payment where cus_id ='".$_SESSION['mycus']."' and pay_status=0 ")->fetchColumn()>0){
foreach(QueryDB("SELECT * FROM payment where cus_id ='".$_SESSION['mycus']."' and pay_status=0 ")as $listProd){
		$dateReg = $listProd['day'];
		$nameExp = explode(',',$listProd['item']);
		$itemQty = explode(',',$listProd['qty']);
		$itemSingle = explode(',',$listProd['s_price']);
		$itemBulks = explode(',',$listProd['bulk_price']);
		$whereNum = $listProd['id'];
	?>

<div class="col-md-12 bg-danger" style="padding:20px;">
	
	<?php   $addAll=0;
for($y=0;$y<count($nameExp);$y++){
		$itemFull = getProduct($nameExp[$y]);
 ?>
<div class="col-md-4"><?php  echo $itemFull['item_name'].' '.$company[$itemFull['company']].' '.$brand[$itemFull['brand']]; ?>

	<a href="" class="delCart" name="<?php echo $listProd['id']; ?>" id="<?php echo $y; ?>" onclick="return confirm('Are you Sure?');"><i class="fa fa-trash text-danger"  ></i></a>
	<br> <img src="<?php  echo explode(',',str_replace('../','',$itemFull['item_img'] ))[0];  ?>" alt="Item Image" style="width:100px;height:100px;">

<?php $inStock =  totalStock($itemFull['id'],'','')-getQuantity($itemFull['id'],'','');
if($inStock>0){  echo $inStock.' In Stock'; }else{ echo '<b style="color:red;">Out Stock</b>'; }
?>
<span style="display:none;" id="itemCounts<?php echo $y; ?>" class="<?php echo $inStock; ?>"></span>


</div>
<div class="col-md-3"><?php  echo '<b>Size:</b>&nbsp;'.$sized_by[$itemFull['size']].'&nbsp; <b>Colour:</b>'.$colored_by[$itemFull['color']]; ?></div>

<div class="col-md-1"><div class="input-number">
	<input type="number" readonly required value="<?php echo $itemQty[$y]; ?>" id="growNumb<?php echo $y; ?>"><span class="qty-up" id="grow<?php echo $y; ?>">+</span><span class="qty-down" id="grDown<?php echo $y; ?>">-</span>
</div></div>

<div class="col-md-2 myPrs<?php echo $y; ?>" id="<?php echo $itemSingle[$y];  ?>"> <p><b>Item Cost:</b> &#8358;<?php echo $itemSingle[$y];  ?></p></div>
<div class="col-md-2"> <p><b>Total Cost:</b> &#8358;<span class="bulkSummed" id="addPrice<?php echo $y; ?>"><?php echo $itemBulks[$y];  ?></span></p></div>
<div class="col-md-12" style="border-bottom:2px solid black;"></div>
<?php $addAll+=$itemBulks[$y]; } ?>
<div class="col-md-6" style="border-bottom:2px solid black;margin-top:10px;">
	<h3>TOTAL: &#8358;<span id="overTotal"><?php echo $addAll; ?></span> </h3>
	<p><?php echo $listProd['day'];  ?></p>
</div> 
<div class="col-md-3" style="margin-top:10px;"><a href="index" class="btn btn-primary">Continue Shopping</a></div>
<div class="col-md-3" style="margin-top:10px;"><a href="checkout" class="btn btn-success">Checkout</a></div>

</div>

<?php  }}else{  ?>
<div class="col-md-12"><h5 class="text-danger"><center><img src="icons8-empty-set-50.png">Cart is Empty!</center></h5></div>
<?php  } ?>

</div></div>

<div id="menus2" class="tab-pane fade ">
<div class="col-md-12"><h4>Purchased Items</h4>
<span>This only shows purchases for which payment was Successful or Approved</span>
</div>

	<div class="row">

<?php 
if(QueryDB("SELECT COUNT(*) FROM payment where cus_id ='".$_SESSION['mycus']."' and pay_status=1 ")->fetchColumn()>0){
foreach(QueryDB("SELECT * FROM payment where cus_id ='".$_SESSION['mycus']."' and pay_status=1 ")as $listProd){
		$dateReg = $listProd['day'];
		$nameExp = explode(',',$listProd['item']);
		$itemQty = explode(',',$listProd['qty']);
		$itemSingle = explode(',',$listProd['s_price']);
		$itemBulks = explode(',',$listProd['bulk_price']);
		$whereNum = $listProd['id'];
	?>

<div class="col-md-12 bg-success" style="padding:20px;">
	
	<?php   $addAll=0;
for($y=0;$y<count($nameExp);$y++){
		$itemFull = getProduct($nameExp[$y]);
 ?>
<div class="col-md-4"><?php  echo $itemFull['item_name'].' '.$company[$itemFull['company']].' '.$brand[$itemFull['brand']]; ?>
	<br> <img src="<?php  echo explode(',',$itemFull['item_img'])[0];  ?>" alt="Item Image" style="width:100px;height:100px;">


</div>
<div class="col-md-3"><?php  echo '<b>Size:</b>&nbsp;'.$sized_by[$itemFull['size']].'&nbsp; <b>Colour:</b>'.$colored_by[$itemFull['color']]; ?></div>

<div class="col-md-1"><div class="input-number">
<strong>Qty:</strong> <?php echo $itemQty[$y]; ?>x
</div></div>

<div class="col-md-2"> <p><b>Item Cost:</b> &#8358;<?php echo $itemSingle[$y];  ?></p></div>
<div class="col-md-2"> <p><b>Total Cost:</b> &#8358;<span><?php echo $itemBulks[$y];  ?></span></p></div>
<div class="col-md-12" style="border-bottom:2px solid black;"></div>
<?php $addAll+=$itemBulks[$y]; } ?>

</div>

<div style="background:white; margin-top:10px;box-shadow: 5px 5px 10px gray;padding:10px;">
<div class="col-md-4"><strong>Status: </strong><?php echo billerStatus($listProd['id']);  ?></div> 
<div class="col-md-8"><strong>Receipt ID: <?php echo ($listProd['receipt_id']);  ?></strong> </div>
<div class="col-md-4"><strong>Pay Method: <?php echo pay_MTH($listProd['pay_mth']);  ?></strong> </div>
<div class="col-md-4"><strong>Pay Date: <?php echo ($listProd['date_paid']);  ?></strong> </div>
<div class="col-md-4"><strong>Amount Paid: &#8358;<?php echo number_format($listProd['amt_paid'],2);  ?></strong> </div>
</div>

<?php  }}else{?>
<div class="col-md-12"><h5 class="text-danger"><center><img src="icons8-empty-set-50.png">Cart is Empty!</center></h5></div>
<?php  } ?>


</div>


</div>

<!-- <div id="menus3" class="tab-pane fade  ">
<div class="col-md-12"><h4>Track Product Purchased.</h4></div>
</div> -->

<div id="menus4" class="tab-pane fade  ">
<div class="row" style="min-height:50px;box-shadow: 5px 4px 60px gray;margin-top:10px;">
	<h5 style="text-align:center;background: red;color:white;padding:10px;">MODIFY INFORMATION</h5>
<form action="" method="POST">
<div class="form-group col-md-4"><input type="text" name="eqPhone" class="form-control" required placeholder="Phone Number" maxlength="11" minlength="11" value="<?php echo $results['frm_phone'];  ?>"></div>

<div class=" form-group  col-md-4 mb-2">
<select onchange="toggleLGA(this);" name="pcountry" id="state" class="form-control" required>
<option value="" selected="selected">- Select State-</option>
<option value="Abia" <?php if($results['country']=='Abia'){ echo 'selected';}  ?>>Abia</option>
<option value="Adamawa" <?php if($results['country']=='Abia'){ echo 'selected';}  ?> >Adamawa</option>
<option value="AkwaIbom" <?php if($results['country']=='AkwaIbom'){ echo 'selected';}  ?> >AkwaIbom</option>
<option value="Anambra" <?php if($results['country']=='Anambra'){ echo 'selected';}  ?> >Anambra</option>
<option value="Bauchi" <?php if($results['country']=='Bauchi'){ echo 'selected';}  ?> >Bauchi</option>
<option value="Bayelsa" <?php if($results['country']=='Bayelsa'){ echo 'selected';}  ?> >Bayelsa</option>
<option value="Benue" <?php if($results['country']=='Benue'){ echo 'selected';}  ?> >Benue</option>
<option value="Borno" <?php if($results['country']=='Borno'){ echo 'selected';}  ?> >Borno</option>
<option value="Cross River" <?php if($results['country']=='Cross River'){ echo 'selected';}  ?> >Cross River</option>
<option value="Delta" <?php if($results['country']=='Delta'){ echo 'selected';}  ?> >Delta</option>
<option value="Ebonyi" <?php if($results['country']=='Ebonyi'){ echo 'selected';}  ?> >Ebonyi</option>
<option value="Edo" <?php if($results['country']=='Edo'){ echo 'selected';}  ?> >Edo</option>
<option value="Ekiti" <?php if($results['country']=='Ekiti'){ echo 'selected';}  ?> >Ekiti</option>
<option value="Enugu" <?php if($results['country']=='Enugu'){ echo 'selected';}  ?> >Enugu</option>
<option value="FCT" <?php if($results['country']=='FCT'){ echo 'selected';}  ?> >FCT</option>
<option value="Gombe" <?php if($results['country']=='Gombe'){ echo 'selected';}  ?> >Gombe</option>
<option value="Imo" <?php if($results['country']=='Imo'){ echo 'selected';}  ?> >Imo</option>
<option value="Jigawa" <?php if($results['country']=='Jigawa'){ echo 'selected';}  ?> >Jigawa</option>
<option value="Kaduna" <?php if($results['country']=='Kaduna'){ echo 'selected';}  ?> >Kaduna</option>
<option value="Kano" <?php if($results['country']=='Kano'){ echo 'selected';}  ?> >Kano</option>
<option value="Katsina" <?php if($results['country']=='Katsina'){ echo 'selected';}  ?> >Katsina</option>
<option value="Kebbi" <?php if($results['country']=='Kebbi'){ echo 'selected';}  ?> >Kebbi</option>
<option value="Kogi" <?php if($results['country']=='Kogi'){ echo 'selected';}  ?> >Kogi</option>
<option value="Kwara" <?php if($results['country']=='Kwara'){ echo 'selected';}  ?> >Kwara</option>
<option value="Lagos" <?php if($results['country']=='Lagos'){ echo 'selected';}  ?> >Lagos</option>
<option value="Nasarawa" <?php if($results['country']=='Nasarawa'){ echo 'selected';}  ?> >Nasarawa</option>
<option value="Niger" <?php if($results['country']=='Niger'){ echo 'selected';}  ?> >Niger</option>
<option value="Ogun" <?php if($results['country']=='Ogun'){ echo 'selected';}  ?> >Ogun</option>
<option value="Ondo" <?php if($results['country']=='Ondo'){ echo 'selected';}  ?> >Ondo</option>
<option value="Osun" <?php if($results['country']=='Osun'){ echo 'selected';}  ?> >Osun</option>
<option value="Oyo" <?php if($results['country']=='Oyo'){ echo 'selected';}  ?> >Oyo</option>
<option value="Plateau" <?php if($results['country']=='Plateau'){ echo 'selected';}  ?> >Plateau</option>
<option value="Rivers" <?php if($results['country']=='Rivers'){ echo 'selected';}  ?> >Rivers</option>
<option value="Sokoto" <?php if($results['country']=='Sokoto'){ echo 'selected';}  ?> >Sokoto</option>
<option value="Taraba" <?php if($results['country']=='Taraba'){ echo 'selected';}  ?> >Taraba</option>
<option value="Yobe" <?php if($results['country']=='Yobe'){ echo 'selected';}  ?> >Yobe</option>
<option value="Zamfara" <?php if($results['country']=='Zamfara'){ echo 'selected';}  ?> >Zamafara</option></select></div>

<div class="form-group col-md-4 mb-2"><select name="pstate" id="lga" class="form-control select-lga" required><option value="<?php echo $results['state']; ?>"><?php echo $results['state']; ?></option>
</select></div>

<div class="form-group col-md-12"><textarea class="form-control" name="eqAddress" placeholder="Address"><?php echo $results['address'];  ?></textarea></div>

<div class="col-md-12" style="margin-top:5px;margin-bottom: 10px;"><input type="submit" name="EditReg" value="modify" class="form-control btn btn-secondary" style="background:red;color:white"></div></form></div><!--/row settings-->

<div class="row" style="min-height:50px;box-shadow: 5px 4px 60px gray;margin-top:10px;">
	<h5 style="text-align:center;background: black;color:white;padding:10px;"><strong>CHANGE PASSWORD</strong></h5>
<form action="" method="POST">
<div class="form-group col-md-4"><input type="text" name="currPass" class="form-control" required placeholder="Current Password"></div>
<div class="form-group col-md-4"><input type="password" name="newPass" class="form-control" required placeholder="New Password"></div>
<div class="form-group col-md-4"><input type="password" name="newPass_" class="form-control" required placeholder="Repeat New Password"></div>
<div class="col-md-12" style="margin-top:5px;margin-bottom: 10px;"><input type="submit" name="chgPass" value="Change Password" class="form-control btn btn-secondary" style="background:red;color:white"></div>

        </form></div><!--/row settings-->


</div>





  </div></div></div></div><!--/row-->

<div class="row" style="min-height:50px;box-shadow: 5px 4px 60px gray;margin-top:10px;">
	<h5 style="text-align:center;background: red;color:white;padding:10px;">CUSTOMER INFORMATION</h5>
<div class="col-md-3" ><p><strong>Name: </strong><?php  echo $results['frm_name'];  ?></p></div>
<div class="col-md-3" ><p><strong>Email: </strong><?php  echo $results['frm_email'];  ?></p></div>
<div class="col-md-3" ><p><strong>Phone: </strong><?php  echo $results['frm_phone'];  ?></p></div>
<div class="col-md-3" ><p><strong>Gender: </strong><?php  echo $results['gender'];  ?></p></div>
<div class="col-md-12" ><p><strong>Address: </strong><?php  echo $results['address'].','.$results['state'].','.$results['country'];  ?></p></div></div>


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



		<?php  //include 'inc/outl_hotdeals.php';  ?>

		






















		<?php //include 'inc/outl_topselling.php'; //include 'inc/outl_topselling2.php';
//include 'inc/outl_newsletter.php';

		 ?>






	






		



		<?php include 'inc/outl_newsbottom.php'; include 'inc/outl_footer.php';  include 'js/outl_footlinks.php'; ?>
<script type="text/javascript">
	$rowNumber ="<?php echo $whereNum;  ?>";
$('[id^=grow]').click(function(e){ $thisID = $(this).attr('id').slice(4);
	getNumb = parseInt($('#growNumb'+$thisID).val());

if($('#growNumb'+$thisID).val() > parseInt($('#itemCounts'+$thisID).attr('class'))-1){
	$('#growNumb'+$thisID).val(parseInt($('#itemCounts'+$thisID).attr('class')));
}else{
	$('#growNumb'+$thisID).val(getNumb++);
}
  

getPrice =$('.myPrs'+$thisID).attr('id'); $currentPrice =$('#growNumb'+$thisID).val()*getPrice; 
$('#addPrice'+$thisID).html($currentPrice);

var items = $('.bulkSummed'),sum = 0;
$.each(items, function(value) {
  var itemValue = parseFloat(items[value].innerHTML);
  sum += !isNaN(itemValue) ? itemValue : 0;
});
$('#overTotal').text(sum);

//update Table
$.ajax({data: {Mrow:$rowNumber,colsIndex:$thisID,newQty:$('#growNumb'+$thisID).val()},type: "post",url: "ajaxpage",success: function(data){
 if(data==1){
swal({text:'Item Qty Updated',type:'success',title:'Updated'},function(){ window.location = '';});
 }
},error: function(jqXHR, textStatus, errorThrown) { 
$(function(){ setTimeout(function() { alert('There was an Error');}, 5000);})}
});




})
$('[id^=grDown]').click(function(e){$thisID = $(this).attr('id').slice(6);
	getNumb = parseInt($('#growNumb'+$thisID).val());
	$('#growNumb'+$thisID).val(getNumb--);
if(getNumb<1){ $('#growNumb'+$thisID).val(1) }
getPrice =$('.myPrs'+$thisID).attr('id');
$('#addPrice'+$thisID).html($('#growNumb'+$thisID).val()*getPrice);

var items = $('.bulkSummed'),sum = 0;
$.each(items, function(value) {
  var itemValue = parseFloat(items[value].innerHTML);
  sum += !isNaN(itemValue) ? itemValue : 0;
});
$('#overTotal').text(sum);

//update Table
$.ajax({data: {Mrow:$rowNumber,colsIndex:$thisID,newQty:$('#growNumb'+$thisID).val()},type: "post",url: "ajaxpage",success: function(data){
 if(data==1){
swal({text:'Item Qty Updated',type:'success',title:'Updated'},function(){ window.location = '';});
 }
},error: function(jqXHR, textStatus, errorThrown) { 
$(function(){ setTimeout(function() { alert('There was an Error');}, 5000);})}
});


})




	$('.delCart').click(function(e){ e.preventDefault();
		$rowNumber =$(this).attr('name');
		$where =$(this).attr('id');
$.ajax({data: {row:$rowNumber,where:$where},type: "post",url: "ajaxpage",success: function(data){``
 if(data==1){
swal({text:'Item Deleted',type:'success',title:'Updated'},function(){ window.location = '';});
 }
},error: function(jqXHR, textStatus, errorThrown) { 
$(function(){ setTimeout(function() { alert('There was an Error');}, 5000);})}
});




	})


</script>


	</body>
</html>
