add order count and change orders UI for table and room
This commit is contained in:
@@ -27,6 +27,32 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
|
@order_items_count = Hash.new
|
||||||
|
bookings = Booking.all
|
||||||
|
if !bookings.nil?
|
||||||
|
bookings.each do |booking|
|
||||||
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
|
if !booking.booking_orders.empty?
|
||||||
|
booking.booking_orders.each do |booking_order|
|
||||||
|
order = Order.find(booking_order.order_id)
|
||||||
|
if !order.order_items.empty?
|
||||||
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
|
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
if sale.sale_status !='completed'
|
||||||
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@dining.bookings.active.each do |booking|
|
@dining.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
@@ -65,7 +91,6 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
sale = Sale.find(booking.sale_id)
|
sale = Sale.find(booking.sale_id)
|
||||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||||
|
|
||||||
@sale_array.push(sale)
|
@sale_array.push(sale)
|
||||||
if @status_order == 'order'
|
if @status_order == 'order'
|
||||||
@status_order = 'sale'
|
@status_order = 'sale'
|
||||||
|
|||||||
@@ -12,5 +12,31 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
@sale_status = sale.sale_status
|
@sale_status = sale.sale_status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@order_items_count = Hash.new
|
||||||
|
bookings = Booking.all
|
||||||
|
if !bookings.nil?
|
||||||
|
bookings.each do |booking|
|
||||||
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
|
if !booking.booking_orders.empty?
|
||||||
|
booking.booking_orders.each do |booking_order|
|
||||||
|
order = Order.find(booking_order.order_id)
|
||||||
|
if !order.order_items.empty?
|
||||||
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
|
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
if sale.sale_status !='completed'
|
||||||
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,6 +23,32 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
|
@order_items_count = Hash.new
|
||||||
|
bookings = Booking.all
|
||||||
|
if !bookings.nil?
|
||||||
|
bookings.each do |booking|
|
||||||
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
|
if !booking.booking_orders.empty?
|
||||||
|
booking.booking_orders.each do |booking_order|
|
||||||
|
order = Order.find(booking_order.order_id)
|
||||||
|
if !order.order_items.empty?
|
||||||
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
|
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sale = Sale.find(booking.sale_id)
|
||||||
|
if sale.sale_status !='completed'
|
||||||
|
if !@order_items_count.key?(booking.dining_facility_id)
|
||||||
|
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@room.bookings.active.each do |booking|
|
@room.bookings.active.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
<% if !(@total_payment_methods.nil?) %>
|
<% if !(@total_payment_methods.nil?) %>
|
||||||
<% @total_payment_methods.each do |payment| %>
|
<% @total_payment_methods.each do |payment| %>
|
||||||
<% if !@sale_data[0].empty? %>
|
<% if !@sale_data[0].empty? %>
|
||||||
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %>
|
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' && payment.payment_method != 'unionpay' %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
|
|||||||
@@ -50,6 +50,11 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(table.id) %>
|
||||||
|
(Orders : <%= @order_items_count[table.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||||
<div style="font-size:12px;"></div>
|
<div style="font-size:12px;"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,6 +67,11 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(table.id) %>
|
||||||
|
(Orders : <%= @order_items_count[table.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -87,6 +97,11 @@
|
|||||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(room.id) %>
|
||||||
|
(Orders : <%= @order_items_count[room.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -94,6 +109,11 @@
|
|||||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(room.id) %>
|
||||||
|
(Orders : <%= @order_items_count[room.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
|
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link " data-toggle="tab" href="#completed" role="tab">Completed</a>
|
<a class="nav-link " data-toggle="tab" href="#completed" role="tab">Completed</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -20,223 +20,264 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<!-- Nav tabs - End -->
|
<!-- Nav tabs - End -->
|
||||||
<div id="custom-slimscroll">
|
<div id="custom-slimscroll">
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<!--- Panel 0 - Completed Orders -->
|
<!--- Panel 0 - Completed Orders -->
|
||||||
<div class="tab-pane " id="completed" role="tabpanel" style="">
|
<div class="tab-pane " id="completed" role="tabpanel" style="">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @complete.each do |sale| %>
|
<% @complete.each do |sale| %>
|
||||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--- Panel 1 - Table Orders -->
|
<!--- Panel 1 - Table Orders -->
|
||||||
<div class="tab-pane " id="tables" role="tabpanel" style="">
|
<div class="tab-pane " id="tables" role="tabpanel" style="">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @tables.each do |table| %>
|
<% @tables.each do |table| %>
|
||||||
<% if table.status == 'occupied' %>
|
<% if table.status == 'occupied' %>
|
||||||
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
<% if table.get_booking.nil? %>
|
||||||
<div class="card-block">
|
<% if table.get_checkout_booking.nil? %>
|
||||||
<%= table.name %>
|
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
<% if table.get_booking.nil? %>
|
|
||||||
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
|
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
<div class="card-block">
|
||||||
</div>
|
<%= table.name %>
|
||||||
<% else %>
|
<% if !@order_items_count.nil? %>
|
||||||
<div class="card tables green text-white" data-id="<%= table.id %>">
|
<% if @order_items_count.key?(table.id) %>
|
||||||
<div class="card-block">
|
(Orders : <%= @order_items_count[table.id] %>)
|
||||||
<%= table.name %>
|
<% end %>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||||
<% end %>
|
<div style="font-size:12px;"></div>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% else %>
|
||||||
|
<% if table.get_checkout_booking.nil? %>
|
||||||
|
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
|
<% else %>
|
||||||
|
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
|
<% end %>
|
||||||
|
<div class="card-block">
|
||||||
|
<%= table.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(table.id) %>
|
||||||
|
(Orders : <%= @order_items_count[table.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= table.name %>
|
||||||
|
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--- Panel 2 - Room Orders -->
|
<!--- Panel 2 - Room Orders -->
|
||||||
<div class="tab-pane" id="rooms" role="tabpanel" style="">
|
<div class="tab-pane" id="rooms" role="tabpanel" style="">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @rooms.each do |room| %>
|
<% @rooms.each do |room| %>
|
||||||
<% if room.status == 'occupied' %>
|
<% if room.status == 'occupied' %>
|
||||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
<% if room.get_booking.nil? %>
|
||||||
<div class="card-block">
|
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
<%= room.name %>
|
<div class="card-block">
|
||||||
<% if room.get_booking.nil? %>
|
<%= room.name %>
|
||||||
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span>
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(room.id) %>
|
||||||
|
(Orders : <%= @order_items_count[room.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
|
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
|
<div class="card-block">
|
||||||
|
<%= room.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(room.id) %>
|
||||||
|
(Orders : <%= @order_items_count[room.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
<% else %>
|
||||||
</div>
|
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
<% else %>
|
<div class="card-block">
|
||||||
<div class="card rooms green text-white" data-id="<%= room.id %>">
|
<%= room.name %>
|
||||||
<div class="card-block">
|
<span class="float-right font-12 new_text_<%= room.id %> hide">
|
||||||
<%= room.name %>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--- Panel 3 - Orders -->
|
|
||||||
<div class="tab-pane active" id="orders" role="tabpanel" style="">
|
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
|
||||||
<% @orders.each do |order| %>
|
|
||||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
|
||||||
<div class="card-block">
|
|
||||||
<%
|
|
||||||
order_status = ""
|
|
||||||
sale_order = SaleOrder.find_by_order_id(order)
|
|
||||||
if sale_order
|
|
||||||
unless sale_order.sale_id.nil?
|
|
||||||
sale = Sale.find(sale_order.sale_id)
|
|
||||||
order_status = sale.sale_status
|
|
||||||
if order_status == 'new'
|
|
||||||
order_status = order.status
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
order_status = order.status
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- tabs - End -->
|
|
||||||
</div>
|
|
||||||
<!-- Column One -->
|
|
||||||
|
|
||||||
<!-- Column Two -->
|
|
||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
|
||||||
<div class="card" >
|
|
||||||
<div class="card-header">
|
|
||||||
<div><strong id="order-title">ORDERS DETAILS </strong></div>
|
|
||||||
</div>
|
|
||||||
<div class="card-block">
|
|
||||||
<div class="card-title row p-l-5 p-r-5">
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
|
||||||
Order No: <span id="receipt_no"> <%= @order.order_id %>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
|
||||||
Date: <span id="receipt_date"><%= @order.created_at.utc.getlocal.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-title row customer_detail hide">
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
|
||||||
Customer : <span id="customer_name"></span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="order-detail-slimscroll" data-height="<%= @status_sale=="sale" ? 200 : 160%>">
|
|
||||||
<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>
|
|
||||||
<%
|
|
||||||
sub_total = 0
|
|
||||||
@order.order_items.each do |sale_item|
|
|
||||||
sub_total = sub_total + sale_item.price
|
|
||||||
%>
|
|
||||||
<% unless sale_item.price <= 0 %>
|
|
||||||
<tr>
|
|
||||||
<td class='item-name'><%= sale_item.item_name %></td>
|
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
|
||||||
<td class='item-attr'><%= sale_item.price %></td>
|
|
||||||
</tr>
|
|
||||||
<%
|
|
||||||
end
|
|
||||||
end
|
|
||||||
%>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer ">
|
|
||||||
<table class="table" id="order-charges-table" border="0">
|
|
||||||
<tr>
|
|
||||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
|
||||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
|
||||||
|
|
||||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr class="rebate_amount"></tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Column Three -->
|
<!--- Panel 3 - Orders -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="tab-pane active" id="orders" role="tabpanel" style="">
|
||||||
<button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button>
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% if @sale_status != 'completed' %>
|
<% @orders.each do |order| %>
|
||||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||||
<% end %>
|
<div class="card-block">
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
|
<%
|
||||||
|
order_status = ""
|
||||||
|
sale_order = SaleOrder.find_by_order_id(order)
|
||||||
|
if sale_order
|
||||||
|
unless sale_order.sale_id.nil?
|
||||||
|
sale = Sale.find(sale_order.sale_id)
|
||||||
|
order_status = sale.sale_status
|
||||||
|
if order_status == 'new'
|
||||||
|
order_status = order.status
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
order_status = order.status
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tabs - End -->
|
||||||
|
</div>
|
||||||
|
<!-- Column One -->
|
||||||
|
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
|
<div class="card" >
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">ORDERS DETAILS </strong></div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-title row p-l-5 p-r-5">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
Order No: <span id="receipt_no"> <%= @order.order_id %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
Date: <span id="receipt_date"><%= @order.created_at.utc.getlocal.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-title row customer_detail hide">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
Customer : <span id="customer_name"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="order-detail-slimscroll" data-height="<%= @status_sale=="sale" ? 200 : 160%>">
|
||||||
|
<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>
|
||||||
|
<%
|
||||||
|
sub_total = 0
|
||||||
|
@order.order_items.each do |sale_item|
|
||||||
|
sub_total = sub_total + sale_item.price
|
||||||
|
%>
|
||||||
|
<% unless sale_item.price <= 0 %>
|
||||||
|
<tr>
|
||||||
|
<td class='item-name'><%= sale_item.item_name %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer ">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
|
||||||
|
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rebate_amount"></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button>
|
||||||
|
<% if @sale_status != 'completed' %>
|
||||||
|
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
||||||
|
<% end %>
|
||||||
|
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
var dining_id = $(this).attr("data-id");
|
var dining_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/table/' + dining_id;
|
window.location.href = '/origami/table/' + dining_id;
|
||||||
})
|
})
|
||||||
$(".sales").on('click',function(){
|
$(".sales").on('click',function(){
|
||||||
var sale_id = $(this).attr("data-id");
|
var sale_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/sale/' + sale_id;
|
window.location.href = '/origami/sale/' + sale_id;
|
||||||
})
|
})
|
||||||
$(".rooms").on('click', function(){
|
$(".rooms").on('click', function(){
|
||||||
var dining_id = $(this).attr("data-id");
|
var dining_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/room/' + dining_id;
|
window.location.href = '/origami/room/' + dining_id;
|
||||||
})
|
})
|
||||||
$(".orders").on('click',function(){
|
$(".orders").on('click',function(){
|
||||||
var order_id = $(this).attr("data-id");
|
var order_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/order/' + order_id;
|
window.location.href = '/origami/order/' + order_id;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
$('#pay').on('click',function() {
|
$('#pay').on('click',function() {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
||||||
alert(url)
|
alert(url)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: '/origami/sale/'+ sale_id + "/rounding_adj",
|
url: '/origami/sale/'+ sale_id + "/rounding_adj",
|
||||||
success:function(result){
|
success:function(result){
|
||||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
})
|
})
|
||||||
$('#move').on('click',function(){
|
$('#move').on('click',function(){
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -50,6 +50,11 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(table.id) %>
|
||||||
|
(Orders : <%= @order_items_count[table.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="pull-right font-12 new_text_<%= table.id %>"> billed</span>
|
<span class="pull-right font-12 new_text_<%= table.id %>"> billed</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,6 +66,11 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= table.name %>
|
<%= table.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(table.id) %>
|
||||||
|
(Orders : <%= @order_items_count[table.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
|
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -87,6 +97,11 @@
|
|||||||
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(room.id) %>
|
||||||
|
(Orders : <%= @order_items_count[room.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="pull-right font-12 new_text_<%= room.id %>"> billed</span>
|
<span class="pull-right font-12 new_text_<%= room.id %>"> billed</span>
|
||||||
<div style="font-size:12px;"></div>
|
<div style="font-size:12px;"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -95,6 +110,11 @@
|
|||||||
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
|
<% if !@order_items_count.nil? %>
|
||||||
|
<% if @order_items_count.key?(room.id) %>
|
||||||
|
(Orders : <%= @order_items_count[room.id] %>)
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="pull-right font-12 new_text_<%= room.id %>"> new</span>
|
<span class="pull-right font-12 new_text_<%= room.id %>"> new</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user