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

if(isset($_GET['option'])){
    $option=$_GET['option'];
    $sql00="select * from menu_cat where  name='$option' ";
$result00 = mysqli_query($conn,$sql00)or die( mysqli_error($conn));
$row00=mysqli_fetch_array($result00);
   $option=$row00['name'] ;
    ;}

$page='Order by Bar options';?>
 
<!DOCTYPE html>
<html lang="en">
<?php include("common/head.php")?>
<?php
 if (isset($_POST['Add_to_cart'])) {
     if (isset($_SESSION['cart'])) {
         $session_array_id=array_column($_SESSION['cart'],"id");
         if (!in_array($_GET['id'],$session_array_id)) {
          $session_array=array(
               'id'=>$_GET["id"],
               "image"=>$_POST['image'],
               "orderid"=>$_POST['orderid'],
               "location"=>$_POST['location'],
               "name"=>$_POST['name'],
               "date"=>$_POST['dates'],
               "discription"=>$_POST['discription'],
               "quantity"=>$_POST['quantity'],
                "price"=>$_POST['price']);
          $_SESSION['cart'][]=$session_array;
         }
     }
     else {
          $session_array=array(
               'id'=>$_GET["id"],
              "image"=>$_POST['image'],
              "location"=>$_POST['location'],
              "orderid"=>$_POST['orderid'],
              "name"=>$_POST['name'],
              "date"=>$_POST['dates'],
               "discription"=>$_POST['discription'],
               "quantity"=>$_POST['quantity'],
          "price"=>$_POST['price']);
          $_SESSION['cart'][]=$session_array;
     }
 }
 
 $cat="";



 if (isset($_GET['category'])) {
    $cat=$_GET['category']; 
    $general='none'; 
    $cart='block'; 
}
else{
    $cat='';
    $general='block';
    $cart='none';
}
 ?>
<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 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  href="dashboard"class=" btn-order  text-center btn ">
                     <p class="text-center  order-text-order-managment">All Menu</p>
                 </a>
             </div>
             <div class="col-sm-2 ">
                 <a   href="order_bar" class="collapsed btn-order bg-primary   text-center btn ">
                     <p class="text-center order-text-order-managment">Bar</p>
                 </a>
             </div>
             <div class="col-sm-2 ">
                 <a href="order_rest"class=" btn-order collapsed text-center btn ">
                     <p class="text-center order-text-order-managment">Restaurant</p>
                 </a>
             </div>
             <div class="col-sm-2 ">
                 <a href="pole"class=" btn-order  collapsed text-center btn ">
                     <p class="text-center order-text-order-managment">Pool</p>
                 </a>
             </div>
             <div class="col-sm-2 ">
                 <a href="facility"class=" btn-order  collapsed text-center btn ">
                     <p class="text-center order-text-order-managment">Facility</p>
                 </a>
             </div>

             <div class="col-sm-2 ">
                 <a href="pole_leason"class=" btn-order  collapsed text-center btn ">
                     <p class="text-center order-text-order-managment">Pool Leason</p>
                 </a>
             </div>
         </div>
     </div>
 </div>


</center> 
<hr>
                <!--info Section start
               <div class="ads">
                <img style="width: 100%; height: 200px;" src="Image/360_F_504084251_S3KmrYmDWhqxc7rwEedTn5zsTSX9hwVZ.jpg" alt="">
               </div>
               <hr class="bg-success">
               info Section end-->

               <!--search section start-->

              
      <center>
        <div class="row no-gutters">
            <div class="col-sm-12">

      
     
                <h5>Categories <?php echo $cat ?></h5>
              
    
                <div id="filters" class="d-flex menu-cat button-group">
               
                <?php

include("conn.php");

