D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
salvation.incrediblebengal.com
/
admin
/
Filename :
table-order.php
back
Copy
<?php include'config.php'; include'get_session_access.php'; include'function.php'; error_reporting(); $page_title = "Table Order"; if ($_GET['tableid'] == "") {echo "<script>window.location.href ='table-reservation.php'</script>";} else{$table_id = $_GET['tableid'];} if ($_GET['table_status'] != '') {$order_status = $_GET['table_status'];} else{$order_status = $_SESSION['order_status'];} $order_date = getOrderDate(); ?> <!DOCTYPE html> <html lang="en"> <head> <title>Encode Restro - Table Order</title> <?php include'style.php'; ?> </head> <body> <div id="main-wrapper"> <?php include'header.php'; ?> <?php include'sidebar.php'; ?> <!--********************************** Content body start ***********************************--> <div class="content-body"> <!-- row --> <div class="container-fluid"> <div class="row gx-0"> <div class="col-lg-7 col-sm-12 pr-1"> <div class="food_list"> <ul class="nav nav-tabs mb-3"> <?php $show_items = "SELECT * FROM recipe_category"; $run_query = mysqli_query($conn, $show_items); if($run_query-> num_rows > 0){ while($row = mysqli_fetch_assoc($run_query)) { ?> <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#<?php echo $row['recipe_category_name']; ?>"><img class="img-fluid" src="images/icons/<?php echo $row['recipe_category_img']; ?>"> <?php echo $row['recipe_category_name']; ?></a></li> <?php } } ?> </ul> <div class="tab-content"> <?php $show_items = "SELECT * FROM recipe_category"; $run_query = mysqli_query($conn, $show_items); if($run_query-> num_rows > 0){ while($row = mysqli_fetch_assoc($run_query)) { $recipe_category = $row['recipe_category_name']; ?> <div id="<?php echo $row['recipe_category_name']; ?>" class="tab-pane fade"> <ul class="food_menu"> <h4><?php echo $row['recipe_category_name']; ?></h4> <?php $show_data = "SELECT * FROM food_item where food_category = '$recipe_category' AND food_status = '1'"; $run_data = mysqli_query($conn, $show_data); if($run_data-> num_rows > 0){ while($result = mysqli_fetch_assoc($run_data)) { $bg_change = ''; if ($result['food_qty'] <= 5) { $bg_change = 'low-inventry'; } ?> <li class="<?php echo $bg_change; ?>" > <div class="food-menuDiv" id="item<?php echo $result['food_id']; ?>"> <img src="images/food-images/<?php echo $result['food_img']; ?>"> <h5><?php echo $result['food_name']; ?></h5> <p>(<?php echo $result['food_desc']; ?>)</p> <div class="inner_div float-right"> <span class="food_price"><i class="fa fa-inr"></i> <?php echo $result['food_price']; ?></span> <input type="hidden" name="tableId" id="item<?php echo $result['food_id']; ?>_tableId" value="<?php echo $table_id ?>" > <input type="hidden" name="foodId" id="item<?php echo $result['food_id']; ?>_foodId" value="<?php echo $result['food_id']; ?>" > <input type="hidden" name="foodName" id="item<?php echo $result['food_id']; ?>_foodName" value="<?php echo $result['food_name']; ?>" > <input type="hidden" name="foodPrice" id="item<?php echo $result['food_id']; ?>_foodPrice" value="<?php echo $result['food_price']; ?>" > <input type="submit" id="" class="addItem" value="Add to Cart" onclick="cart('item<?php echo $result['food_id']; ?>')"> </div> <span class="FoodQty">Qty: <?php echo $result['food_qty'];?> <text><?php echo " ".$bg_change; ?></text></span> </div> </li> <?php } } ?> </ul> </div> <div id="status"></div> <?php } } ?> </div> </div> </div> <div class="col-lg-5 col-sm-12 pl-1"> <!-- <form action="customer-order.php" method="POST"> --> <div class="fooding_form"> <div id="dine-in" class=""> <ul class="list-inline"> <li class="list-inline-item"> <input type="hidden" id="tableId" name="table_Id" value="<?php echo $table_id; ?>"> <h4>Table No. <?php echo $table_id; ?> </h4> </li> <li class="list-inline-item text-right">Order Date: <span class="ml-0"><?php echo getOrderDate(); ?></span></li> </ul> <div class="customer_details"> <!-- <input type="hidden" name="customer_phone" id="customer_phone" placeholder="Mobile Number**" value="'.$res['customer_phone'].'" required > --> <?php $show_num = mysqli_query($conn, "SELECT * FROM dinein_order WHERE table_id = $table_id AND order_date = '$order_date' AND order_status = 'running'"); $row = mysqli_fetch_assoc($show_num); $order_Id = $row['order_id']; $view_cPhone = $row['customer_phone']; $ordr_status = $row['order_status']; $show_custDetails = mysqli_query($conn, "SELECT * FROM customer_details WHERE customer_phone = '$view_cPhone'"); $res = mysqli_fetch_assoc($show_custDetails); $customer_phone = $res['customer_phone']; $customer_name = $res['customer_name']; $customer_address = $res['customer_address']; if ($customer_address != '') { ?> <h5 class="text-black">Customer Details</h5 class="text-black"> <ul class="list-inline"> <li class="list-inline-item">Phone: <span id="customer_phone" name="customer_phone"><?php echo $customer_phone; ?></span></li> <li class="list-inline-item">Order Id: <span id="order_id" name="order_id"><?php echo $order_Id; ?></span></li> <li class="list-inline-item">Name: <span id="customer_name" name="customer_name"><?php echo $customer_name; ?></span></li> <li class="list-inline-item">Address: <span id="customer_address" name="customer_address"><?php echo $customer_address; ?></span></li> </ul> <?php } ?> </div> <div class="modal fade customerEntry show" id="customer_Entry" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Enter Customer Details</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form action="get_tableDetails.php" method="POST"> <div class="input-group"> <label>Customer Phone:</label> <input type="tel" name="custPhone" class="cust_phone" id="cust_phone" maxlength="10" required> <!-- <div id="phone_list" class="phoneList"></div> --> </div> <div class="input-group"> <label>Customer name:</label> <input type="text" name="custName" id="cust_name" required> </div> <div class="input-group"> <label>Customer Address:</label> <input type="text" name="custAddress" id="cust_address" required> </div> <div class="input-group"> <input type="hidden" name="entryId" value="1"> <input type="hidden" name="tableId" value="<?php echo $table_id; ?>"> <input type="text" name="total_price" id="totalprice" class="totalprice" readonly> <input type="submit" class="add_order bttn bttn-add" name="add_order" value="Add Order"> </div> </form> </div> </div> </div> </div> </div> <div class="customer_order"> <table class="list-inline order_list"> <thead> <tr> <th>ITEMS</th> <th>QTY</th> <th>PRICE/QTY</th> <th>PRICE</th> <th>ACTION</th> </tr> </thead> <tbody id="display_cart"></tbody> </table> </div> <div class="totalCost"> <ul class="list-inline"> <li><label>Total Price:</label></li> <li><input type="text" name="total_price" id="totalprice" class="totalprice" readonly></li> </ul> </div> </div> <ul class="list-inline order_buttons mt-2"> <?php if ($ordr_status != 'running') { echo '<li class="list-inline-item"> <button type="button" class="bttn bttn-submit p-2 px-5" data-toggle="modal" data-target="#customer_Entry">New Order</button> </li>'; } elseif ($ordr_status == 'running') { echo '<li class="list-inline-item"> <a class="btn btn-primary border-circle p-2 px-2" href="get_tableDetails.php?editId=2&tableId='.$table_id.'&customer_phone='.$view_cPhone.'&order_id='.$order_Id.'">Continue Order</a> </li> <li class="list-inline-item"> <a class="btn btn-info border-circle p-2 px-2" href="print-pdf/table_kot.php?tableId='.$table_id.'&customer_phone='.$view_cPhone.'&dbTable=table_orderlist">Print KOT</a> </li>'; } ?> </ul> </div> <!-- </form> --> </div> </div> </div> </div> <!--********************************** Content body end ***********************************--> <?php include'footer.php'; ?> <script type="text/javascript"> $('.food_list > .nav-tabs > li:first-child > a.nav-link').addClass('active'); $('.food_list > .tab-content > .tab-pane:first-child').addClass('show active'); function cart_display(){ var table_id = document.getElementById("tableId").value; $.ajax({ url: "table_item_order.php", method:"POST", data: {table_id: table_id,item_display: 1}, datatype:"text", success: function(data){ $('#display_cart').html(data); } }); } cart_display(); function cart(id){ var ee=document.getElementById(id); var foodId = document.getElementById(id+"_foodId").value; var foodName = document.getElementById(id+"_foodName").value; var foodPrice = document.getElementById(id+"_foodPrice").value; var tableId = document.getElementById(id+"_tableId").value; // var item_insert = 2; var qty = 1; $.ajax({ url: "insert_dine_cart.php", type: "POST", data: {food_id: foodId,food_name: foodName,table_id: tableId,food_qty: qty,food_price:foodPrice}, success: function(msg){ $('#status').html(msg); cart_display(); total_price(); } }); } $(document).on("click", ".delete-btn", function(){ var foodId = $(this).data("id"); var table_id = document.getElementById("tableId").value; var element = this; var item_request = 3; $.ajax({ url: "delete_cart_item.php", type: "POST", data: {food_id:foodId,item_request: item_request,table_id: table_id}, success: function(cart_msg){ $('#cartStatus').html(cart_msg); cart_display(); total_price(); } }); }); // ---------------Calculating Cart Price--------------- function update_amounts(){ $("table").on("change", ".foodqty", ".foodAmount", function() { var subtotalVal = 0; var row = $(this).closest("tr"); var fid = parseFloat(row.find(".foodId").val()); var qty = parseFloat(row.find(".foodqty").val()); var price = parseFloat(row.find(".foodprice").val()); var subtotal = parseFloat(row.find(".foodAmount").val()); var total = 0; total = qty * price; $.ajax({ url: "update_cart.php", method: "POST", cache: false, data: {food_id:fid,food_qty:qty,food_price:price}, success:function(msg){ $('.totalprice').html(msg); } }); row.find(".foodAmount").val(isNaN(total) ? "" : total); $('.foodAmount').each(function() { subtotalVal += parseFloat($(this).val()); $('.totalprice').val((subtotalVal).toFixed(2)); }); }); } function total_price(){ var table_id = document.getElementById("tableId").value; $.ajax({ url: "total_cart_amount.php", method:"POST", data: {table_id: table_id}, success: function(price){ $('.totalprice').val(price); console.log(price); } }); } $(document).ready(function(){ update_amounts(); total_price(); }); </script> </body> </html>