Class: HrLite::ChecklistTemplate

Inherits:
ApplicationRecord show all
Includes:
Audited
Defined in:
app/models/hr_lite/checklist_template.rb

Overview

"Collect the signed offer letter", "Revoke email access". The steps a company means to take every time and forgets once.

Constant Summary collapse

KINDS =
%w[onboarding offboarding].freeze

Constants included from Audited

Audited::REDACTED, Audited::SKIPPED_ATTRIBUTES

Class Method Summary collapse

Class Method Details

.seed_defaults!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/models/hr_lite/checklist_template.rb', line 16

def self.seed_defaults!
  [
    { kind: "onboarding", title: "Collect signed offer letter", position: 10,
      owner_permission: "document.manage" },
    { kind: "onboarding", title: "Collect PAN and Aadhaar", position: 20,
      owner_permission: "document.manage" },
    { kind: "onboarding", title: "Create payroll record and salary structure",
      position: 30, owner_permission: "salary.manage", due_offset_days: 3 },
    { kind: "onboarding", title: "Hand over laptop and access", position: 40,
      owner_permission: "profile.manage" },
    { kind: "offboarding", title: "Collect laptop and accessories", position: 10,
      owner_permission: "profile.manage" },
    { kind: "offboarding", title: "Revoke email and system access", position: 20,
      owner_permission: "profile.manage" },
    { kind: "offboarding", title: "Full and final settlement", position: 30,
      owner_permission: "payroll.manage", due_offset_days: 30 },
    { kind: "offboarding", title: "Issue relieving and experience letters",
      position: 40, owner_permission: "document.manage", due_offset_days: 7 }
  ].filter_map do |attributes|
    next if exists?(kind: attributes[:kind], title: attributes[:title])

    create!(attributes)
    "#{attributes[:kind]}: #{attributes[:title]}"
  end
end