Pull from master
This commit is contained in:
@@ -14,10 +14,35 @@ class Api::BillController < Api::ApiController
|
||||
# for Multiple Cashier by Zone
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
|
||||
bk_order = BookingOrder.find_by_booking_id(booking.booking_id)
|
||||
order = Order.find(bk_order.order_id)
|
||||
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
puts cashier_zone.to_json
|
||||
puts "cashier_zone"
|
||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first
|
||||
if !shift.nil?
|
||||
cashier = Employee.find(shift.employee_id)
|
||||
else
|
||||
multiple_zone = CashierTerminalByZone.where('zone_id = #{cashier_zone.zone_id}')
|
||||
puts cashier_zone.to_json
|
||||
puts "cashier_zone"
|
||||
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
|
||||
puts shift.to_json
|
||||
puts "shift"
|
||||
if !shift.nil? then
|
||||
cashier = Employee.find(shift.employee_id)
|
||||
break
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, current_login_employee, "cashier")
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
else
|
||||
@status = true
|
||||
@@ -41,8 +66,9 @@ class Api::BillController < Api::ApiController
|
||||
end
|
||||
|
||||
elsif (params[:order_id])
|
||||
order = Order.find(params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier, "cashier")
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier, order.source)
|
||||
|
||||
# for Job
|
||||
booking = Booking.find_by_sale_id(@sale_id)
|
||||
|
||||
30
app/controllers/api/sound_effect_controller.rb
Normal file
30
app/controllers/api/sound_effect_controller.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
class Api::SoundEffectController < Api::ApiController
|
||||
|
||||
#sound effect / alarm api for doemal side calling
|
||||
def sound_effect
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.nil?
|
||||
shop_code = shop.shop_code
|
||||
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")
|
||||
if !order_audio.nil?
|
||||
audio = order_audio.image
|
||||
end
|
||||
else
|
||||
shop_code = nil
|
||||
audio = nil
|
||||
end
|
||||
|
||||
if !shop_code.nil? && !audio.nil?
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "sound_effect_channel",data: {status: params[:status], message: params[:message]},shop_code: shop_code,from:from,audio:audio
|
||||
else
|
||||
render :json => { :status => true, :message => "Something wrongs!" }
|
||||
end
|
||||
end
|
||||
#sound effect / alarm api for doemal side calling
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user