Class: HrLite::ApprovalsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/hr_lite/approvals_controller.rb

Overview

Everything waiting on the signed-in person, in one place. Before this, an approver had to visit four screens to find out whether anybody was waiting on them, and nothing told them if a request had gone stale.

Employee tier on purpose: holding an approval IS the authorisation. A manager, a stand-in covering for one, and a director all reach the same screen and each sees only their own rows.

Instance Method Summary collapse

Instance Method Details

#indexObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/hr_lite/approvals_controller.rb', line 10

def index
  @approvals = paginate(mine.includes(:step, :subject).order(:created_at))
  @delegations = ApprovalDelegation.live_on(Date.current)
                                   .where(from_user_id: hr_current_user.id)
                                   .includes(:to_user)
  @covering_for = ApprovalDelegation.live_on(Date.current)
                                    .where(to_user_id: hr_current_user.id)
                                    .includes(:from_user)
end