Class: HrLite::EmployeeProfile

Inherits:
ApplicationRecord show all
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

Instance Method Summary collapse

Instance Attribute Details

#new_user_emailObject

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_nameObject

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_passwordObject

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

Returns:

  • (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_accountObject



51
52
53
54
# File 'app/models/hr_lite/employee_profile.rb', line 51

def 
  value = 
  value.blank? ? nil : "•••• #{value.last(4)}"
end

#masked_panObject



47
48
49
# File 'app/models/hr_lite/employee_profile.rb', line 47

def masked_pan
  mask_middle(pan_number)
end

#masked_uanObject



56
57
58
# File 'app/models/hr_lite/employee_profile.rb', line 56

def masked_uan
  mask_middle(pf_uan)
end