hr_lite 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +157 -1
  3. data/README.md +312 -99
  4. data/app/assets/javascripts/hr_lite/confirm.js +31 -0
  5. data/app/assets/stylesheets/hr_lite/hr_lite.css +28 -0
  6. data/app/controllers/hr_lite/admin/attendances_controller.rb +16 -1
  7. data/app/controllers/hr_lite/admin/audit_logs_controller.rb +4 -1
  8. data/app/controllers/hr_lite/admin/employees_controller.rb +36 -12
  9. data/app/controllers/hr_lite/admin/leave_balances_controller.rb +15 -8
  10. data/app/controllers/hr_lite/admin/leave_requests_controller.rb +16 -0
  11. data/app/controllers/hr_lite/admin/resignations_controller.rb +17 -5
  12. data/app/controllers/hr_lite/admin/salary_slips_controller.rb +17 -2
  13. data/app/controllers/hr_lite/admin/superadmin_controller.rb +5 -0
  14. data/app/controllers/hr_lite/org_controller.rb +6 -1
  15. data/app/controllers/hr_lite/resignations_controller.rb +6 -1
  16. data/app/helpers/hr_lite/application_helper.rb +2 -12
  17. data/app/jobs/hr_lite/application_job.rb +5 -0
  18. data/app/jobs/hr_lite/daily_digest_job.rb +1 -1
  19. data/app/jobs/hr_lite/leave_year_rollover_job.rb +1 -1
  20. data/app/jobs/hr_lite/payroll_auto_draft_job.rb +5 -2
  21. data/app/models/concerns/hr_lite/audited.rb +11 -4
  22. data/app/models/hr_lite/appraisal.rb +9 -1
  23. data/app/models/hr_lite/audit_log.rb +11 -0
  24. data/app/models/hr_lite/comp_off_request.rb +5 -15
  25. data/app/models/hr_lite/designation_change.rb +18 -1
  26. data/app/models/hr_lite/employee_profile.rb +5 -1
  27. data/app/models/hr_lite/leave_balance.rb +51 -5
  28. data/app/models/hr_lite/leave_request.rb +9 -1
  29. data/app/models/hr_lite/leave_type.rb +13 -3
  30. data/app/models/hr_lite/payroll_run.rb +39 -10
  31. data/app/models/hr_lite/regularization_request.rb +8 -0
  32. data/app/models/hr_lite/resignation.rb +27 -0
  33. data/app/models/hr_lite/salary_slip.rb +7 -3
  34. data/app/services/hr_lite/attendance_puncher.rb +8 -1
  35. data/app/services/hr_lite/calculators/esi.rb +7 -4
  36. data/app/services/hr_lite/calculators/professional_tax.rb +5 -1
  37. data/app/services/hr_lite/calculators/tds.rb +8 -1
  38. data/app/services/hr_lite/leave_day_counter.rb +9 -4
  39. data/app/services/hr_lite/overview_query.rb +12 -1
  40. data/app/services/hr_lite/payroll_run_processor.rb +5 -0
  41. data/app/services/hr_lite/slip_builder.rb +54 -8
  42. data/app/views/hr_lite/admin/attendances/index.html.erb +4 -1
  43. data/app/views/hr_lite/admin/comp_off_requests/show.html.erb +19 -5
  44. data/app/views/hr_lite/admin/employees/_form.html.erb +20 -2
  45. data/app/views/hr_lite/admin/employees/show.html.erb +25 -15
  46. data/app/views/hr_lite/admin/leave_requests/show.html.erb +37 -5
  47. data/app/views/hr_lite/admin/overview/index.html.erb +21 -0
  48. data/app/views/hr_lite/admin/payroll_runs/show.html.erb +3 -1
  49. data/app/views/hr_lite/admin/regularization_requests/show.html.erb +18 -4
  50. data/app/views/hr_lite/attendance/_punch_card.html.erb +22 -2
  51. data/app/views/hr_lite/career/show.html.erb +7 -1
  52. data/app/views/hr_lite/salary_slips/_slip_detail.html.erb +5 -1
  53. data/app/views/hr_lite/salary_slips/pdf.html.erb +5 -5
  54. data/app/views/layouts/hr_lite/application.html.erb +42 -4
  55. data/config/routes.rb +1 -1
  56. data/db/migrate/20260807184103_add_live_uniqueness_indexes_to_hr_lite.rb +28 -0
  57. data/db/migrate/20260807184426_add_fy_opening_to_hr_lite_employee_profiles.rb +14 -0
  58. data/db/migrate/20260807184939_add_out_of_window_days_to_hr_lite_salary_slips.rb +12 -0
  59. data/lib/hr_lite/amount_in_words.rb +15 -2
  60. data/lib/hr_lite/money.rb +18 -0
  61. data/lib/hr_lite/notifications.rb +23 -8
  62. data/lib/hr_lite/statutory_rate_card.rb +6 -1
  63. data/lib/hr_lite/version.rb +1 -1
  64. data/lib/hr_lite.rb +5 -1
  65. metadata +5 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00cc5c346c88ddc803a5336a1c14a07dd4609fc887213f99e9b11654f26fa109
