Class: HrLite::Admin::SalaryStructuresController
- Inherits:
-
SuperadminController
- Object
- HrLite::ApplicationController
- BaseController
- LeadershipController
- SuperadminController
- HrLite::Admin::SalaryStructuresController
- Defined in:
- app/controllers/hr_lite/admin/salary_structures_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/hr_lite/admin/salary_structures_controller.rb', line 11 def create @structure = SalaryStructure.new(structure_params.merge( user_id: @profile.user_id, created_by_id: hr_current_user.id )) if @structure.save redirect_to admin_employee_path(@profile), notice: "Salary structure saved." else render :new, status: :unprocessable_entity end end |
#edit ⇒ Object
22 23 24 |
# File 'app/controllers/hr_lite/admin/salary_structures_controller.rb', line 22 def edit @structure = SalaryStructure.where(user_id: @profile.user_id).find(params[:id]) end |
#new ⇒ Object
6 7 8 9 |
# File 'app/controllers/hr_lite/admin/salary_structures_controller.rb', line 6 def new @structure = SalaryStructure.new(user_id: @profile.user_id, effective_from: Date.current.beginning_of_month) end |
#update ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/hr_lite/admin/salary_structures_controller.rb', line 26 def update @structure = SalaryStructure.where(user_id: @profile.user_id).find(params[:id]) if @structure.update(structure_params) redirect_to admin_employee_path(@profile), notice: "Salary structure updated." else render :edit, status: :unprocessable_entity end end |