check order items arr

This commit is contained in:
phyusin
2018-07-17 14:45:14 +06:30
parent 642037c5f2
commit 91fc8696af
4 changed files with 6 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ class Origami::HomeController < BaseOrigamiController
@payment_methods = PaymentMethodSetting.all
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
#@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'")
@order_items = Array.new
@dining_booking.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new

View File

@@ -33,6 +33,7 @@ class Origami::RoomsController < BaseOrigamiController
@payment_methods = PaymentMethodSetting.all
@dining_room = @room.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
@order_items = Array.new
@dining_room.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
@@ -100,7 +101,6 @@ class Origami::RoomsController < BaseOrigamiController
end
end
end
# @room.bookings.each do |booking|
# if booking.sale_id.nil?
# @order_items = Array.new

View File

@@ -484,7 +484,7 @@
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!@order_items.empty?) %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %>
<% end %>
@@ -515,7 +515,7 @@
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!@order_items.empty?) %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %>
<% end %>

View File

@@ -513,7 +513,7 @@
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" id="request_bills" class="btn bg-blue btn-block">Req.Bill</button>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!@order_items.empty?) %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %>
<% end %>
@@ -540,7 +540,7 @@
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</button>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!@order_items.empty?) %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
<% end %>
<% end %>