Merge branch 'foodcourt' of gitlab.com:code2lab/SXRestaurant into foodcourt
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
class Api::ApiController < ActionController::API
|
||||
include TokenVerification
|
||||
include TokenVerification, MultiTenancy
|
||||
include ActionController::MimeResponds
|
||||
|
||||
# before_action :lookup_domain
|
||||
before_action :core_allow
|
||||
helper_method :current_token, :current_login_employee, :get_cashier
|
||||
|
||||
before_action :core_allow
|
||||
|
||||
def core_allow
|
||||
headers['Access-Control-Allow-Origin'] = '*'
|
||||
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'
|
||||
headers['Access-Control-Request-Method'] = '*'
|
||||
headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
#this is base api base controller to need to inherit.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class Api::AuthenticateController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
before_action :find_shop
|
||||
# before_action :find_shop
|
||||
|
||||
def create
|
||||
emp_id = params[:emp_id]
|
||||
password = params[:password]
|
||||
|
||||
if emp_id && password
|
||||
@employee = Employee.login(@shop, emp_id, password)
|
||||
@employee = Employee.login(emp_id, password)
|
||||
if @employee && @employee.role == "waiter"
|
||||
render json: JSON.generate({:status => true, :session_token => @employee.token_session, :name => @employee.name, :role => @employee.role})
|
||||
else
|
||||
|
||||
@@ -6,7 +6,7 @@ class Api::BillController < Api::ApiController
|
||||
@status = false
|
||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
||||
# if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
if !ShiftSale.current_shift(@shop.shop_code).nil?
|
||||
if !ShiftSale.current_shift(Shop.current_shop.shop_code).nil?
|
||||
#create Bill by Booking ID
|
||||
table = 0
|
||||
if (params[:booking_id])
|
||||
@@ -106,7 +106,7 @@ class Api::BillController < Api::ApiController
|
||||
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
# #shop detail
|
||||
# shop_details = Shop.find(1)
|
||||
# shop_details = Shop.current_shop
|
||||
|
||||
# customer= Customer.find(@sale_data.customer_id)
|
||||
# # get member information
|
||||
|
||||
@@ -23,8 +23,9 @@ class Api::CallWaitersController < ActionController::API
|
||||
end
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
|
||||
# get printer info
|
||||
# @shop = Shop.first
|
||||
unique_code = "CallWaiterPdf"
|
||||
|
||||
@shop = Shop.current_shop
|
||||
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)
|
||||
|
||||
@@ -70,7 +70,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||
|
||||
if !order_reservation_id.nil? && flag
|
||||
shop = Shop.find_by_id(1)
|
||||
shop = Shop.current_shop
|
||||
if !shop.nil?
|
||||
shop_code = shop.shop_code
|
||||
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")
|
||||
@@ -96,9 +96,6 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
||||
end
|
||||
end
|
||||
|
||||
# puts "!!! send doemal ::"
|
||||
# puts result
|
||||
|
||||
Rails.logger.debug "send status to doemal"
|
||||
Rails.logger.debug result
|
||||
|
||||
@@ -46,9 +46,7 @@ class Api::OrdersController < Api::ApiController
|
||||
@tax_profile = TaxProfile.where("lower(group_type)='cashier'")
|
||||
# end
|
||||
|
||||
# @shop = Shop.first
|
||||
puts "Hello world"
|
||||
puts @shop.to_json
|
||||
@shop = Shop.current_shop
|
||||
return @shop.to_json
|
||||
end
|
||||
|
||||
@@ -162,7 +160,6 @@ class Api::OrdersController < Api::ApiController
|
||||
table = DiningFacility.find(table_id)
|
||||
if table
|
||||
booking = table.get_current_booking
|
||||
# puts booking
|
||||
if booking
|
||||
if !booking.sale_id.nil?
|
||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||
|
||||
@@ -14,11 +14,12 @@ class Api::Payment::MobilepaymentController < Api::ApiController
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
# shop_detail = Shop.first
|
||||
|
||||
shop_detail = Shop.current_shop
|
||||
|
||||
# rounding adjustment
|
||||
if !path.include? ("credit_payment")
|
||||
if @shop.is_rounding_adj
|
||||
if shop_detail.is_rounding_adj
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
|
||||
@@ -2,7 +2,7 @@ class Api::SoundEffectController < Api::ApiController
|
||||
|
||||
#sound effect / alarm api for doemal side calling
|
||||
def sound_effect
|
||||
shop = Shop.find_by_id(1)
|
||||
shop = Shop.current_shop
|
||||
if !shop.nil?
|
||||
shop_code = shop.shop_code
|
||||
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")
|
||||
|
||||
@@ -15,12 +15,8 @@ class Api::SurveyController < Api::ApiController
|
||||
|
||||
def create
|
||||
dining_facility = DiningFacility.find(params[:id])
|
||||
# cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
# puts params.to_json
|
||||
# set cashier
|
||||
open_cashier = Employee.where("shop_code='#{@shop.shop_code}' and role = 'cashier' AND token_session <> ''")
|
||||
current_shift = ShiftSale.current_shift(@shop.shop_code)
|
||||
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||
current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code)
|
||||
current_shift_user =Employee.find_by_id(current_shift.employee_id)
|
||||
if open_cashier.count>0
|
||||
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0])
|
||||
|
||||
Reference in New Issue
Block a user