Class: SalariesController

Inherits:
AuthorizedController show all
Defined in:
app/controllers/salaries_controller.rb

Instance Method Summary collapse

Methods inherited from AuthorizedController

#set_locale

Instance Method Details

#createObject



34
35
36
37
38
39
40
41
# File 'app/controllers/salaries_controller.rb', line 34

def create
  @salary = Salary.new(params[:salary])
  if @salary.valid?
    @salary.build_booking
  end

  create!
end

#newObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/salaries_controller.rb', line 14

def new
  # Allow pre-seeding some parameters
  salary_params = {
    :employer    => current_tenant.company,
    :state          => 'booked',
    :duration_from  => Date.today,
    :duration_to    => Date.today.in(30.days).to_date
  }

  # Set default parameters
  salary_params.merge!(params[:salary]) if params[:salary]

  @salary = Salary.new(salary_params)

  # Prebuild an empty attachment instance
  @salary.attachments.build

  new!
end

#payslipObject



43
44
45
# File 'app/controllers/salaries_controller.rb', line 43

def payslip
  show!
end

#statisticsObject

Actions



10
11
12
# File 'app/controllers/salaries_controller.rb', line 10

def statistics
  index!
end