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

This commit is contained in:
phyusin
2018-06-18 17:35:55 +06:30
6 changed files with 258 additions and 1 deletions

View File

@@ -26,6 +26,31 @@ class Api::BillController < Api::ApiController
end
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
#bill channel
check_in_out_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
printer = PrintSetting.all
unique_code="CheckInOutPdf"
if !check_in_out_pdf.empty?
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'CheckInOutPdf'
unique_code="CheckInOutPdf"
end
end
end
end
booking = Booking.find_by_booking_id(booking.booking_id)
# print when complete click
print_settings = PrintSetting.find_by_unique_code(unique_code)
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_check_in_out(print_settings, booking, table)
from = getCloudDomain #get sub domain in cloud mode
end
elsif (params[:order_id])
@sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier, "cashier")
@@ -83,6 +108,15 @@ class Api::BillController < Api::ApiController
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
end
#get cloud domain
def getCloudDomain
from = ""
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
end
return from
end
private
def bill_params

View File

@@ -81,6 +81,30 @@ class Api::CheckInProcessController < Api::ApiController
else
render :json => { :status => true }
end
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
check_in_out_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
printer = PrintSetting.all
unique_code="CheckInOutPdf"
if !check_in_out_pdf.empty?
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'CheckInOutPdf'
unique_code="CheckInOutPdf"
end
end
end
end
booking = Booking.find_by_booking_id(booking.booking_id)
table = DiningFacility.find(params[:dining_id])
# print when complete click
print_settings = PrintSetting.find_by_unique_code(unique_code)
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_check_in_out(print_settings, booking, table)
from = getCloudDomain #get sub domain in cloud mode
end
else
render :json => { :status => true }
end
@@ -121,6 +145,16 @@ class Api::CheckInProcessController < Api::ApiController
end
end
#get cloud domain
def getCloudDomain
from = ""
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
end
return from
end
private
def check_in_process_params
params.permit(:dining_id,:booking_id,:time)