<?php
	include("includes/dbconfig.php");
	 
	include('Aira_settings.php');
	$pagetitle = "Dashboard";
	require('includes/applicationtop.php');
	require('includes/applicationmenu.php');
	 
	 
	 
?>
			<!-- Content Wrapper. Contains page content -->
			<div class="content-wrapper">
				<!-- Content Header (Page header) -->
				<section class="content-header">
					<h1>Dashboard</h1>
					<ol class="breadcrumb">
					</ol>
				</section>

				<!-- Main content -->
				<section class="content">
					 
					 
					
					 
					
					 
					 <?php  //display_order_items
				  $order_id =  $_SESSION["web_order"];
					
				 
					 
					  
						
						$web_orders = specific_web_orders($order_id);
						 
						 
						 
						
					 
						if($web_orders[0] >0){
							$order  = $order_id;
							 
							$_SESSION['webclient_id'] = $web_orders[2]; 
							
							$orders = web_order_products($order );
					?>
					
					<div class="card card-important">
						<div class="card-header  ">
							<h3 class="card-title">Customer Order details</h3>
							 
						</div><!-- /.box-header -->
						<div class="card-body"> 
								<table class="table no-margin">
								 
									<?php 
									
									echo $web_orders[1];
									
									?>
									 
									</tbody>
									 
								</table>
								<h4> Order Items</h4>
								
								
								
								<table class="table table-boardered table-striped">
									<thead>
										<tr>
										
										
											 <tr><th> #</th> <th>Item Name </th><th> Amount</th> <th>Qty </th><th>Total </th>   </tr> 
										</tr>
									</thead>
									<tbody>
									<?php 
									
									echo $orders[1] ;
									
									?>
									 
									</tbody>
									 
								</table>
							</div><!-- /.table-responsive -->
							
							
							
						</div><!-- /.box-body -->
				 
						<?php } ?>
				</section><!-- /.content -->
			</div><!-- /.content-wrapper -->

			 
		</div><!-- ./wrapper -->
		
		
      <div class="modal fade" id="Success">
        <div class="modal-dialog">
          <div class="modal-content ">
            <div class="modal-header bg-warning">
              <h4 class="modal-title">Confirm action</h4>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span></button>
            </div>
            <div class="modal-body">
              <p id =''>Are you sure you want to cancel this order</p>
            </div>
			<input type='hidden' id='Control' />
            <div class="modal-footer justify-content-between">
			
              <button type="button" class="btn btn-danger" data-dismiss="modal">No</button>
              <button type="button"   class="btn btn-success Cancel_proceed">Yes</button>
            </div>
          </div>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>

			<?php include ('includes/general_footer.php')?>
		<script>
		function Order_details(){
			 
			 var order =  $("input[name='Web_orders']:checked").val();
			  
			 
			 $.ajax({
		type: "POST",
		url: "process_web_order_start.php",
		data: {itemcode: order },
		 
		success: function(data){  
			 
			window.location.href = "process_online_order.php";
			 
			  
		}
		});
		
		
		
		}
		
			//Process_order
			$(".Process_order").click(function() {
			var order = $(this).val();
			 $.ajax({
				type: "POST",
				url: "process_web_order_start.php",
				data: {itemcode: order },
				 
				success: function(data){  
					 
					window.location.href = "process_online_order.php";
					 
					  
				}
		});
			 
		});
		
		 $(".Cancel_order").click(function() {
			var order = $(this).val();
			
			 $('#Control').val(order);
			  $('#Success').modal('show');
		 
			return false;  
			 
			 
		});
		 
		 $(".Cancel_proceed").click(function() {
			 
			
			 var order = $('#Control').val();
			  $('#Success').modal('hide');
			  alert();
			  
			  return false;
			 
			 
			    $.ajax({
				type: "POST",
				url: "order_cancelled.php",
				data: {itemcode: order },
				 
				success: function(data){  
					 
					window.location.href = "dashboard.php";
					 
					  
				}
		});
			 
		 });
		
		
		</script>
	</body>
</html>