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

View File

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

View File

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