Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into quick_service

This commit is contained in:
Aung Myo
2018-02-09 11:32:49 +06:30
10 changed files with 358 additions and 197 deletions

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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">

View File

@@ -75,6 +75,7 @@
</a> </a>
</li> --> </li> -->
<%end%> <%end%>
<li class="header"><%= t :backend %></li>
<li> <li>
<a href="javascript:void(0);" class="menu-toggle"> <a href="javascript:void(0);" class="menu-toggle">
<i class="material-icons">widgets</i> <i class="material-icons">widgets</i>

View File

@@ -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>

View File

@@ -39,20 +39,45 @@
<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 %>">
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %> <% if table.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span> <% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% 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>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<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>
<div style="font-size:12px;"></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>
</div> </div>
<% end %> <% end %>
@@ -65,20 +90,36 @@
<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 %>">
<div class="card-block">
<%= room.name %>
<% if room.get_booking.nil? %> <% if room.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span> <div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
<% end %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" 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>
</div>
</div>
<% else %>
<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 %>
<% else %>
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -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>

View File

@@ -70,6 +70,7 @@ en:
sale_audits: "Sale Audits" sale_audits: "Sale Audits"
bottom: "Bottom" bottom: "Bottom"
payment: "Payment" payment: "Payment"
backend: "Backend"
views: views:
btn: btn:

View File

@@ -65,6 +65,7 @@ mm:
sale_audits: "အရောင်းပြင်ဆင်ခြင်းများ" sale_audits: "အရောင်းပြင်ဆင်ခြင်းများ"
bottom: "အရောင်းအနဲဆုံး" bottom: "အရောင်းအနဲဆုံး"
payment: "ငွေပေးချေမှု" payment: "ငွေပေးချေမှု"
backend: "Backend"
views: views:
btn: btn: