app order
This commit is contained in:
@@ -1,15 +1,148 @@
|
||||
<style type ="text/css">
|
||||
.assign {
|
||||
background-color:blue;
|
||||
}
|
||||
.completed{
|
||||
background-color:green;
|
||||
}
|
||||
</style>
|
||||
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
|
||||
<% if @booking.nil?%>
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= foodcourt_food_court_path %>">Foodcourt</a></li>
|
||||
<li class="breadcrumb-item active">Application Orders</li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', foodcourt_food_court_path %>
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
<div class="row m-t--20">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 m-t-10" >
|
||||
<div class="card">
|
||||
<div class="card-block" style="">
|
||||
<div class="card-text" id="custom-slimscroll">
|
||||
<% if !@booking.nil?%>
|
||||
<div class="col-md-9 col-lg-9 col-sm-12 m-t-10">
|
||||
<% else %>
|
||||
<div class="col-md-12 col-lg-12 col-sm-12 m-t-10">
|
||||
<% end %>
|
||||
<div id="custom-slimscroll">
|
||||
<div class="card-columns">
|
||||
<% bk_status ='' %>
|
||||
<% @bookings.each do |bk|
|
||||
if !@booking.nil?
|
||||
if bk.booking_id == @booking.booking_id
|
||||
bk_status ='bg-red'
|
||||
else
|
||||
bk_status =bk.booking_status
|
||||
end
|
||||
else
|
||||
bk_status =bk.booking_status
|
||||
end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id) do %>
|
||||
<div class="card <%= bk_status %> text-white" data-id ="<%= bk.booking_id %>">
|
||||
<div class="card-block">
|
||||
Cus Ph :<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;">Order Time :<%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
BK :<%= bk.booking_id %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if !@booking.nil?%>
|
||||
<div class="col-md-3 col-lg-3 col-sm-12 m-t-10">
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<div class="row" style="margin:auto">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9">
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.name%></span><br>
|
||||
<strong class="font-14 p-l-10">Booking - <%=@booking.booking_id%></strong>
|
||||
</div>
|
||||
<div class="col-md-3 col-lg-3 col-sm-3">
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text" id="order-detail-slimscroll" data-height="140">
|
||||
<table class="table table-striped summary-items">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-qty">Qty</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="font-13" >
|
||||
<% count =0 %>
|
||||
<% total_price =0 %>
|
||||
<% total_qty =0 %>
|
||||
<% @booking.booking_orders.each do |bo| %>
|
||||
<% bo.order.order_items.each do |oi| %>
|
||||
<% count +=1 %>
|
||||
<% total_price += oi.price %>
|
||||
<% total_qty += oi.qty.to_i%>
|
||||
<tr class="item_box">
|
||||
<td><%= count%></td>
|
||||
<td><%= oi.item_name%></td>
|
||||
<td><%= oi.qty.to_i%></td>
|
||||
<td class="item-attr"><%= oi.price%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
|
||||
<td style="padding:2px;" width="15%"><strong id="total_qty"><%=total_qty %></strong></td>
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=total_qty * total_price %></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">done</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('#back').on('click', function () {
|
||||
window.location.href ="<%=foodcourt_food_court_path %>";
|
||||
});
|
||||
$('#done_order').on('click', function () {
|
||||
swal({
|
||||
title: "Alert !",
|
||||
text: 'This order is really done!',
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes!",
|
||||
cancelButtonClass: 'btn btn-danger',
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$('.confirm').prop("disabled",true);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/foodcourt/<%=@booking_id %>/completed",
|
||||
data: {customer_id:"<%=@customer_id %>"},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
window.location.href ="<%=foodcourt_app_order_by_booking_path %>";
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user