Files
sx-fc/app/controllers/home_controller.rb
Thein Lin Kyaw 7e9b4f7120 update license
2020-06-19 10:46:52 +06:30

38 lines
888 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