$sql="select * from menu_cat where status='1' and location='Bar' ";
$result = mysqli_query($conn,$sql)or die( mysqli_error($conn));
while ($row=mysqli_fetch_array($result)) {
 $data=$row['id'];
   $name=$row['name'];
   $image=$row['image'];
   $status=$row['status'];


 

?>
                    <div class="col-sm-2 ">
                        <a href="order_bar_option.php?option=<?= $row['name']?>" class=" btn-order text-white  text-center  btn ">
                            <img style="width: 40px;height: 40px;" src="image/<?php echo $image ?>" alt="">
                            <p class="text-center order-text"><?php echo $name ?></p>
                        </a>
                    </div>

                    <?php } ?>
                </div>
            </div>
        </div>
      
      </center>            
      <hr class="bg-success">
                <!--search section end-->
                <!--Orders start-->
                <h5 class="text-center">Menu</h5>
            
             
      <body>  
         
      <div style="display:<?php echo $general ?>" id="general" class="menu  d-flex flex-wrap no-gutters ">
                   
                   <!--menu items 1-->
                   <?php

include("conn.php");

$sql="select * from menu  where category='$option'";
$result = mysqli_query($conn,$sql)or die( mysqli_error($conn));
while ($row=mysqli_fetch_array($result)) {
$data=$row['id'];
  $name=$row['name'];
  $category=$row['category'];
  $discription=$row['discription'];
  $image=$row['image'];
  $status=$row['status'];
  $price=$row['price'];
  

$link="delete/del_blog.php?id=".urlencode(base64_encode($data));
$edit_user="edit/edit_user.php?id=".urlencode(base64_encode($data));
$activate="edit/user_status.php?id=".urlencode(base64_encode($data));
$dat=$data;


$text='';

if ($status==='1') {
  $text='Active';
  $read='btn-success';
  $de='deactivate';
  $sta=0;
}
                           else {
  $text='Inactive';
  $read='btn-danger';
 $de='activate';
 $sta=1;
}
$cart_button_text='Add to Cart';
$cart_button_color='bg-warning'; 

$orderid=1;
?>
 <iframe name="votar" style="display:none;"></iframe>
<form method="post" action="index.php?id=<?= $row['id']?>"  target="votar">
                   <div id="pizza" class="menu-items <?php echo $category ?>">
                       <div class="d-flex ">
                           <img style="width: 90px;  margin: 10px;" src="image/<?php echo $image ?>" alt="">
                           <div class="menu-text">
                               <p class="menu-tittle mt-1"><b><?php echo $name ?></b></p>
                               <hr class="bg-white m-0">
                               <br>
                           <P class="menu-dis"><?php echo $discription ?></P>
                           <div class="menu-tag">
                               <div class="counter">
                                   <p class="menu-price "><b>₵<?= number_format($price,2) ?></b></p>
                                   <span class="down" onClick='decreaseCount(event, this)'>-</span>
                                   <input type="text" name="quantity" value="1">
                                   <span class="up" onClick='increaseCount(event, this)'>+</span>
               
                                 </div>
                           </div>
                           </div>
                          
                       </div>
                       <input type="hidden" name="name" value="<?=$row['name']?>">
                       <input type="hidden" name="price" value="<?=$row['price']?>">
                       <input type="hidden" name="discription" value="<?=$row['discription']?>">
                       <input type="hidden" name="image" value="<?=$row['image']?>">
                       <input type="hidden" name="location" value="<?=$row['itemlocation']?>">
                       <input type="hidden" name="dates" value="<?php echo date("F j, Y") ?>">
                       <input type="hidden" name="orderid" value="<?=$order_id?>">
                       <input class="form-control m-2" type="text" name="note" placeholder="Note">
                       <input type="submit" class="btn btn-warning btn-block m-2" name="Add_to_cart" value="Add to cart">
                   </div>

                   </form>
                   <?php }  ?>
                   
               </div>
                <!--Order end-->
            </div>
            <!--Main body end-->

            <!--Invoice Section start
           <div id="myDIV" class="col-sm-3 invoice mt-2">
           
           
            <h5 class="invoice-title text-center">Customer Details</h5>

            <form class="m-2">
                <div class="form-group">
                  <label for="exampleInputEmail1">Full Name</label>
                  <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter Customer name">
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Contact</label>
                  <input type="number" class="form-control" id="exampleInputPassword1" placeholder="Contact Number">
                </div>
              </form>

            <h5 class="invoice-title text-center">Invoice</h5>
            <div class="d-flex invoice-item  m-2">
            <i class="fa fa-times" aria-hidden="true"></i>
                <div class="img-invoice">
                    <img src="Image/fli2.png" alt="">
                </div>
                <div class="text-invoice">
                   <span class="text-white"><b>Platter of grilled lamb</b></span><br>
                   <span class="text-white">2x</span> <br>
                   <span class="text-white">Small pepper</span> <br>
                   <div class="menu-tag ">
                    <div class="row no-gutters">
                        <div class="invoice-price col-6">
                            <b> ₵400</b>
                        </div>
                        <div class="invoice-quantity col-6">
                            <span class="down" onClick='decreaseCount(event, this)'>-</span>
                            <input type="text" value="1">
                            <span class="up" onClick='increaseCount(event, this)'>+</span>
                        </div>

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

          

            <h5 class="invoice-title text-center"> Payment Method</h5>
            <div class="pament-button text-center">
               
                <button  class=" btn-payment btn-outline-light  text-center btn ">
                    <i class="fa fa-money" aria-hidden="true"></i>
                    <p class="text-center">Mobile</p>
                </button>

                <button  class=" btn-payment btn-outline-light  text-center btn ">
                    <i class="fa fa-mobile" aria-hidden="true"></i>
                    <p class="text-center">Mobile</p>
                </button>

                <button  class=" btn-payment btn-outline-light  text-center btn ">
                    <i class="fa fa-cc-visa" aria-hidden="true"></i>
                    <p class="text-center">Bank </p>
                </button>
              
                <h5 class="invoice-title text-center">Receipt</h5>
                <div class="receipt  bg-light text-dark">
                    <div class="reciept-title text-center">
                        <p>The Kamb  Restaurant 189,<br> Accra awoshi <br> 0540948579</p>
                    </div>

                    <div class="reciept-menu text-center">
                        <div class="reciept-items ">
                            <div class="receipt-list1 ml-1 "><p><b>Order :</b> 26</p> </div>
                            <div class="receipt-list2  "> <p> 1/19/2024</p></div>
                            </div>
                            <div class="reciept-items ">
                             <div class="receipt-list1 ml-1 "><p><b>Host :</b> Margret</p> </div>
                             <div class="receipt-list2  "> <p>7:37 am</p></div>
                             </div>
         
                             <div class="reciept-items ">
                                 <div class="receipt-list1 ml-1 "><p>2 Platter of grilled lamb</p> </div>
                                 <div class="receipt-list2  "> <p>₵100</p></div>
                             </div>
         
                             <div class="reciept-items ">
                                 <div class="receipt-list1 ml-1 "><p>4 Burger Cheaps</p> </div>
                                 <div class="receipt-list2  "> <p>₵300</p></div>
                             </div>
         
                             <div class="reciept-items ">
                                 <div class="receipt-list1 ml-1 "><p>2 Pizza with tomatos</p> </div>
                                 <div class="receipt-list2  "> <p>₵100</p></div>
                             </div>

                    </div>
                 

                    <div class="total">
                        <p>Subtotal : ₵500</p>
                        <p>Tax : ₵50</p>
                        <p>Total :  ₵550</p>
                        <p>Payment Method : MoMo</p>
                    </div>
                    <div class="reciept-title text-center">
                        <p style="font-size: 12px;">Customer Copy<br> Thank you for Visiting <br>The Kamb  Restaurant</p>
                    </div>
                        
                </div>

                <button class="btn btn-success"> Confirm Payment</button>
                
            </div>
            

           </div>
            Invoice Section end-->


        </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>
   <script>
     $(document).ready(function(){  
      $('.view_datas').click(function(){  
           var employee_ids = $(this).attr("id");  
           $.ajax({  
                url:"cart.php",  
                method:"post",  
                data:{employee_ids:employee_ids},  
                success:function(data){  
                     $('#employee_detail1').html(data);  
                     $('#dataModal1').modal("show");  
                }  
           });  
      });  
 });  
   </script>
</body>

</html>