Files
sx-fc/app/controllers/application_controller.rb
2018-08-07 10:43:40 +06:30

58 lines
1.5 KiB
Ruby
Executable File

class ApplicationController < ActionController::Base
include LoginVerification
#before_action :check_installation
protect_from_forgery with: :exception
helper_method :shop_detail, :order_reservation, :bank_integration
# lookup domain for db from provision
# before_action :set_locale
# helper_method :current_company,:current_login_employee,:current_user
# alias_method :current_user, :current_login_employee,:current_user
#this is base api base controller to need to inherit.
#all token authentication must be done here
#response format must be set to JSON
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
redirect_to root_path
end
def shop_detail
@shop = Shop.first
end
def order_reservation
order_reserve = Lookup.collection_of('order_reservation')
status = false
if !order_reserve.empty?
order_reserve.each do |order|
if order[0] == 'OrderReservation'
if order[1] == '1'
status = true
end
end
end
end
return status
end
def bank_integration
bank_integration = Lookup.collection_of('bank_integration')
status = false
if !bank_integration.empty?
bank_integration.each do |bank|
if bank[0] == 'Bank Integration'
if bank[1] == '1'
status = true
end
end
end
end
return status
end
end