<?php include("conn.php");
$page='Order Management Bar';?>
<!DOCTYPE html>
<html lang="en">
<?php include("common/head.php")?>
<body>
     <div class="">
        <div class="row no-gutters ">
            <!--Tittle bar start-->
            <?php include("common/tittle.php")?>
            <!--Tittle bar end-->

            <!--Nav menu Start-->
            <?php include("common/menu.php")?>
            <!--Nav menu end-->

            <!--Main body Start-->
            <div id="accordions" class="col-sm-11  mt-2">
              
      <center>
        <div class="row no-gutters">
            <div class="col-sm-12">
                <div id="filters" class="d-flex button-group">
                    <div class="col-sm-2 ">
                        <a data-toggle="collapse" href="prepare_order_bar"class=" btn-order  text-center btn ">
                            <i class="fa fa-hourglass-half" aria-hidden="true"></i>
                            <p class="text-center order-text-order-managment">Orders</p>
                        </a>
                    </div>
                    <div class="col-sm-2 ">
                        <a  href="order_status" class="btn-order text-center btn ">
                            <i class="fa fa-check-square-o" aria-hidden="true"></i>
                            <p class="text-center order-text-order-managment">Order Status</p>
                        </a>
                    </div>
                    <div class="col-sm-2 ">
                        <a href="order_by_customer"class=" btn-order  collapsed text-center btn ">
                            <i class="fa fa-times" aria-hidden="true"></i>
                            <p class="text-center order-text-order-managment">Orders By Customer</p>
                        </a>
                    </div>
                    <div class="col-sm-2 ">
                        <a href="#collapseFour" class="collapsed btn-order  text-center btn " data-toggle="collapse">
                            <i class="fa fa-cog" aria-hidden="true"></i>
                            <p class="text-center order-text-order-managment">Settings</p>
                        </a>
                    </div>
                  
                </div>
            </div>
        </div>
      
      </center> 
      <hr class="bg-success">
                <!--search section end-->
                <!--Orders start-->

                <!--order-items-->
                <!--order-items-one-->
               <div  id="collapseOne" class="orders collapse show " data-parent="#accordions">
                    <h5 class="text-center">Current Orders</h5>
                    <div class="menu-oders  row no-gutters" >
                   

                <?php 

$sql2="SELECT * FROM currency ";
$result2 = mysqli_query($conn,$sql2)or die( mysqli_error($conn));
$row2=mysqli_fetch_array($result2) ;
$currency=$row2['curency'];

                $sql="select * from orders where status='0' and location='Bar' ";
                $result = mysqli_query($conn,$sql)or die( mysqli_error($conn));
                while ($row=mysqli_fetch_array($result)) {
                $order_id=$row['orderid'];
                $item_id=$row['item_id'];
                    $real_id=substr($order_id,-2);
                    $ord = sprintf('%03d',$real_id); 
                    $sql3="SELECT * FROM menu  WHERE id=$item_id";
                    $result3 = mysqli_query($conn,$sql3)or die( mysqli_error($conn));
                    $row2=mysqli_fetch_array($result3) ;

                ?>
                
              <!--menu items 1-->
                        <div id="pizza" class=" col-sm-3 menu-items-order-managment  pizza">
                            <h4 class="text-center">#<?php echo $ord?></h4>
                            <hr class="bg-success">
                            <div class="d-flex ">
                                <img style="width: 90px; height: 90px; margin: 5px;" src="Image/<?php echo $row2['image']?>" alt="">
                                <div class="menu-text">
                                    <p class="menu-tittle m-2"><b><?php echo $row['item_name']?></b></p><br>
                                <P class="menu-dis m-1"><?php echo $row2['discription']?></P>
                                <p><?php echo $row['quantity']?>X</p>
                                <div class="menu-tag">
                                    <div class="counter">
                                        <p class="menu-price-order-managment "><b><?php echo $currency?><?php echo number_format($row['price'],2)?></b></p>
                                      </div>
                                </div>
                                </div>
                            </div>
                            <div class="action bg-dark text-center">
                                <a href="edit/confirm_order.php?id=<?php echo $row["id"]; ?>" class="btn m-2 btn-outline-success"> <i class="fa fa-check-square-o" aria-hidden="true"></i></a>
                                <input  type="button" name="view" value="Cancel" id="<?php echo $row["id"]; ?>" class="btn m-2 btn-outline-danger view_data"> 
                            </div>
                           
                        </div>
    
                   <?php } ?>
 
    
    
<!-- Small modal -->
<div id="dataModal"  class="modal fade bd-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div id="employee_detail" class="modal-content text-dark">
     
    
    
    </div>
  </div>
</div>

                        
                        
                    </div>
    

                </div>


 
        <!--  isotope plugin cdn  -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin="anonymous"></script>
    <script src="js/script.js"></script>
     <!-- jQuery js-->
 
     <!-- Bootstrap js -->
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
     <!-- jQuery Datatable js -->
     <script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
     <!-- Bootstrap Datatable js -->    
     <script src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js"></script>
     <script>
       $(document).ready( function () {
           $('#example_table').DataTable();
       } );

     $(document).ready(function(){  
      $('.view_data').click(function(){  
           var employee_id = $(this).attr("id");  
           $.ajax({  
                url:"cancel_order_reason.php",  
                method:"post",  
                data:{employee_id:employee_id},  
                success:function(data){  
                     $('#employee_detail').html(data);  
                     $('#dataModal').modal("show");  
                }  
           });  
      });  
 });  
</script>
</body>

</html>