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

This commit is contained in:
Yan
2018-04-23 16:23:35 +06:30
13 changed files with 63 additions and 22 deletions

View File

@@ -156,13 +156,17 @@ class DiningFacility < ApplicationRecord
table = DiningFacility.find(table_id)
#Send to background job for processing
# CheckInBookingJob.perform_later(table)
ActionCable.server.broadcast "check_in_booking_channel",table: table
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "check_in_booking_channel",table: table
end
end
def self.checkin_time
table = DiningFacility.get_checkin_booking
if table.length > 0
ActionCable.server.broadcast "checkin_channel",table: table
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "checkin_channel",table: table
end
end
end

View File

@@ -321,7 +321,9 @@ class Order < ApplicationRecord
end
else
msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
end
if !sidekiq.nil?
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
@@ -335,7 +337,9 @@ class Order < ApplicationRecord
end
end
assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id)
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end
end
end
@@ -372,7 +376,9 @@ class Order < ApplicationRecord
type = 'order'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_channel",table: table,type:type
end
end
end
@@ -526,7 +532,9 @@ class Order < ApplicationRecord
end
end
end
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status
end
end
private

View File

@@ -219,14 +219,30 @@ class OrderReservation < ApplicationRecord
end
def self.send_status_to_ordering(url,ref_no,status)
base_url = "http://192.168.1.186:3002"
base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation")
if !order_reservation.empty?
order_reservation.each do |order_reserve|
if order_reserve[0] == 'BaseURL'
base_url = order_reserve[1]
elsif order_reserve[0] == 'Token'
token = order_reserve[1]
end
end
else
Rails.logger.debug "Add order reservation BaseURL "
response = {status: false}
end
Rails.logger.debug "Doemal URL" + base_url
post_url = base_url + url
begin
response = HTTParty.post(post_url,
:body => { id: ref_no, status: status}.to_json,
:headers => {
'Authorization' => 'Token token=3T-tnlYtFJ-5Z1vY6XQqxQ',
'Authorization' => 'Token token='+token,
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=3'
}, :timeout => 10

View File

@@ -607,7 +607,9 @@ class SalePayment < ApplicationRecord
type = 'payment'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
if ENV["SERVER_MODE"] != 'cloud'
ActionCable.server.broadcast "order_channel",table: table,type:type
end
end
end
end