D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
salvation.incrediblebengal.com
/
admin
/
Filename :
delivery-order.php
back
Copy
<?php include'config.php'; include'get_session_access.php'; include'function.php'; error_reporting(0); $page_title = "Delivery Order"; $order_type = "take-away"; $order_date = getOrderDateTime(); ?> <!DOCTYPE html> <html lang="en"> <head> <title>Restaurent Home Delivery Order - Encode Restaurent </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-2"> <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="order_type" id="item<?php echo $result['food_id']; ?>_orderType" value="<?php echo $order_type ?>" > <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> <?php } } ?> <div id="status"></div> </div> </div> </div> <div class="col-lg-5 col-sm-12 pl-1"> <div class="fooding_form"> <div id="dine-in" class=""> <ul class="list-inline"> <li class="list-inline-item"> <input type="hidden" id="orderType" name="order_type" value="<?php echo $order_type; ?>"> <h4>Order Type. <?php echo $order_type; ?> </h4> </li> <li class="list-inline-item text-right">Order Date: <span class="ml-0"><?php echo getOrderDateTime(); ?></span></li> </ul> <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_deliveryDetails.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 autocomplete="off"> <!-- <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="order_type" value="take-away"> <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 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> </div> <div class="order_buttons"> <button type="button" class="bttn bttn-submit p-2 px-5" data-toggle="modal" data-target="#customer_Entry">New Order</button> </div> </div> </div> </div> </div> <?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'); // $('.add_order').click(function(){ // {$('#customerEntry').modal('hide');}); // }); function cart_display(){ var orderType = document.getElementById("orderType").value; $.ajax({ url: "display_delivery_cart.php", method:"POST", data: {order_type: orderType}, 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 orderType = document.getElementById(id+"_orderType").value; var qty = 1; $.ajax({ url: "insert_delivery_cart.php", type: "POST", data: {food_id: foodId,food_name: foodName,order_type: orderType,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 element = this; var orderType = document.getElementById("orderType").value; $.ajax({ url: "delete_cart_item.php", type: "POST", data: {food_id:foodId, orderType: orderType}, success: function(cart_msg){ $('#cartStatus').html(cart_msg); cart_display(); total_price(); } }); }); function update_amounts(){ $("table").on("change", ".foodqty", 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 total = 0; total = qty * price; $.ajax({ url: "update_delivery_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 order_type = "take-away"; $.ajax({ url: "total_cart_amount.php", method:"POST", data: {order_type : order_type}, success: function(price){ $('.totalprice').val(price); console.log(price); } }); } $(document).ready(function(){ update_amounts(); total_price(); }); </script> </body> </html>