modify foodcourt order UI

This commit is contained in:
Zin Moe
2020-03-05 17:17:36 +06:30
parent c245cee4d0
commit 84d48c3265
5 changed files with 157 additions and 110 deletions

View File

@@ -481,7 +481,7 @@ $(function() {
parent = $('.set-item').attr('data-parent');
total = qty * price ;
row ="<tr class='item_box' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
+code+"' data-attributes='"
+attribute_arr+"' data-options ='"
@@ -506,7 +506,7 @@ $(function() {
total = qty * price ;
row ="<tr class='item_box' data-price ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+price+ "' data-toggle='modal' data-target='#sx_itemModal' data-instance ='"
+name+ "' data-code='"+item_code+"' data-instance-code='"
+code+"' data-attributes='"
+attribute_arr+"' data-options ='"
@@ -832,30 +832,39 @@ $(function() {
}
show_item_detail(item_data,"add_to_order");
calculate_sub_total();
code = $('#item_code').text()
autoScrollToItem(code);
}); //End add order Click
// click plus icon for add
$(document).on('click', '.add_icon', function(event){
var item_data = $(this);
code = $(this).data('item-code');
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
item = get_item(item_data,"add_icon");
customer_display_view(item,"add");
}
show_item_detail(item_data,"add_icon");
code = $(this).data('item-code');
calculate_sub_total();
autoScrollToItem(code)
}); //End Add Icon Click
// scroll to element
function autoScrollToItem(code) {
console.log(code)
element = $('.summary-items').find(`[data-code='${code}']`);
item_qty = element.find('#item_qty').text()
parent = element.parents('.card-text')
// auto scroll to last order item
if (item_qty == 1) {
$(parent).animate({
scrollTop: $('.summary-items tbody tr:last').position().top - $('.summary-items tbody tr:first').position().top
})
}
// set border to current item
$('.summary-items tbody tr').css({
'background-color': '',
'color': ''
@@ -865,18 +874,19 @@ $(function() {
'background-color': '#2091F3',
'color': '#fff'
})
// element.css('background-color', '#2091F3').delay(500)
// .queue(function() {
// $(this).css('background-color', '').dequeue();
// })
calculate_sub_total();
if (isNotInView(element, parent)) {
element.css({'background-color': '#2091F3'});
scrollToELement(element);
}
}); //End Add Icon Click
}
$(document.body).on('click', function() {
$('.summary-items tbody tr').css({
'background-color': '',
'color': ''
})
})
function isNotInView(elem, parent){
// for scroll up | for scroll down
@@ -938,7 +948,7 @@ $(function() {
});
if (append===0) {
row ="<tr class='item_box' data-price ='"
+price+ " 'data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
+price+ " 'data-toggle='modal' data-target='#sx_itemModal' data-instance ='"
+instance+ "' data-qty='"+qty +"' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
+data.attr('data-instance-code')+"' data-attributes='"
+data.attr('data-attributes')+"' data-options ='"
@@ -1104,7 +1114,7 @@ $(function() {
name = $(this).children('#item_name').text();
qty = $(this).children('#item_qty').text();
$('#modal-item-name').text(name);
$('#modal-qty').val(qty);
$(this).addClass('set-bg-color')
});
//click remove buttom in modal box
@@ -1131,11 +1141,15 @@ $(function() {
$("#sx_item_set_detailModal").css({ 'display': "none" });
});
//click save buttom after change qty
$('#sx_itemModal').on('click','#save', function(){
$(document).on('click','#save', function(){
if ($('#modal-qty').val()>0) {
summary_items_filter();
calculate_sub_total();
$('.set-bg-color').css({
'background-color': '#2091F3',
'color': '#fff'
})
$('.summary-items tbody tr').removeClass('set-bg-color');
}else{
swal("Opps", "Please enter number for qty ","warning");
}

View File

@@ -17,6 +17,16 @@ html, body {
flex: 1 !important;
}
table.fixed-header {
position: relative;
thead th{
background: white;
position: sticky;
top: 0;
}
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;

View File

@@ -79,23 +79,30 @@
</div>
<div class="col-lg-2 col-md-2 col-sm-2 hidden h-100 d-flex flex-column" id="menu_cache">
<li class="list-menu">
<a href="javascript:void(0);" id="menu_dropdown" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
</a>
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
</ul>
</li>
<div id="foodcourt-menu-slimscroll" class="flex-grow-1">
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
<%if Product.any? %>
<li class="nav-item product" data-ref="<%= foodcourt_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<%end%>
</ul>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 hidden h-100 d-flex flex-column m-t-10" id="menu_cache">
<div class="card h-100">
<div class="card-header">
<li class="list-menu" style="background: none">
<a href="javascript:void(0);" id="menu_dropdown" class="menu-toggle dropdown-toggle toggled my-toggle ">
<span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
</a>
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
</ul>
</li>
</div>
<div class="card-block h-100 d-flex flex-column">
<div id="foodcourt-menu-slimscroll" class="flex-grow-1 card-text">
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
<%if Product.any? %>
<li class="nav-item product" data-ref="<%= foodcourt_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<%end%>
</ul>
</div>
</div>
</div>
</div>
@@ -167,16 +174,20 @@
</div>
<div class="card-block d-flex flex-column h-100">
<div class="card-text h-100" id="foodcourt-order-slimscroll">
<table class="table table-striped summary-items" id="order-items-table" >
<div class="table-responsive">
<table class="table" id="append-table">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-qty">QTY</th>
<th class="item-attr">Price</th>
<th>Items</th>
<th class="text-nowrap text-right">QTY</th>
<th class="text-nowrap text-right">Price</th>
</tr>
</thead>
</table>
</div>
<div class="card-text h-100" id="foodcourt-order-slimscroll">
<table class="table table-striped summary-items fixed-header" id="order-items-table" >
<tbody class="font-13" >
</tbody>
@@ -187,15 +198,15 @@
<div class="card-footer flex-grow-1 custom-card-footer" id="orders-footer">
<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">0</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
<td colspan="2" style="padding:2px; text-align:" class="charges-name"><strong>Total:</strong></td>
<td style="padding:2px; text-align: center;"><strong id="total_qty">0</strong></td>
<td style="padding:2px; text-align:" class="item-attr float-right"><strong id="sub_total">0.00</strong></td>
</tr>
</table>
<% if @sale_id.nil?%>
<button type="button" class="btn btn-primary action-btn create col-md-11" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<button type="button" class="btn btn-primary action-btn create col-md-12" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<% else %>
<button type="button" class="btn btn-primary action-btn create col-md-11" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<button type="button" class="btn btn-primary action-btn create col-md-12" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
<% end %>
</div>
</div>

View File

@@ -8,37 +8,36 @@
</style>
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
<button type="button" class="btn btn-block btn-default waves-effect float-right" id='back' style="width: 112px; margin-right: -10px">
<!-- <button type="button" class="btn btn-block btn-default waves-effect float-right" id='back' style="width: 112px; margin-right: -10px">
<i class="material-icons">reply</i>
Back
</button>
</button> -->
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal m-t--10" role="tablist">
<li class="nav-item">
<a class="nav-link <%= 'active' if params[:active].blank? %>" data-toggle="tab" href="#mobile_orders" role="tab">Mobile Orders</a>
</li>
<li class="nav-item">
<a class="nav-link <%= params[:active] ? 'active' : '' %>" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="container-fluid " style="padding:0px 3px 0px 3px;margin-top:20px">
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;margin-top:20px">
<div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div>
</div>
<div class="row m-t--10">
<div class="row m-t--20 h-100">
<% if !@booking.nil?%>
<div class="col-md-8 col-lg-8 col-sm-12 float-left">
<div class="col-md-7 col-lg-7 col-sm-12 float-left h-100 d-flex flex-column m-l-5 m-r-10" style="padding-right: 10px;">
<% else %>
<div class="col-md-12 col-lg-12 col-sm-12">
<div class="col-md-11 col-lg-11 col-sm-12 h-100 d-flex flex-column" style="padding: 0 !important;">
<% end %>
<div class="tab-content" id="custom-slimscroll">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal m-t--10" role="tablist">
<li class="nav-item">
<a class="nav-link <%= 'active' if params[:active].blank? %>" data-toggle="tab" href="#mobile_orders" role="tab">Mobile Orders</a>
</li>
<li class="nav-item">
<a class="nav-link <%= params[:active] ? 'active' : '' %>" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content h-100">
<!-- Panel 0 - Mobile Orders -->
<div class="tab-pane <%= 'active' if params[:active].blank? %>" id='mobile_orders' role='tabpanel'>
<div id="custom-slimscroll">
<div id="foodcourt-slimscroll" class="flex-grow-1">
<div class="card-columns">
<% bk_color ='' %>
<% @bookings.each do |bk|
@@ -56,8 +55,9 @@
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id), class: 'item-card' do %>
<div class="card <%= bk_color %> 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>
Order No: <%= bk.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span> </div>
<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
<%= bk.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span>
</div>
</div>
<% end %>
<% end %>
@@ -84,8 +84,9 @@
<%= link_to foodcourt_app_order_by_booking_path(booking_id: c.booking_id, active: 'completed'), class: 'item-card' do %>
<div class="card <%= bk_color %> text-white" data-id ="<%= c.booking_id %>">
<div class="card-block">
Cus Ph: <%= c.contact_no %><span style="font-size:12px;float:right;line-height:inherit;">Order Time: <%= c.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
Order No: <%= c.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;">competed</span> </div>
<%= c.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= c.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
<%= c.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;">competed</span>
</div>
</div>
<% end %>
<% end %>
@@ -95,51 +96,53 @@
</div>
<% if !@booking.nil?%>
<div class="col-md-3 col-lg-3 col-sm-12">
<div class="col-md-4 col-lg-4 col-sm-12 h-100 d-flex flex-column m-l--15">
<span id="sale_id" style="display:none"><%= @booking.sale_id %></span>
<div class="card">
<div class="card h-100" style="margin-bottom: 10px !important">
<div class="card-header" style="padding: 0.12rem 0.25rem">
<div class="row" style="margin:auto">
<div class="col-md-12 col-lg-12 col-sm-12">
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>| <span class="font-14">Table-<%=@booking.dining_facility.try(:name)%></span><br>
<span class="font-14 p-l-10"><b>Booking</b> - <%=@booking.booking_id%></span><br>
<span class="font-14 p-l-10"><b>Order No</b> - <%=@booking.order_id%></span>
<div class="row">
<div class="col-md-12 col-lg-12 col-sm-12" style="padding: 10px 10px">
<strong id="order-title" class="font-18 p-l-10">ORDER DETAILS |</strong> <span class="font-18">Table-<%=@booking.dining_facility.try(:name)%></span><br>
</div>
</div>
</div>
<div class="card-body">
<div class="card-text" id="order-detail-slimscroll" data-height="320">
<table class="table table-striped summary-items">
<thead>
<div class="card-block h-100 d-flex flex-column">
<div>
<span class="font-14 float-left d-inline"><b>Booking</b> - <%=@booking.booking_id%></span>
<span class="font-14 float-right d-inline"><b>Order No</b> - <%=@booking.order_id%></span>
</div>
<div class="card-text h-100" id="foodcourt-order-slimscroll" style="overflow-y: auto">
<table class="table table-striped summary-items fixed-header">
<thead>
<tr>
<th class="text-nowrap">#</th>
<th class="item-name">Items</th>
<th class="item-qty text-nowrap">Qty</th>
<th class="item-attr text-nowrap">Price</th>
</tr>
</thead>
<tbody class="font-13">
<%
sub_total = 0
count = 0
%>
<% @sale_data.sale_items.each do |sale_item|
count += 1
%>
<% sub_total += sale_item.price%>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-qty">Qty</th>
<th class="item-attr">Price</th>
<td class="text-nowrap"><%= count %></td>
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
<td class="text-nowrap"><%=sale_item.qty%></td>
<td class="item-attr text-nowrap"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
</tr>
</thead>
<tbody class="font-13">
<%
sub_total = 0
count = 0
%>
<% @sale_data.sale_items.each do |sale_item|
count += 1
%>
<% sub_total += sale_item.price%>
<tr>
<td><%= count %></td>
<td class="item-name"><%=sale_item.product_name%>@<%=number_with_precision( sale_item.unit_price, precision: precision.to_i )%></td>
<td class=""><%=sale_item.qty%></td>
<td class="item-attr"><%=(number_with_precision(sale_item.price, precision: precision.to_i ))%></td>
</tr>
<%end %>
</tbody>
</table>
</div>
<%end %>
</tbody>
</table>
</div>
</div>
<div class="card-footer custom-card-footer" style="padding: 0.35rem 0.15rem !important;">
<table class="table" id="order-charges-table" border="0">
<div class="card-footer flex-grow-1 custom-card-footer">
<table class="table" id="order-charges-table" border="0" cellpadding = "10">
<tr>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Sub Total</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%=number_with_precision(sub_total, precision: precision.to_i)%></strong></td>
@@ -161,14 +164,23 @@
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></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;">DONE</button>
<button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="margin: 10px 0 -2px 12px; width: 95%; font-size: 1.3rem">
DONE
</button>
</div>
</div>
</div>
<div class="col-md-1 col-lg-1 col-sm-12">
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
</div>
<% end %>
<div class="col-md-1 col-lg-1 col-sm-12 h-100 d-flex flex-column" style="padding-right: 10px;">
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button>
<% if !@booking.nil?%>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% end %>
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">

View File

@@ -162,8 +162,8 @@
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 d-flex flex-column h-100">
<div class="card h-100">
<div class="card-header" style="margin-bottom: 20%;">
<div class="row m-l-5 m-r-5 m-t-20">
<div class="col-md-8"><strong class='amount_balance' style="font-size: 30px">Amount Due <% if !@sale_payment.nil? %>( Credit )<% end %></strong></div>
<div class="row m-l-5 m-r-5 m-t-20" style="padding-bottom: 14px;">
<div class="col-md-8"><strong class='amount_balance' style="font-size: 30px">Amount Due: <% if !@sale_payment.nil? %>( Credit )<% end %></strong></div>
<div class="col-md-4">
<strong>
<span id="grand_total" class="hidden">