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

This commit is contained in:
yemin
2018-10-11 11:25:41 +06:30
5 changed files with 27 additions and 11 deletions

View File

@@ -10,14 +10,18 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
var hostname = location.hostname.trim(); var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from) if(data.from == "" || hostname == data.from)
{ {
table = data.table table = data.table;
time = data.time time = data.time;
// for Notificaiotn message // for Notificaiotn message
var element = "#notify-wrapper" var class_name = "";
if(data.shift_ids != "" && data.shift_ids!=null){
if(data.shift_ids.length == 1){
class_name = ".shift_" + data.shift_ids;
}
}
var element = "#notify-wrapper" + class_name;
var animateEnter = ""; var animateEnter = "";
var animateExit = ""; var animateExit = "";
if (time == 'print_error') { if (time == 'print_error') {
var colorName = "alert-danger"; var colorName = "alert-danger";
var placementFrom = "center"; var placementFrom = "center";

View File

@@ -5,13 +5,23 @@ class Api::CallWaitersController < ActionController::API
@table_id = params[:dining_id] @table_id = params[:dining_id]
@time = params[:time] @time = params[:time]
@table = DiningFacility.find(@table_id) @table = DiningFacility.find(@table_id)
shift_ids = []
#for multiple zone with terminal
multiple_zone = CashierTerminalByZone.where("zone_id = #{@table.zone_id}")
multiple_zone.each do |zone|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{zone.cashier_terminal_id}").first
if !shift.nil?
shift_ids.push(shift.id)
end
end
# 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 ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
# get printer info # get printer info
@shop = Shop.first @shop = Shop.first
unique_code = "CallWaiterPdf" unique_code = "CallWaiterPdf"

View File

@@ -11,8 +11,8 @@ class Origami::HomeController < BaseOrigamiController
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@shop = shop_detail @shop = shop_detail
@occupied_table = DiningFacility.where("status='occupied'").count; @occupied_table = DiningFacility.where("status='occupied'").count
# @shift = ShiftSale.current_open_shift(current_user.id) @shift = ShiftSale.current_open_shift(current_user.id)
end end
# origami table detail # origami table detail
@@ -24,6 +24,7 @@ class Origami::HomeController < BaseOrigamiController
@complete = Sale.completed_sale("cashier") @complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@shift = ShiftSale.current_open_shift(current_user.id)
@status_order = "" @status_order = ""
@status_sale = "" @status_sale = ""

View File

@@ -4,7 +4,7 @@ class Origami::RoomsController < BaseOrigamiController
@rooms = Room.unscoped.all.active.order('status desc') @rooms = Room.unscoped.all.active.order('status desc')
@complete = Sale.completed_sale("cashier") @complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id) @shift = ShiftSale.current_open_shift(current_user.id)
@webview = false @webview = false
if check_mobile if check_mobile
@webview = true @webview = true
@@ -23,6 +23,7 @@ class Origami::RoomsController < BaseOrigamiController
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc') @orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name") @customers = Customer.pluck("customer_id, name")
@room = DiningFacility.find(params[:room_id]) @room = DiningFacility.find(params[:room_id])
@shift = ShiftSale.current_open_shift(current_user.id)
@status_order = "" @status_order = ""
@status_sale = "" @status_sale = ""

View File

@@ -42,7 +42,7 @@
</section> </section>
<!-- Notify --> <!-- Notify -->
<div id="notify-wrapper"></div> <div id="notify-wrapper" class="shift_<%= !@shift.nil? ? @shift.id : '' %>"></div>
<!-- Notify --> <!-- Notify -->
<!-- Main Content --> <!-- Main Content -->