<!DOCTYPE html>
<html lang = "en">
<head>
<?php   include('conn.php');
$page='Add Order Manually';
include 'common/head.php'; ?>
 <link rel="stylesheet" href="css/dash.css">
</head>



<style>
 
 * { box-sizing: border-box; }

body {
  font-family: sans-serif;
}

/* ---- input ---- */

input[type="text"] {
  font-size: 20px;
}

/* ---- button ---- */

.button {
  display: inline-block;
  padding: 0.5em 1.0em;
  margin-bottom: 10px;
  background: #EEE;
  border: none;
  border-radius: 7px;
  background-image: linear-gradient( to bottom, hsla(0, 0%, 0%, 0), hsla(0, 0%, 0%, 0.2) );
  color: #222;
  font-family: sans-serif;
  font-size: 16px;
  text-shadow: 0 1px white;
  cursor: pointer;
}

.button:hover {
  background-color: #8CF;
  text-shadow: 0 1px hsla(0, 0%, 100%, 0.5);
  color: #222;
}

.button:active,
.button.is-checked {
  background-color: #28F;
}

.button.is-checked {
  color: white;
  text-shadow: 0 -1px hsla(0, 0%, 0%, 0.8);
}

.button:active {
  box-shadow: inset 0 1px 10px hsla(0, 0%, 0%, 0.8);
}

/* ---- button-group ---- */

.button-group:after {
  content: '';
  display: block;
  clear: both;
}

.button-group .button {
  float: left;
  border-radius: 0;
  margin-left: 0;
  margin-right: 1px;
}

.button-group .button:first-child { border-radius: 0.5em 0 0 0.5em; }
.button-group .button:last-child { border-radius: 0 0.5em 0.5em 0; }



.element-item > * {
  margin: 0;
  padding: 0;
}

.element-item .name {

}

.element-item .symbol {

}

.element-item .number {
  position: absolute;
  right: 8px;
  top: 5px;
}

.element-item .weight {
  position: absolute;
  left: 10px;
  top: 76px;
  font-size: 12px;
}


</style>
<?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'],
               "note"=>$_POST['note'],
               "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'],
              "note"=>$_POST['note'],
              "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>
<?php include("common/menu.php")?>
<!---side nav bar end-->
<?php include("common/tittle.php")?>
            <!--Nav menu end-->
            <!--Main body Start-->
            <div class="col-sm-12  mt-2">
            <center>

<div class="row no-gutters">
     <div class="col-sm-12 inventory_button">
         <div class="d-flex button-group">
             <div class="col-sm-2 ">
                 <a href="pole"class=" btn-order  collapsed text-center btn ">
                     <p class="text-center order-text-order-managment">Pool Booking</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 Booking</p>
                 </a>
             </div>

             <div class="col-sm-2 ">
                 <a href="manual_cart"class=" text-white btn-warning  collapsed text-center btn ">
                     <p class="text-center ">Check Out</p>
                 </a>
             </div>

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


</center> 
<hr>
<center>

<?php
/*
$yesterday=date("F j, Y,strtotime('-1 day')");
$sql1="select * from account where date=
$yesterday";
$result1 = mysqli_query($conn,$sql1)or die( mysqli_error($conn));
$row1=mysqli_fetch_array($result1);
if ($row1['date']==$yesterday) {
  $display_not='block';
  }else{
    $display_not='none';  
}*/

?>
<h4>Enter Order Manually</h4>
<div class="bg-warning text-white rounded  w-25" id="notification" style="display:<?php echo $display_not ?>;"> Please Close Your yesterday Account !!!</div>
<div class="bg-success text-white rounded  w-25" id="popUp" style="display: none;"> Item added to cart <i class="fa fa-check-square-o" aria-hidden="true"></i></div>
        <h4>Search For Item</h4>
        <p><input type="text" id="quicksearch" class="form-control w-50 m-4" placeholder="Search" /></p>
    </center>

    
<div id="filters" class="button-group mx-4">
  <button class="button is-checked" data-filter="*">show all</button>
  <button class="button" data-filter=".Bar">Bar</button>
  <button class="button" data-filter=".Restaurant">Restaurant</button>
  
</div>





<div style="display:<?php echo $general ?>" id="general" class=" grid  d-flex flex-wrap no-gutters ">
                   
                   <!--menu items 1-->
                   <?php

include("conn.php");

$sql="select * from menu  ORDER BY RAND()";
$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'];
  $location=$row['itemlocation'];
  

$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;

include('item_data.php');

if ($total_remaining_item <=0 && $location=='Bar') {
  $visible='none';
  $visibles='block';
}
else {
  $visible='block';
  $visibles='none';
}

$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='T'.date('ymdhi').mt_rand(10,100);
?>
 <iframe name="votar" style="display:none;"></iframe>
<form method="post" action="index.php?id=<?= $row['id']?>"  target="votar">
                   <div id="pizza" class="menu-items element-item transition  <?php echo $location ?>">
                       <div class="d-flex ">
                           <img style="width: 90px; height: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="<?=$orderid?>">
                       <input style="height:20px" class="form-control m-2" type="text" name="note" placeholder="Note">
                       <input id="<?=$row['id']?>"  onClick="reply_click(this)" style="display:<?php echo $visible?>;" type="submit" class="btn btn-success cart btn-block m-2" name="Add_to_cart" value="Add to cart">
                       <input style="display:<?php echo $visibles?>;" type="submit" class=" btn btn-warning btn-block  m-2"  value="Out of stock">
                   </div>

                   </form>
                   <?php }  ?>
                   
               </div>


</div>




<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>
<script src="js/script.js"></script>
<script>
 

 function reply_click(obj)
  {

    var id = obj.id;
    document.getElementById(id).style.visibility = "hidden";
      $( "#popUp" ).show(); 
   setTimeout(function() {
      $( "#popUp" ).hide();
      $( id ).hide();
    }, 2000);
  }






// quick search regex
var qsRegex;
var buttonFilter;

// init Isotope
var $grid = $('.grid').isotope({
  itemSelector: '.element-item',
  layoutMode: 'fitRows',
  filter: function() {
    var $this = $(this);
    var searchResult = qsRegex ? $this.text().match( qsRegex ) : true;
    var buttonResult = buttonFilter ? $this.is( buttonFilter ) : true;
    return searchResult && buttonResult;
  }
});

$('#filters').on( 'click', 'button', function() {
  buttonFilter = $( this ).attr('data-filter');
  $grid.isotope();
});

// use value of search field to filter
var $quicksearch = $('#quicksearch').keyup( debounce( function() {
  qsRegex = new RegExp( $quicksearch.val(), 'gi' );
  $grid.isotope();
}) );


  // change is-checked class on buttons
$('.button-group').each( function( i, buttonGroup ) {
  var $buttonGroup = $( buttonGroup );
  $buttonGroup.on( 'click', 'button', function() {
    $buttonGroup.find('.is-checked').removeClass('is-checked');
    $( this ).addClass('is-checked');
  });
});
  

// debounce so filtering doesn't happen every millisecond
function debounce( fn, threshold ) {
  var timeout;
  threshold = threshold || 100;
  return function debounced() {
    clearTimeout( timeout );
    var args = arguments;
    var _this = this;
    function delayed() {
      fn.apply( _this, args );
    }
    timeout = setTimeout( delayed, threshold );
  };
}




</script>
</body>
</html>
