modify call waiter

This commit is contained in:
Zin Moe
2020-07-29 16:26:35 +06:30
parent 91378c21f5
commit 143b509efe
2 changed files with 14 additions and 16 deletions

View File

@@ -1,12 +1,12 @@
App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', { App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', { // App.messages = App.cable.subscriptions.create('MessagesChannel', {
connected: function() {}, connected: function() {},
disconnected: function() {}, disconnected: function() {},
received: function(data) { received: function(data) {
var hostname = location.hostname.trim(); var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from) if(data.from == "" || hostname == data.from)
{ {
@@ -19,7 +19,7 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
class_name = ".shift_" + data.shift_ids; class_name = ".shift_" + data.shift_ids;
} }
} }
var element = "#notify-wrapper" + class_name; var element = "#notify-wrapper"; // + class_name;
var animateEnter = ""; var animateEnter = "";
var animateExit = ""; var animateExit = "";
if (time == 'print_error') { if (time == 'print_error') {
@@ -35,10 +35,10 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
var text = " Calling Waiter <br> "+table.name ; var text = " Calling Waiter <br> "+table.name ;
style ="width:180px !important;" style ="width:180px !important;"
} }
if (text != null || colorName != null){ if (text != null || colorName != null){
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit); showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
} }
function showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit) { function showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
@@ -79,4 +79,3 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
} }
} }
}); });

View File

@@ -1,5 +1,4 @@
class Api::CallWaitersController < ActionController::API class Api::CallWaitersController < Api::ApiController
#List all active customers by name #List all active customers by name
def index def index
@table_id = params[:dining_id] @table_id = params[:dining_id]
@@ -18,17 +17,17 @@ class Api::CallWaitersController < ActionController::API
# CallWaiterJob.perform_later(@table,@time) # CallWaiterJob.perform_later(@table,@time)
if ENV["SERVER_MODE"] == 'cloud' if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain from = request.subdomain + "." + request.domain
else else
from = "" from = ""
end end
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
# get printer info # get printer info
@shop = Shop.current_shop @shop = Shop.current_shop
unique_code = "CallWaiterPdf" unique_code = "CallWaiterPdf"
print_settings = PrintSetting.find_by_unique_code(unique_code) print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings) printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_call_waiter(print_settings,@table,@time,@shop) printer.print_call_waiter(print_settings,@table,@time,@shop)
end end
end end