test no table

This commit is contained in:
Aung Myo
2018-02-14 14:26:36 +06:30
parent 08e372cfb5
commit b2cec95064
3 changed files with 14 additions and 11 deletions

View File

@@ -102,7 +102,7 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
if !params["booking_id"].nil? if !params["booking_id"].nil?
# check booking id is already completed. # check booking id is already completed.
booking = Booking.find(params[:booking_id]) booking = Booking.find(params[:booking_id])
if !params[:table_id].nil? if params[:table_id].to_i > 0
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
else else
table_status = true table_status = true
@@ -119,7 +119,7 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
@order.booking_id = params[:booking_id] @order.booking_id = params[:booking_id]
end end
else else
if !params[:table_id].nil? if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id]) sale_status = check_order_with_table(params[:table_id])
if sale_status if sale_status
return return_json_status_with_code(400, "bill requested") return return_json_status_with_code(400, "bill requested")
@@ -128,7 +128,7 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
end end
end #booking exists end #booking exists
else else
if !params[:table_id].nil? if params[:table_id].to_i > 0
sale_status = check_order_with_table(params[:table_id]) sale_status = check_order_with_table(params[:table_id])
if sale_status if sale_status
# return false , @message = "bill requested" # return false , @message = "bill requested"

View File

@@ -220,6 +220,8 @@ class Origami::PaymentsController < BaseOrigamiController
#end customer amount #end customer amount
@sale_data.bookings.each do |sbk| @sale_data.bookings.each do |sbk|
puts "sssssssssss"
puts sbk.dining_facility_id
df = DiningFacility.find(sbk.dining_facility_id) df = DiningFacility.find(sbk.dining_facility_id)
@table_no = df.type + ' ' + df.name @table_no = df.type + ' ' + df.name
@checkin_time = sbk.checkin_at @checkin_time = sbk.checkin_at

View File

@@ -23,9 +23,8 @@ class Order < ApplicationRecord
def generate def generate
booking = nil booking = nil
if self.new_booking if self.new_booking
if !self.table_id.nil? if self.table_id.to_i > 0
table_id = self.table_id table_id = self.table_id
else else
table_id = nil table_id = nil
@@ -43,7 +42,7 @@ class Order < ApplicationRecord
end end
#end extra time #end extra time
if !self.table_id.nil? if self.table_id.to_i > 0
table = DiningFacility.find(self.table_id) table = DiningFacility.find(self.table_id)
table.status = "occupied" table.status = "occupied"
table.save table.save
@@ -324,11 +323,13 @@ class Order < ApplicationRecord
#send order items and send to order queue #send order items and send to order queue
def send_order_broadcast(booking) def send_order_broadcast(booking)
table = DiningFacility.find(booking.dining_facility_id) if self.table_id.to_i > 0
type = 'order' table = DiningFacility.find(booking.dining_facility_id)
#Send to background job for processing type = 'order'
# OrderBroadcastJob.perform_later(table,type) #Send to background job for processing
ActionCable.server.broadcast "order_channel",table: table,type:type # OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
end
end end
#Origami: Cashier : to view order Table #Origami: Cashier : to view order Table