38 lines
887 B
Ruby
Executable File
38 lines
887 B
Ruby
Executable File
class HomeController < ApplicationController
|
|
|
|
def index
|
|
redirect_to route_by_role
|
|
end
|
|
|
|
private
|
|
|
|
def route_by_role
|
|
if current_user.role == "administrator"
|
|
dashboard_path
|
|
elsif current_user.role == "cashier"
|
|
#check if cashier has existing open cashier
|
|
shift = ShiftSale.current_open_shift(current_user.id)
|
|
if !shift.nil?
|
|
origami_dashboard_path
|
|
else
|
|
new_origami_shift_path
|
|
end
|
|
elsif current_user.role == "manager"
|
|
dashboard_path
|
|
elsif current_user.role == "supervisor"
|
|
origami_dashboard_path
|
|
elsif current_user.role == "waiter"
|
|
origami_dashboard_path
|
|
elsif current_user.role == "crm"
|
|
crm_root_path
|
|
elsif current_user.role == "account"
|
|
reports_dailysale_index_path
|
|
elsif current_user.role == "kitchen"
|
|
oqs_root_path
|
|
else
|
|
login_path
|
|
end
|
|
end
|
|
|
|
end
|