fix addorder UI

This commit is contained in:
Zin Moe
2020-03-16 17:54:10 +06:30
parent 2cd816e20f
commit ce6785c70b
11 changed files with 166 additions and 119 deletions

View File

@@ -108,7 +108,8 @@
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10 d-flex flex-column h-100" >
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10 d-flex flex-column h-100" style="margin-left: -10px;
margin-right: -10px;">
<div class="card h-100">
<div class="card-block d-flex flex-column h-100" style="">
<div class="card-text" id="foodcourt-slimscroll">
@@ -156,8 +157,8 @@
</div>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10 d-flex flex-column h-100 ">
<div class="card h-100">
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10 d-flex flex-column h-100">
<div class="card h-100" style="margin-right: -20px;">
<div class="card-header" style="padding: 0.12rem 0.25rem">
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>
Orders

View File

@@ -32,7 +32,7 @@
</li>
</ul>
<!-- Nav tabs - End -->
<div class="tab-content h-100">
<div class="tab-content h-100 d-flex flex-column">
<!--- Panel 0 - Completed Orders -->
<div class="tab-pane h-100 <%= params[:active] == 'completed' ? 'active' : '' %>" id="complete" role="tabpanel">
<div class="d-flex flex-column h-100">
@@ -90,10 +90,9 @@
<%= link_to foodcourt_app_order_by_booking_path(pending_id: pc.sale_id, active: 'completed'), class: 'item-card' do %>
<div class="card <%= bg_color %> text-white">
<div class="card-block">
<%= pc.receipt_no %>
<span class="float-right"><%= pc.created_at.strftime('%I:%M %p') %></span>
<%= pc.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= pc.created_at.utc.getlocal.strftime("%I:%M %p") %></span>
<br>
<span class="float-right"><%= pc.sale_status %></span>
<span style="font-size:12px;float:right;line-height: 30px;"><%= pc.sale_status %></span>
</div>
</div>
<% end %>
@@ -105,7 +104,7 @@
<!-- Panel 1 - Pending Orders -->
<div class="tab-pane <%= 'active' if params[:active].blank? %> h-100" id="pending_order" role="tabpanel">
<div class="h-100 d-flex flex-column">
<div id="foodcourt-order-slimscroll">
<div id="foodcourt-order-slimscroll" class="h-100">
<div class="card-columns p-l-10">
<% @pending_sales.each do |sale| %>
<% if @pending.present? %>
@@ -123,7 +122,7 @@
<%= sale.receipt_no %>
<span class="float-right"><%= sale.created_at.strftime('%I:%M %p') %></span>
<br>
<span class = 'float-right'>Billed</span>
<span class = 'float-right m-t-5'>Billed</span>
</div>
</div>
<% end %>
@@ -144,7 +143,7 @@
<%= order.booking_id %>
<span class="float-right"><%= order.created_at.strftime('%I:%M-%p') %></span>
<br>
<span class="float-right">new</span>
<span class="float-right m-t-5">new</span>
</div>
</div>
<% end %>
@@ -188,7 +187,7 @@
</div>
<% if !@booking.nil?%>
<div class="col-md-4 col-lg-4 col-sm-12 h-100 d-flex flex-column m-l--15">
<div class="col-md-5 col-lg-5 col-sm-12 h-100 d-flex flex-column m-l--15" style="padding-right: 15px">
<span id="sale_id" style="display:none"><%= @booking.sale_id %></span>
<div class="card h-100" style="margin-bottom: 10px !important">
<div class="card-header" style="padding: 0.12rem 0.25rem">
@@ -203,7 +202,7 @@
<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">
<div class="card-text h-100" id="foodcourt-table-slimscroll" style="overflow-y: auto">
<table class="table table-striped summary-items fixed-header">
<thead>
<tr>
@@ -256,16 +255,13 @@
<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="margin: 10px 0 -2px 12px; width: 95%; font-size: 1.3rem">
DONE
</button>
</div>
</div>
</div>
<% end %>
<% if @pending %>
<div class="col-md-4 col-lg-4 col-sm-12 h-100 d-flex flex-column m-l--15">
<div class="col-md-5 col-lg-5 col-sm-12 h-100 d-flex flex-column m-l--15" style="padding-right: 15px">
<% if @status == 'sale' %>
<span id="sale_id" style="display:none"><%= @pending.try(:sale_id) %></span>
<% elsif @status == 'order' %>
@@ -312,90 +308,97 @@
</div>
</div>
</div>
<div class="card-block">
<div id="order-detail-slimscroll" data-height="140">
<div class="card-text" style="">
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@pending.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
<% else %>
<% sub_total = 0
total = 0
@pending.order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= total %></td>
</tr>
<% end %>
<div class="card-block d-flex flex-column h-100">
<div class="card-text h-100" id="foodcourt-table-slimscroll" style="overflow-y: auto">
<table class="table table-striped fixed-header" id="order-items-table">
<thead>
<tr>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% if @status == 'sale' %>
<% sub_total = 0
@pending.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price %>
<tr>
<td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td>
</tr>
<% end%>
</tbody>
</table>
</div>
</div>
</div>
<div class="pending-order card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %>
<tr>
<%if @pending.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<% end%>
</table>
<% else %>
<% sub_total = 0
total = 0
@pending.order_items.each do |order_item|
total = order_item.qty * order_item.price
sub_total = sub_total + total %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= total %></td>
</tr>
<% end %>
<% end%>
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<table class="table" id="order-charges-table" border="0">
<% if @status == 'sale' %>
<tr>
<%if @pending.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td>
<%else%>
<td class="charges-name"><strong>Discount:</strong></td>
<%end%>
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax:</strong></td>
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
</tr>
<tr class="rebate_amount"></tr>
<% else%>
<tr>
<td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr>
<% end%>
</table>
</div>
</div>
</div>
</div>
</div>
<% end %>
<div class="col-md-2 col-lg-2 col-sm-12 h-100 d-flex flex-column" style="padding: 0 15px 0 5px;">
<% if @pending || @booking %>
<div class="col-md-1 col-lg-1 col-sm-12 h-100 d-flex flex-column" style="padding-right: 5px; margin-left: -5px;">
<% else %>
<div class="col-md-2 col-lg-2 col-sm-12 h-100 d-flex flex-column" style="padding: 0 15px 0 5px;">
<% end %>
<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>
<% if @booking && @booking.booking_status == 'assign' %>
<button type="button" class="btn btn-primary btn-block waves-effect create" id="done_order">
DONE
</button>
<% end %>
<% if @booking && @booking.booking_status != 'void' %>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void </a>
<% end %>
<!-- pending order button list -->

View File

@@ -19,7 +19,7 @@
<div class="row clearfix h-100">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 d-flex flex-column h-100">
<div class="card h-100">
<div class="card h-100" style="margin-bottom: 15px">
<div class="card-header m-l-5 m-r-5">
<div id="order-title">
<div class="row p-l-5 p-r-5">
@@ -159,12 +159,12 @@
</div>
</div>
<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="col-lg-5 col-md-5 col-sm-5 col-xs-5 d-flex flex-column h-100" style="padding-right: 10px;">
<div class="card h-100" style="margin-bottom: 15px">
<div class="card-header" style="margin-bottom: 20%;">
<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">
<div class="col-md-4 text-right">
<strong>
<span id="grand_total" class="hidden">
<% if @sale_payment.nil? %>
@@ -196,7 +196,10 @@
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
<%= link_to 'Back', '/foodcourt/app_orders', class: 'btn btn-block btn-default waves-effect' %>
<%= link_to '/foodcourt/app_orders', class: 'btn btn-block btn-default waves-effect', style: "padding-top: 0;" do%>
<i class="material-icons">reply</i>
BACK
<% end %>
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
Refresh
</button>
@@ -445,7 +448,7 @@
<div id="sxModal-Content">
<h3>Card Tap</h3>
</div>
<div class="m-r-20" align="right">
<div style="position: absolute; bottom: 0; margin-left: 45%; margin-bottom: 60px;">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>

View File

@@ -254,14 +254,29 @@
$('.close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/foodcourt/shift/cashier/close';
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true,
html: true
}, function() {
window.location.href = linkURL;
});
var count = ''
var text = ''
$.ajax({
url: '/foodcourt/current_shift_order_count',
method: 'get',
success: function(data) {
count = JSON.stringify(data)
console.log(count)
if (count > 0) {
text = "<h5><span style=\"color: #CC0000\"> We have "+count+" pending orders and sales</span> </h5>.<br>Are you sure you want to close cashier? ";
}else{
text = "Are you sure you want to close cashier?";
}
swal({
title: "Alert!",
text: text,
type: "warning",
showCancelButton: true,
html: true
}, function() {
window.location.href = linkURL;
});
}
})
})
</script>

View File

@@ -38,14 +38,9 @@
<!-- #END# Overlay For Sidebars -->
<%= render 'layouts/header' %>
<section>
<%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%>
<% if food_court && current_user.role=='cashier'%>
<%= render 'layouts/foodcourt_left_sidebar' %>
<% else %>
<%= render 'layouts/left_sidebar' %>
<%end%>
<%= render 'layouts/right_sidebar' %>
<%= render 'layouts/left_sidebar' %>
<%= render 'layouts/right_sidebar' %>
</section>
<!-- Main Content -->

View File

@@ -38,7 +38,7 @@
<!-- #END# Overlay For Sidebars -->
<%= render 'layouts/header' %>
<section>
<%= render 'layouts/foodcourt_left_sidebar' %>
<%= render 'layouts/left_sidebar' %>
<%= render 'layouts/right_sidebar' %>
</section>