25 lines
798 B
Ruby
25 lines
798 B
Ruby
class Api::CallWaitersController < ActionController::API
|
|
|
|
#List all active customers by name
|
|
def index
|
|
@table_id = params[:dining_id]
|
|
@time = params[:time]
|
|
@table = DiningFacility.find(@table_id)
|
|
# CallWaiterJob.perform_later(@table,@time)
|
|
if ENV["SERVER_MODE"] == 'cloud'
|
|
from = request.subdomain + "." + request.domain
|
|
else
|
|
from = ""
|
|
end
|
|
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from
|
|
# get printer info
|
|
@shop = Shop.first
|
|
unique_code = "CallWaiterPdf"
|
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
|
printer.print_call_waiter(print_settings,@table,@time,@shop)
|
|
end
|
|
|
|
|
|
end
|