4
- data.tar.gz: 8306411151a38ea5b1fe0fe9c7b4bd3572e16917a1defc1e15d4e823ab7f9c1b
3
+ metadata.gz: d22267458cedf1755a676934b2488e404e78e26ea9c2b803f9dd72ee828b620d
4
+ data.tar.gz: 50605b10283eb03f12bde5884917c033aebf58e7afc968de790f9581ff6cf8d4
5
5
  SHA512:
6
- metadata.gz: 6f9be2057c4023881d956fc8feadb18d2917bb38cd92746b7a448a60fedea0fc94d335b22d36a627a8ce888e36a7520ca6118ad77e6f5956b96fdec695f813dc
7
- data.tar.gz: 95c8048ecd82dc4b92d9e4e5b79240bed1385e297206383280c76e010d141f666e57eb150eac9defdbe556978226d7b4a5fff21ff8132103e04e09862a36f3ad
6
+ metadata.gz: 7cc91aa10c5d70555bfedb8870d3d87cac4b06ea762222b768a120abae7ed5f46d94c96091aee92a397eb2390e5432611ede42076b78d02c060dcba4da3ebd53
7
+ data.tar.gz: 5e850af90388970e343448c95533a7251ce0834400f33c6570feef5eddb511621e888d9b7c28b1cbb6391bb70941730e1f2804470d9c1bf1a5439ea7edc85c38
data/CHANGELOG.md CHANGED
@@ -7,6 +7,153 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.5.2] - 2026-08-08
11
+
12
+ The rest of the audit that produced 0.5.1. **Adds three migrations** — they
13
+ run through the host's normal `db:migrate`; each table holds a handful of
14
+ rows per employee, so the builds are instant.
15
+
16
+ ### Fixed
17
+
18
+ - **Payroll accepted a run for a month that had not ended.** Days that have
19
+ not happened score as `upcoming`, which fed straight into payable days, so
20
+ computing mid-month paid for every remaining day as if it had been worked —
21
+ and finalizing froze that into immutable slips. `parse_month_param` made it
22
+ easy to reach: a mangled month fell back to the current one.
23
+ - **ESI eligibility was re-decided every month.** ESIC contribution periods run
24
+ April–September and October–March and eligibility holds for the whole
25
+ period; a mid-period raise past the ceiling used to end coverage on the spot.
26
+ - **A mid-year install deducted no tax.** TDS projected the year only from
27
+ slips this install produced, so earlier months — a previous employer, or the
28
+ months before payroll was switched on — read as zero income and usually put
29
+ the year under the rebate cap. `EmployeeProfile` gains `fy_opening_gross`
30
+ and `fy_opening_tds`.
31
+ - Regularization now re-checks the approved-leave conflict at approval. Leave
32
+ granted while the ticket waited made the fix a silent no-op, because
33
+ full-day leave outranks any punch — while everyone was told attendance had
34
+ been corrected.
35
+ - Admins can cancel leave. `cancellable_by?` always allowed it for approved
36
+ leave that has not started, but no route reached it, so leave called off
37
+ while someone was away could not be released and the quota stayed spent.
38
+ - One open resignation per person, one pending regularization per person per
39
+ day, and one leave type carrying the comp-off flag are now enforced by
40
+ partial unique indexes, not only by validations that race. Retiring the
41
+ flagged comp-off type releases the flag so a replacement can take it.
42
+ - An employee whose resignation was already accepted can no longer file
43
+ another, which would have overwritten the agreed exit date.
44
+ - `Audited` fires on commit. Firing inside the transaction announced changes
45
+ to leadership that then rolled back — a failed onboarding mailed out a diff
46
+ for a profile that was never saved.
47
+ - Slips record and show days outside the employment window, so a mid-month
48
+ joiner's payslip adds up instead of looking short.
49
+ - The career page dates the current role from the change actually in force,
50
+ not from a promotion recorded for next quarter.
51
+ - The org chart's reporting line stops at the first manager who has left; it
52
+ used to skip them and promote everyone above a level, contradicting the
53
+ tree below.
54
+ - Publishing no longer bells offboarded people at a page their revoked login
55
+ cannot open. They still get the email.
56
+ - Leadership copies of employee-scoped notifications are named and point at a
57
+ page leadership can open. "Your appraisal has been shared" linking to
58
+ `/appraisals/7` was fanned out verbatim; the leadership copy also drops the
59
+ rating, which is money-tier.
60
+
61
+ ### Performance
62
+
63
+ - `LeaveBalance#used` builds one working calendar for the leave year instead
64
+ of one per approved request — measured 11 queries down to 1 for five
65
+ requests, and the admin balances grid multiplies that by employees × leave
66
+ types.
67
+ - `HrLite.admin_users` starts from `employees_scope` rather than loading and
68
+ instantiating every row in the users table on each admin notification.
69
+
70
+ ## [0.5.1] - 2026-08-07
71
+
72
+ Bug-fix release from a full audit of the engine. No migrations, no
73
+ configuration changes required.
74
+
75
+ ### Fixed
76
+
77
+ - **Every admin "Reject" button returned a 422.** The decision screens
78
+ rendered one form pointed at the approve endpoint and retargeted the
79
+ Reject button with `formaction:`. Rails binds the authenticity token to
80
+ the form's own action and method (`per_form_csrf_tokens`, the default
81
+ since `load_defaults 5.0`), so that token was never valid at the reject
82
+ path. Comp-off, leave and regularization rejections could not be made
83
+ from a browser at all. Each screen now renders separate Approve and
84
+ Reject forms.
85
+ - **`PayrollRun#compute!` demoted any run — including a published one — to
86
+ `draft`.** The `raise_unless` guard raised inside the method-level
87
+ rescue, which then rewrote the status. Draft runs are deletable and the
88
+ delete cascades over every salary slip. The guard now sits outside the
89
+ rescue and the previous status is restored; a run stranded in
90
+ `processing` is recoverable.
91
+ - **TDS was wrong on every slip from April to December**: months remaining
92
+ in the financial year read `15 - month` instead of `16 - month`.
93
+ - TDS to-date counted published slips only, so a finalized-but-unpublished
94
+ month projected as zero income; §115BAC marginal relief above the rebate
95
+ cap was missing; a leaver's projection ran past their exit month.
96
+ - Net pay is floored at zero and the run warns when deductions exceed
97
+ earnings. Review-stage LOP and TDS overrides are bounded.
98
+ - **A configured superadmin absent from `leadership_emails` was locked out
99
+ of the money tier entirely.** `SuperadminController` no longer inherits
100
+ the leadership check, and the Payroll nav item hangs off the money tier.
101
+ - Appraisal ratings and review text reached ordinary leadership through
102
+ the audit screen and the `policy.changed` email; money-tier subjects are
103
+ excluded from both.
104
+ - Accepting a resignation stamped an exit date, which hid the only control
105
+ that revokes sign-in. The card stays, and access is revoked immediately
106
+ when the last day has already passed.
107
+ - Onboarding created the login before validating the profile and outside
108
+ any transaction, leaving orphaned role-bearing accounts behind.
109
+ - A backdated `DesignationChange` overwrote the current designation and
110
+ pushed it to the host; only the newest row applies now.
111
+ - Editing a profile whose manager had exited silently cleared the
112
+ reporting line, because the select offered no matching option.
113
+ - Leave: creation and approval use the same as-of date (future-dated
114
+ requests on monthly accrual could be filed but never approved); approval
115
+ locks the balance row rather than the request row; the stored adjustment
116
+ has one locked write path; entitlement stops accruing at the exit date;
117
+ the comp-off flag can be moved to a replacement leave type.
118
+ - Attendance: a check-out with no check-in is refused; clearing both times
119
+ on a day with no punch no longer writes a bogus audit row or emails a
120
+ removal that never happened; the punch card offers yesterday's check-out
121
+ after midnight; `geo_status` is confined to what a browser can report.
122
+ - The overview board counts and lists comp-off and regularization, and the
123
+ team attendance KPIs add up to the headcount again.
124
+ - One bad recipient no longer drops the rest of a notification fan-out.
125
+ - The slip PDF formats money like the web slip; amounts in words handle
126
+ negatives and figures above ₹100 crore; professional-tax slabs gained an
127
+ inclusive `from:` bound.
128
+
129
+ ### Added
130
+
131
+ - A **More** tab on phones, opening a sheet with every nav item and every
132
+ group the viewer is entitled to. Below 768px the left rail is hidden and
133
+ the tab bar holds five items, so the rest of the app — including all
134
+ admin, leadership and payroll screens — was unreachable.
135
+ - Confirmation prompts that actually run. The engine ships no Turbo, so
136
+ its `data-turbo-confirm` attributes were inert and destructive buttons
137
+ fired on the first click. A small script reads the same attribute and
138
+ stands aside when a host does load Turbo.
139
+ - A retry policy on the engine's jobs, which had never inherited
140
+ `ApplicationJob`.
141
+
142
+ ### Documentation
143
+
144
+ - Reworked the README to open-source standard: a shields.io badge row, a table
145
+ of contents, a per-feature usage guide (attendance and geolocation; leave,
146
+ comp-off and regularization; payroll; kudos and @mentions; the notification
147
+ bus), and sections for the recurring jobs, rake tasks and the install
148
+ generator.
149
+ - Documented the leadership and superadmin (money) access tiers, and the
150
+ `HR_LEADERSHIP_EMAILS` convention the generated initializer uses to keep the
151
+ governing list out of a deploy.
152
+ - Filled gaps in `docs/CONFIGURATION.md`: the `superadmin_check`,
153
+ `public_url_base`, `onboard_user`, `offboard_user` and `invite_url_for`
154
+ keys, and the `resignation.*`, `employee.onboarded` and `payroll.draft_ready`
155
+ rows of the notification matrix.
156
+
10
157
  ## [0.5.0] - 2026-07-20
