Class: HrLite::EmployeeProfile
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- HrLite::EmployeeProfile
- Includes:
- Audited, EncryptedMoney
- Defined in:
- app/models/hr_lite/employee_profile.rb
Overview
Statutory identity + employment window. PII columns are encrypted at rest; masked readers feed the employee-facing view (full values render only in the leadership edit form). Records are never destroyed — exits are a date, payroll history is a statutory record.
Constant Summary collapse
- TAX_REGIMES =
%w[new old].freeze
Constants included from Audited
Audited::REDACTED, Audited::SKIPPED_ATTRIBUTES
Instance Attribute Summary collapse
-
#new_user_email ⇒ Object
Onboarding-form virtuals (the controller hands them to config.onboard_user; never persisted, never audited).
-
#new_user_name ⇒ Object
Onboarding-form virtuals (the controller hands them to config.onboard_user; never persisted, never audited).
-
#new_user_password ⇒ Object
Onboarding-form virtuals (the controller hands them to config.onboard_user; never persisted, never audited).
Instance Method Summary collapse
- #active_on?(date) ⇒ Boolean
- #employment_range_in(month) ⇒ Object
- #masked_account ⇒ Object
- #masked_pan ⇒ Object
- #masked_uan ⇒ Object
Instance Attribute Details
#new_user_email ⇒ Object
Onboarding-form virtuals (the controller hands them to config.onboard_user; never persisted, never audited).
19 20 21 |
# File 'app/models/hr_lite/employee_profile.rb', line 19 def new_user_email @new_user_email end |
#new_user_name ⇒ Object
Onboarding-form virtuals (the controller hands them to config.onboard_user; never persisted, never audited).
19 20 21 |
# File 'app/models/hr_lite/employee_profile.rb', line 19 def new_user_name @new_user_name end |
#new_user_password ⇒ Object
Onboarding-form virtuals (the controller hands them to config.onboard_user; never persisted, never audited).
19 20 21 |
# File 'app/models/hr_lite/employee_profile.rb', line 19 def new_user_password @new_user_password end |
Instance Method Details
#active_on?(date) ⇒ Boolean
37 38 39 |
# File 'app/models/hr_lite/employee_profile.rb', line 37 def active_on?(date) date_of_joining <= date && (date_of_exit.nil? || date_of_exit >= date) end |
#employment_range_in(month) ⇒ Object
41 42 43 44 45 |
# File 'app/models/hr_lite/employee_profile.rb', line 41 def employment_range_in(month) from = [ date_of_joining, month.beginning_of_month ].max to = [ date_of_exit || month.end_of_month, month.end_of_month ].min from <= to ? (from..to) : nil end |
#masked_account ⇒ Object
51 52 53 54 |
# File 'app/models/hr_lite/employee_profile.rb', line 51 def masked_account value = bank_account_number value.blank? ? nil : "•••• #{value.last(4)}" end |
#masked_pan ⇒ Object
47 48 49 |
# File 'app/models/hr_lite/employee_profile.rb', line 47 def masked_pan mask_middle(pan_number) end |
#masked_uan ⇒ Object
56 57 58 |
# File 'app/models/hr_lite/employee_profile.rb', line 56 def masked_uan mask_middle(pf_uan) end |