11
158
 
12
159
  ### Added
@@ -202,5 +349,14 @@ Initial release.
202
349
  bus with per-event channel matrix (bell, email, leadership email/bell),
203
350
  daily leadership digest and an append-only audit trail.
204
351
 
205
- [Unreleased]: https://github.com/kshtzkr/hr_lite/compare/v0.1.0...HEAD
352
+ [Unreleased]: https://github.com/kshtzkr/hr_lite/compare/v0.5.2...HEAD
353
+ [0.5.2]: https://github.com/kshtzkr/hr_lite/compare/v0.5.1...v0.5.2
354
+ [0.5.1]: https://github.com/kshtzkr/hr_lite/compare/v0.5.0...v0.5.1
355
+ [0.5.0]: https://github.com/kshtzkr/hr_lite/compare/v0.4.0...v0.5.0
356
+ [0.4.0]: https://github.com/kshtzkr/hr_lite/compare/v0.3.0...v0.4.0
357
+ [0.3.0]: https://github.com/kshtzkr/hr_lite/compare/v0.2.1...v0.3.0
358
+ [0.2.1]: https://github.com/kshtzkr/hr_lite/compare/v0.2.0...v0.2.1
359
+ [0.2.0]: https://github.com/kshtzkr/hr_lite/compare/v0.1.2...v0.2.0
360
+ [0.1.2]: https://github.com/kshtzkr/hr_lite/compare/v0.1.1...v0.1.2
361
+ [0.1.1]: https://github.com/kshtzkr/hr_lite/compare/v0.1.0...v0.1.1
206
362
  [0.1.0]: https://github.com/kshtzkr/hr_lite/releases/tag/v0.1.0