hr_lite 0.69.1 → 0.74.0

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +61 -0
  3. data/app/assets/stylesheets/hr_lite/hr_lite.css +9 -4
  4. data/app/controllers/hr_lite/admin/audit_logs_controller.rb +4 -1
  5. data/app/controllers/hr_lite/admin/expense_categories_controller.rb +3 -0
  6. data/app/controllers/hr_lite/admin/expenses_controller.rb +2 -0
  7. data/app/controllers/hr_lite/admin/office_locations_controller.rb +3 -0
  8. data/app/controllers/hr_lite/admin/resignations_controller.rb +3 -0
  9. data/app/controllers/hr_lite/admin/salary_slips_controller.rb +5 -2
  10. data/app/controllers/hr_lite/admin/settings_controller.rb +3 -0
  11. data/app/controllers/hr_lite/awards_controller.rb +37 -0
  12. data/app/models/hr_lite/award.rb +6 -1
  13. data/app/models/hr_lite/hr_request.rb +1 -1
  14. data/app/models/hr_lite/salary_slip.rb +5 -1
  15. data/app/services/hr_lite/payroll_run_processor.rb +1 -1
  16. data/app/services/hr_lite/slip_builder.rb +14 -10
  17. data/app/views/hr_lite/admin/comp_off_requests/index.html.erb +1 -1
  18. data/app/views/hr_lite/admin/employees/_form.html.erb +1 -1
  19. data/app/views/hr_lite/admin/expense_categories/index.html.erb +1 -1
  20. data/app/views/hr_lite/admin/leave_requests/index.html.erb +1 -1
  21. data/app/views/hr_lite/admin/leave_types/index.html.erb +1 -1
  22. data/app/views/hr_lite/admin/loans/index.html.erb +1 -1
  23. data/app/views/hr_lite/admin/office_locations/index.html.erb +1 -1
  24. data/app/views/hr_lite/admin/payroll_runs/index.html.erb +1 -1
  25. data/app/views/hr_lite/admin/payroll_runs/show.html.erb +2 -2
  26. data/app/views/hr_lite/admin/salary_slips/show.html.erb +16 -0
  27. data/app/views/hr_lite/admin/statutory_rate_cards/index.html.erb +1 -1
  28. data/app/views/hr_lite/admin/tax_declarations/index.html.erb +1 -1
  29. data/app/views/hr_lite/admin/tax_declarations/overview.html.erb +1 -1
  30. data/app/views/hr_lite/awards/pdf.html.erb +17 -0
  31. data/app/views/hr_lite/awards/shared.html.erb +12 -0
  32. data/app/views/hr_lite/awards/show.html.erb +24 -0
  33. data/app/views/hr_lite/event_mailer/event.html.erb +1 -1
  34. data/app/views/hr_lite/event_mailer/leadership.html.erb +3 -1
  35. data/app/views/hr_lite/event_mailer/leadership.text.erb +1 -1
  36. data/app/views/hr_lite/home/index.html.erb +1 -0
  37. data/app/views/hr_lite/salary_slips/_slip_detail.html.erb +1 -1
  38. data/app/views/hr_lite/salary_slips/pdf.html.erb +1 -1
  39. data/app/views/hr_lite/team/show.html.erb +1 -1
  40. data/app/views/layouts/hr_lite/public.html.erb +1 -0
  41. data/config/routes.rb +2 -0
  42. data/db/migrate/20261116090000_backfill_hr_lite_enforced_permission_keys.rb +20 -0
  43. data/db/migrate/20261202090000_add_skipped_deductions_to_hr_lite_salary_slips.rb +7 -0
  44. data/lib/hr_lite/configuration.rb +2 -1
  45. data/lib/hr_lite/notifications.rb +2 -1
  46. data/lib/hr_lite/version.rb +1 -1
  47. metadata +7 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1baf60c535e3b5cdc3eac6c3cea7b16ef017d9a5bc544035c5baa84091aa665
4
- data.tar.gz: 9061aa56cb55d265c5e998379103d346f3b170cf86b13b57d9bd0aef391b78d6
3
+ metadata.gz: 0b2109e141e5eecc5e10199caf0b1ac0e32e9ea87cd12f7b78a10a28d10aab88
4
+ data.tar.gz: b0513cc225cc973cc280e33c02a76eb1900ac9c33fb10db7584ca8cc8c90edec
5
5
  SHA512:
6
- metadata.gz: 05cbcd508ef90ef56166997654d61fcd0bcdd093c5b6eed42d2d5343adaba94bf697a0e4b2520884516d0d6aeaee8ac2b6317a76b8a53b08921bf01ad06925da
7
- data.tar.gz: f04403add05a6a730e96e18ca7b554049979fe52bb32d1ba7e49ca526bb34f09855b19336665d8806307708514c66ca538349aeb0bb75c3ab5948c0d86dfbcc9
6
+ metadata.gz: 24b25c03be5e0585056918e8e9d309415c560b541c7620197cc21159f44e9f0d5979bd996af7689fc5919eadbf645e38349707262241c3bf0694f7d33409e3f4
7
+ data.tar.gz: 26ab62d69fb38a81dc98ffcd2fc11fc135539762e1844391ac45d1f622ca49bc86593c7d9e5e9063827c169d1a780c0d0223b1b716ef8c8132015f3ccf362bae
data/CHANGELOG.md CHANGED
@@ -7,6 +7,67 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.74.0] - 2026-12-02
11
+
12
+ ### Added
13
+
14
+ - **Payroll can leave a deduction off one person's slip for one month.** A slip in review has a tick box per deduction: unpaid leave days, PF, ESI, professional tax, other deductions, loan repayment and TDS. An unticked one is not taken, a recompute keeps it off, and the audit log names it. "Pay full salary" unticks them all. A skipped loan instalment stays owed. One migration: `skipped_deductions` on salary slips.
15
+
16
+ ## [0.73.0] - 2026-12-02
17
+
18
+ ### Added
19
+
20
+ - A one-off deduction's note shows under it on the payslip and in the PDF. Slips computed before this keep no note until recomputed.
21
+ - Each row of a payroll run links to that person's attendance for the month.
22
+
23
+ No migrations.
24
+
25
+ ## [0.72.0] - 2026-12-02
26
+
27
+ ### Added
28
+
29
+ - **An award has a certificate.** Home links each award to its page, which opens the certificate as a PDF. The winner's email links there too. The certificate carries the award, the period, the winner's name and the company; it does not print the citation.
30
+ - **The winner can share it on LinkedIn.** The link opens a public page for that one certificate, reached by a signed id, with no login. It needs `config.public_url_base`.
31
+ - **The winner can ask for a printed copy.** It is an Ask HR request in the new "Award certificate" category, so the people who answer requests get the bell and the email.
32
+ - **The whole team hears who won.** A new `award.team_notice` bells and emails every active employee but the winner, with a link to the certificate page and no citation. Hosts can mute either channel in the notification matrix.
33
+
34
+ No migrations.
35
+
36
+ ## [0.71.1] - 2026-12-02
37
+
38
+ ### Fixed
39
+
40
+ - The change table in a leadership email shows text as it was written, with its line breaks. It printed the quotes and a literal `\r\n`.
41
+ - An event email keeps the paragraphs of its body. A multi-line award citation arrived as one block.
42
+
43
+ No migrations.
44
+
45
+ ## [0.71.0] - 2026-11-20
46
+
47
+ ### Added
48
+
49
+ - `config.email_opt_out`: a host callable `->(event, user)` that skips the per-user email of an event for a user who does not want it. Bells and leadership emails are unchanged. No migrations.
50
+
51
+ ## [0.70.1] - 2026-11-16
52
+
53
+ Layout fixes from an audit of every screen at 360px and 1440px. No migrations.
54
+
55
+ - **The More sheet names every tab.** The line under each place was cut with "…" on a phone. It now wraps.
56
+ - **A tick box's whole row takes the tap.** Where the label sits beside the box, a tap just off the 18px box did nothing. The label's tap area now covers the row.
57
+ - **Number columns have their heading over the numbers** on twelve tables (payroll runs, loans, leave types, tax overview and others). The heading was left-aligned over right-aligned figures.
58
+ - **The "‹" and "›" pager arrows are 44px wide** on work time and a person's summary. They were 38 to 41px, depending on the font.
59
+ - **Buttons on one line share a height**: Edit beside an open "More actions" on an employee, and Edit beside Share on a draft appraisal.
60
+ - **The weekday boxes of a shorter-day rule line up.** The first sat 4px above the rest.
61
+ - The new-employee picker's blank option reads "— new person, below —", which fits a phone.
62
+
63
+ ## [0.70.0] - 2026-11-16
64
+
65
+ Five permissions on the Roles screen are now checked. One data migration.
66
+
67
+ - **Each screen asks for its own permission.** The audit trail needs "Read the audit trail" (`audit.view`); pay and appraisal rows in it need `audit.view_money`; HR settings, office locations and expense categories need `settings.manage`; accepting a resignation needs `resignation.manage`; putting an approved claim on payroll needs `expense.reimburse`. Before, these boxes did nothing: the screens opened on `profile.manage`, `payroll.manage` or `expense.approve`.
68
+ - **Nobody loses access on upgrade.** The migration gives every role the new permission wherever it holds the one that opened the screen before. Untick a box on the Roles screen to take a screen away from a role.
69
+ - A role that held `audit.view` without `profile.manage` (seeded Finance) can now open the audit trail by its address; the menu link still shows for leadership only.
70
+
10
71
  ## [0.69.1] - 2026-11-10
11
72
 
12
73
  HR (and admins) can record leave on any working day. No migrations.
@@ -121,7 +121,7 @@ html:has(.hrl-body) { scroll-padding-top: 4rem; scroll-padding-bottom: calc(4.4r
121
121
  /* Place icons: stroke-only, decoration beside a label that always shows. */
122
122
  .hrl-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
123
123
  .hrl-nav__text { display: flex; flex-direction: column; min-width: 0; }
124
- .hrl-nav__hint { font-size: var(--hrl-t-small); font-weight: 400; color: var(--hrl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
124
+ .hrl-nav__hint { font-size: var(--hrl-t-small); font-weight: 400; color: var(--hrl-muted); }
125
125
  .hrl-nav__link--active .hrl-nav__hint { color: inherit; }
126
126
  /* Tab row: the current place's tabs on one line; it scrolls sideways, never the page. */
127
127
  .hrl-tabrow { display: flex; gap: var(--hrl-gap-target); overflow-x: auto; margin: 0 0 var(--hrl-s-4); padding-bottom: var(--hrl-s-2); border-bottom: 1px solid var(--hrl-line); }
@@ -228,6 +228,7 @@ html:has(.hrl-body) { scroll-padding-top: 4rem; scroll-padding-bottom: calc(4.4r
228
228
  .hrl-page__actions { width: 100%; display: flex; flex-wrap: wrap; gap: .5rem; }
229
229
  .hrl-page__actions .hrl-btn { flex: 1 1 auto; }
230
230
  .hrl-page__actions .hrl-btn[aria-label] { flex: 0 0 auto; } /* icon-only pager arrows keep their width */
231
+ .hrl-page__actions:has(> details[open]) { align-items: flex-start; } /* an open menu does not stretch the button beside it */
231
232
  @media (min-width: 481px) {
232
233
  .hrl-page__actions { width: auto; margin-left: auto; }
233
234
  .hrl-page__actions .hrl-btn { flex: 0 1 auto; }
@@ -292,6 +293,7 @@ details > form > button[type=submit], details > form > .hrl-btn { margin-top: .2
292
293
  .hrl-btn--block { width: 100%; }
293
294
  .hrl-btn--big { min-height: 58px; font-size: var(--hrl-t-lead); }
294
295
  .hrl-btn[disabled] { opacity: .55; cursor: default; }
296
+ .hrl-btn[aria-label] { min-width: var(--hrl-target); } /* an arrow-only button is a full target */
295
297
  summary.hrl-btn { list-style: none; }
296
298
  summary.hrl-btn::-webkit-details-marker { display: none; } /* Safari before 18.4 draws it whatever the display */
297
299
  /* A line with an "i": tap anywhere on it for why; the reason drops below. */
@@ -361,16 +363,18 @@ fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
361
363
  }
362
364
  .hrl-field textarea { min-height: 90px; resize: vertical; }
363
365
  .hrl-filter { appearance: none; margin-bottom: var(--hrl-gap-target); } /* select_filter.js search box above its select */
364
- .hrl-field--check { display: flex; align-items: center; gap: .55rem; min-height: var(--hrl-target); }
366
+ .hrl-field--check { display: flex; align-items: center; gap: .55rem; min-height: var(--hrl-target); position: relative; }
365
367
  .hrl-field--check + .hrl-field--check { margin-top: var(--hrl-gap-target); }
368
+ .hrl-row > .hrl-field--check { margin-top: 0; } /* side by side: the row's gap spaces them */
366
369
  /* A choice row inside a .hrl-field keeps its row layout (.hrl-field label would make it a block). */
367
370
  .hrl-field label.hrl-field--check { display: flex; font-size: inherit; font-weight: 400; margin-bottom: 0; }
368
371
  .hrl-field--check input {
369
- width: 1.15rem; height: 1.15rem; min-height: 0; flex: 0 0 auto;
372
+ width: 1.15rem; height: 1.15rem; min-height: 0; flex: 0 0 auto; position: relative; z-index: 1; /* above the label's ::before */
370
373
  accent-color: var(--hrl-accent);
371
374
  }
372
- /* The 44px label is the tap target for the small box. */
375
+ /* The 44px label is the tap target for the small box; its ::before carries that over the box and the gap. */
373
376
  .hrl-field--check label { margin-bottom: 0; font-weight: 600; flex: 1; min-height: var(--hrl-target); display: flex; align-items: center; }
377
+ .hrl-field--check label::before { content: ""; position: absolute; inset: 0; }
374
378
  .hrl-field--check label .hrl-hint { display: block; margin-top: 0; font-weight: 400; }
375
379
  /* Rails wraps an invalid label/field in this div; contents keeps the stack, the re-pointed token reddens the border. */
376
380
  .field_with_errors { display: contents; --hrl-field: var(--hrl-bad); }
@@ -397,6 +401,7 @@ fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
397
401
  .hrl-feed { list-style: none; margin: 0; padding: 0; }
398
402
  .hrl-feed__item { display: flex; gap: .7rem; padding: .8rem 0; border-bottom: 1px solid var(--hrl-line); }
399
403
  .hrl-feed__item:last-child { border-bottom: 0; }
404
+ .hrl-feed__item > .button_to { display: flex; } /* its button stretches like a link button beside it */
400
405
  .hrl-avatar {
401
406
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: var(--hrl-radius-pill);
402
407
  background: var(--hrl-info-bg); color: var(--hrl-accent);
@@ -1,10 +1,13 @@
1
1
  module HrLite
2
2
  module Admin
3
3
  class AuditLogsController < LeadershipController
4
+ skip_before_action :require_governing_access!
5
+ before_action -> { hr_require_permission!("audit.view", scope: :all) }
6
+
4
7
  def index
5
8
  # Appraisal and promotion rows carry review text in plain columns:
6
9
  # ordinary leadership governs people and policy, not pay.
7
- scope = hr_superadmin? ? AuditLog.recent : AuditLog.recent.outside_money_tier
10
+ scope = hr_can?("audit.view_money", scope: :all) ? AuditLog.recent : AuditLog.recent.outside_money_tier
8
11
  scope = scope.where.not("action LIKE ?", "%.viewed") unless params[:views] # page views drown the changes
9
12
  @audit_logs = paginate(scope.includes(:actor))
10
13
  end
@@ -3,6 +3,9 @@ module HrLite
3
3
  # No destroy: claims hold the category by foreign key. Retire one by
4
4
  # unticking Active, which takes it off the claim form.
5
5
  class ExpenseCategoriesController < LeadershipController
6
+ skip_before_action :require_governing_access!
7
+ before_action -> { hr_require_permission!("settings.manage", scope: :all) }
8
+
6
9
  def index
7
10
  @expense_categories = ExpenseCategory.alphabetical
8
11
  end
@@ -31,6 +31,8 @@ module HrLite
31
31
  end
32
32
 
33
33
  def reimburse
34
+ return hr_access_denied unless hr_can?("expense.reimburse", scope: :all)
35
+
34
36
  expense = decidable.find(params[:id])
35
37
  month = parse_month_param(params[:period_month])
36
38
  expense.reimburse!(actor: hr_current_user, period_month: month)
@@ -1,6 +1,9 @@
1
1
  module HrLite
2
2
  module Admin
3
3
  class OfficeLocationsController < LeadershipController
4
+ skip_before_action :require_governing_access!
5
+ before_action -> { hr_require_permission!("settings.manage", scope: :all) }
6
+
4
7
  def index
5
8
  @office_locations = OfficeLocation.order(:name)
6
9
  end
@@ -1,6 +1,9 @@
1
1
  module HrLite
2
2
  module Admin
3
3
  class ResignationsController < LeadershipController
4
+ skip_before_action :require_governing_access!
5
+ before_action -> { hr_require_permission!("resignation.manage", scope: :all) }
6
+
4
7
  def accept
5
8
  resignation = Resignation.find(params[:id])
6
9
  resignation.accept!(
@@ -41,16 +41,19 @@ module HrLite
41
41
  return redirect_to admin_salary_slip_path(slip), alert: "TDS cannot be negative."
42
42
  end
43
43
 
44
+ # Ticked boxes are the deductions to take; a post without them keeps the slip's own.
45
+ deduct = params[:pay_full] ? [] : params.dig(:salary_slip, :deduct)
46
+ skip = deduct ? SalarySlip::SKIPPABLE.keys - deduct : slip.skipped_deductions.split
44
47
  attributes = SlipBuilder.call(
45
48
  run: run, user: slip.user, structure: structure, profile: profile,
46
- lop_override: lop, tds_override: tds
49
+ lop_override: lop, tds_override: tds, skip: skip
47
50
  )
48
51
  slip.update!(attributes)
49
52
 
50
53
  AuditLog.record!(
51
54
  action: "override", subject: slip, actor: hr_current_user,
52
55
  changes: { "period" => run.label, "employee" => HrLite.display_name(slip.user),
53
- "lop_override" => lop_override || "cleared",
56
+ "lop_override" => lop_override || "cleared", "not_deducted" => skip.join(" ").presence || "none",
54
57
  "tds_override" => tds_override ? "[changed]" : "cleared" }
55
58
  )
56
59
  redirect_to admin_salary_slip_path(slip), notice: "Slip recomputed with overrides."
@@ -1,6 +1,9 @@
1
1
  module HrLite
2
2
  module Admin
3
3
  class SettingsController < LeadershipController
4
+ skip_before_action :require_governing_access!
5
+ before_action -> { hr_require_permission!("settings.manage", scope: :all) }
6
+
4
7
  def edit
5
8
  @setting = Setting.instance
6
9
  end
@@ -0,0 +1,37 @@
1
+ module HrLite
2
+ # An award's certificate: its page, its PDF, and the public page a winner shares.
3
+ class AwardsController < ApplicationController
4
+ # WHY no login on :shared: the winner posts this link on LinkedIn. The
5
+ # signed id in it opens that one certificate, which carries no citation.
6
+ skip_before_action :hr_authenticate!, only: :shared
7
+ skip_before_action HrLite.config.authenticate_method, only: :shared, raise: false
8
+
9
+ def show
10
+ @award = Award.find(params[:id])
11
+ @print_requested = HrRequest.open_requests.where(user_id: @award.user_id, subject: @award.print_subject).pick(:created_at)
12
+ certificate
13
+ end
14
+
15
+ def shared
16
+ @award = Award.find_signed(params[:token], purpose: :certificate) || raise(ActiveRecord::RecordNotFound)
17
+ certificate(layout: "hr_lite/public")
18
+ end
19
+
20
+ private
21
+
22
+ def certificate(layout: nil)
23
+ respond_to do |format|
24
+ format.html { render layout: layout if layout }
25
+ format.pdf do
26
+ name = HrLite.display_name(@award.user)
27
+ pdf = PdfRenderer.render(template: "hr_lite/awards/pdf", assigns: { award: @award },
28
+ cache_key: [ "hr_lite_award_v1", @award.id, @award.updated_at.to_i, name ].join("/"))
29
+ next head(:not_found) unless pdf
30
+
31
+ send_data pdf, filename: "#{@award.title.parameterize}-#{@award.period_start}.pdf",
32
+ type: "application/pdf", disposition: "inline"
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -24,6 +24,7 @@ module HrLite
24
24
  end
25
25
 
26
26
  def title = "Employee of the #{kind}"
27
+ def print_subject = "Printed certificate — #{title}, #{period_label}"
27
28
 
28
29
  def period_label
29
30
  case kind
@@ -44,7 +45,11 @@ module HrLite
44
45
 
45
46
  def notify
46
47
  Notifications.publish("award.won", title: "You are #{title} — #{period_label}", body: citation,
47
- path: "/timeline", bell_to: [ user ], email_to: [ user ])
48
+ path: "/awards/#{id}", bell_to: [ user ], email_to: [ user ])
49
+ # The team hears who won, not the citation: that is written to the winner.
50
+ team = HrLite.active_employees.reject { |member| member.id == user_id }
51
+ Notifications.publish("award.team_notice", title: "#{HrLite.display_name(user)} is #{title} — #{period_label}",
52
+ path: "/awards/#{id}", bell_to: team, email_to: team)
48
53
  end
49
54
  end
50
55
  end
@@ -8,7 +8,7 @@ module HrLite
8
8
 
9
9
  CATEGORIES = %w[
10
10
  salary_certificate employment_certificate address_change bank_change
11
- document_request payroll_query tax_query insurance_query policy_query id_card other
11
+ document_request payroll_query tax_query insurance_query policy_query award_certificate id_card other
12
12
  ].freeze
13
13
 
14
14
  belongs_to :user, class_name: HrLite.config.user_class
@@ -7,6 +7,10 @@ module HrLite
7
7
  class SalarySlip < ApplicationRecord
8
8
  include EncryptedMoney
9
9
 
10
+ # Deductions payroll may leave off one person's slip for one month.
11
+ SKIPPABLE = { "lop" => "Unpaid leave days", "pf" => "Provident fund", "esi" => "ESI", "pt" => "Professional tax",
12
+ "other" => "Other deductions", "loan" => "Loan repayment", "tds" => "Income tax (TDS)" }.freeze
13
+
10
14
  belongs_to :payroll_run
11
15
  belongs_to :user, class_name: HrLite.config.user_class
12
16
 
@@ -63,7 +67,7 @@ module HrLite
63
67
 
64
68
  # Bump the version when the PDF template changes, or the old layout serves until the cache expires.
65
69
  def pdf_cache_key
66
- [ "hr_lite_slip_v3", id, updated_at.to_i, payroll_run.status,
70
+ [ "hr_lite_slip_v4", id, updated_at.to_i, payroll_run.status,
67
71
  user_profile&.updated_at.to_i ].join("/")
68
72
  end
69
73
 
@@ -42,7 +42,7 @@ module HrLite
42
42
  slip = @run.salary_slips.find_or_initialize_by(user_id: user.id)
43
43
  attributes = SlipBuilder.call(
44
44
  run: @run, user: user, structure: structure, profile: profile,
45
- lop_override: slip.lop_override, tds_override: slip.tds_override
45
+ lop_override: slip.lop_override, tds_override: slip.tds_override, skip: slip.skipped_deductions.split
46
46
  )
47
47
  if attributes[:total_deductions] > attributes[:gross_earnings]
48
48
  warnings << "Deductions exceed earnings for #{HrLite.display_name(user)} — " \
@@ -4,11 +4,13 @@ module HrLite
4
4
  # rounded by its own statutory rule exactly once; net pay is a plain
5
5
  # subtraction of already-rounded lines, so nothing can drift.
6
6
  class SlipBuilder
7
- def self.call(run:, user:, structure:, profile:, lop_override: nil, tds_override: nil)
8
- new(run, user, structure, profile, lop_override, tds_override).call
7
+ # `skip` holds SalarySlip::SKIPPABLE codes: deductions not taken this month.
8
+ def self.call(run:, user:, structure:, profile:, lop_override: nil, tds_override: nil, skip: [])
9
+ new(run, user, structure, profile, lop_override, tds_override, skip).call
9
10
  end
10
11
 
11
- def initialize(run, user, structure, profile, lop_override, tds_override)
12
+ def initialize(run, user, structure, profile, lop_override, tds_override, skip = [])
13
+ @skip = skip
12
14
  @run = run
13
15
  @user = user
14
16
  @structure = structure
@@ -24,6 +26,7 @@ module HrLite
24
26
  # Clamped defensively: a stored negative override (written before the
25
27
  # controller bounded them) would otherwise pay more days than the month has.
26
28
  lop = [ Money.d(@lop_override || summary[:lop_days]), BigDecimal(0) ].max
29
+ lop = BigDecimal(0) if @skip.include?("lop")
27
30
  # `upcoming` is normally zero — PayrollRun refuses a month that has not
28
31
  # ended — but subtracting it means a legacy run for an open month cannot
29
32
  # pay for days nobody has worked yet.
@@ -48,7 +51,7 @@ module HrLite
48
51
  deductions = []
49
52
  employer_costs = {}
50
53
 
51
- if @structure.pf_applicable
54
+ if @structure.pf_applicable && @skip.exclude?("pf")
52
55
  pf = Calculators::Pf.call(basic_earned: basic_earned,
53
56
  on_full_basic: @structure.pf_on_full_basic, rates: @rates[:pf])
54
57
  deductions << { code: "pf_employee", label: "Provident fund", amount: pf.employee,
@@ -60,7 +63,7 @@ module HrLite
60
63
  end
61
64
 
62
65
  esi = Calculators::Esi.call(monthly_gross: @structure.esi_reference_gross(@run.period_month), gross_earned: esi_gross,
63
- applicable: @structure.esi_applicable, rates: @rates[:esi])
66
+ applicable: @structure.esi_applicable && @skip.exclude?("esi"), rates: @rates[:esi])
64
67
  if esi.applicable?
65
68
  deductions << { code: "esi_employee", label: "ESI", amount: esi.employee }
66
69
  employer_costs[:esi_employer] = esi.employer
@@ -68,9 +71,9 @@ module HrLite
68
71
 
69
72
  pt = Calculators::ProfessionalTax.call(state: @structure.pt_state, gross_earned: gross_earned,
70
73
  period_month: @run.period_month, rates: @rates[:pt])
71
- deductions << { code: "pt", label: "Professional tax", amount: pt } if pt.positive?
74
+ deductions << { code: "pt", label: "Professional tax", amount: pt } if pt.positive? && @skip.exclude?("pt")
72
75
 
73
- deductions.concat(extra_deductions)
76
+ deductions.concat(extra_deductions) if @skip.exclude?("other")
74
77
 
75
78
  fy =SalarySlip.fy_to_date(@user, @run.period_month)
76
79
  tds = Calculators::Tds.call(
@@ -86,9 +89,9 @@ module HrLite
86
89
  months_remaining: months_remaining_in_fy,
87
90
  declared_annual_deductions: annual_deductions,
88
91
  rates: @rates[:income_tax],
89
- override: @tds_override
92
+ override: @skip.include?("tds") ? 0 : @tds_override
90
93
  )
91
- loan = loan_instalment(gross_earned - deductions.sum(BigDecimal(0)) { |row| row[:amount] } - tds.monthly)
94
+ loan = loan_instalment(gross_earned - deductions.sum(BigDecimal(0)) { |row| row[:amount] } - tds.monthly) if @skip.exclude?("loan")
92
95
  deductions << loan if loan
93
96
  deductions << { code: "tds", label: "Income tax (TDS)", amount: tds.monthly } if tds.monthly.positive?
94
97
 
@@ -109,6 +112,7 @@ module HrLite
109
112
  lop_days: Money.d(summary[:lop_days]),
110
113
  lop_override: @lop_override,
111
114
  tds_override: @tds_override,
115
+ skipped_deductions: @skip.join(" "),
112
116
  earnings: serialize_rows(earnings + claims),
113
117
  deductions: serialize_rows(deductions),
114
118
  employer_costs: employer_costs.transform_values { |v| v.to_s("F") }.to_json,
@@ -163,7 +167,7 @@ module HrLite
163
167
  end
164
168
  next unless amount.positive?
165
169
 
166
- row = { code: component.code, label: component.label, amount: amount }
170
+ row = { code: component.code, label: component.label, amount: amount, note: item.note.presence }.compact
167
171
  if component.earning?
168
172
  earnings << row.merge(excluded_from_esi: !component.counts_for_esi)
169
173
  else
@@ -14,7 +14,7 @@
14
14
  <% if @requests.any? %>
15
15
  <div class="hrl-table-wrap">
16
16
  <table class="hrl-table hrl-table--stack">
17
- <thead><tr><th>Employee</th><th>Day worked</th><th>Credit</th><th></th></tr></thead>
17
+ <thead><tr><th>Employee</th><th>Day worked</th><th class="hrl-num">Credit</th><th></th></tr></thead>
18
18
  <tbody>
19
19
  <% @requests.each do |request| %>
20
20
  <tr>
@@ -6,7 +6,7 @@
6
6
  <div class="hrl-field">
7
7
  <%= f.label :user_id, "Existing staff member" %>
8
8
  <%= f.select :user_id, HrLite.employees.map { |u| [ HrLite.display_name(u), u.id ] },
9
- { include_blank: "— onboard a brand-new person below —" },
9
+ { include_blank: "— new person, below —" },
10
10
  data: { hrl_filter: "Filter existing staff" } %>
11
11
  </div>
12
12
  <fieldset class="hrl-card">
@@ -10,7 +10,7 @@
10
10
  <% if @expense_categories.any? %>
11
11
  <div class="hrl-table-wrap">
12
12
  <table class="hrl-table hrl-table--stack">
13
- <thead><tr><th>Name</th><th>Monthly cap</th><th>Receipt</th><th>Active</th><th></th></tr></thead>
13
+ <thead><tr><th>Name</th><th class="hrl-num">Monthly cap</th><th>Receipt</th><th>Active</th><th></th></tr></thead>
14
14
  <tbody>
15
15
  <% @expense_categories.each do |category| %>
16
16
  <tr>
@@ -16,7 +16,7 @@
16
16
  <% if @requests.any? %>
17
17
  <div class="hrl-table-wrap">
18
18
  <table class="hrl-table hrl-table--stack">
19
- <thead><tr><th>Employee</th><th>Type</th><th>Dates</th><th>Days</th><th></th></tr></thead>
19
+ <thead><tr><th>Employee</th><th>Type</th><th>Dates</th><th class="hrl-num">Days</th><th></th></tr></thead>
20
20
  <tbody>
21
21
  <% @requests.each do |request| %>
22
22
  <tr>
@@ -9,7 +9,7 @@
9
9
  <section class="hrl-card">
10
10
  <div class="hrl-table-wrap">
11
11
  <table class="hrl-table hrl-table--stack">
12
- <thead><tr><th>Type</th><th>Quota</th><th>Accrual</th><th>Carry cap</th><th>Paid</th><th></th></tr></thead>
12
+ <thead><tr><th>Type</th><th class="hrl-num">Quota</th><th>Accrual</th><th class="hrl-num">Carry cap</th><th>Paid</th><th></th></tr></thead>
13
13
  <tbody>
14
14
  <% @leave_types.each do |type| %>
15
15
  <tr>
@@ -22,7 +22,7 @@
22
22
  <% else %>
23
23
  <div class="hrl-table-wrap">
24
24
  <table class="hrl-table hrl-table--stack">
25
- <thead><tr><th>Person</th><th>Principal</th><th>Instalment</th><th>Outstanding</th><th></th></tr></thead>
25
+ <thead><tr><th>Person</th><th class="hrl-num">Principal</th><th class="hrl-num">Instalment</th><th class="hrl-num">Outstanding</th><th></th></tr></thead>
26
26
  <tbody>
27
27
  <% @loans.each do |loan| %>
28
28
  <tr>
@@ -10,7 +10,7 @@
10
10
  <% if @office_locations.any? %>
11
11
  <div class="hrl-table-wrap">
12
12
  <table class="hrl-table hrl-table--stack">
13
- <thead><tr><th>Name</th><th>Coordinates</th><th>Radius</th><th>Active</th><th></th></tr></thead>
13
+ <thead><tr><th>Name</th><th>Coordinates</th><th class="hrl-num">Radius</th><th>Active</th><th></th></tr></thead>
14
14
  <tbody>
15
15
  <% @office_locations.each do |office| %>
16
16
  <tr>
@@ -10,7 +10,7 @@
10
10
  <% if @runs.any? %>
11
11
  <div class="hrl-table-wrap">
12
12
  <table class="hrl-table hrl-table--stack">
13
- <thead><tr><th>Period</th><th>Status</th><th>Slips</th><th>Net payout</th><th></th></tr></thead>
13
+ <thead><tr><th>Period</th><th>Status</th><th class="hrl-num">Slips</th><th class="hrl-num">Net payout</th><th></th></tr></thead>
14
14
  <tbody>
15
15
  <% @runs.each do |run| %>
16
16
  <tr>
@@ -69,7 +69,7 @@
69
69
  <% if @slips.any? %>
70
70
  <div class="hrl-table-wrap">
71
71
  <table class="hrl-table hrl-table--stack">
72
- <thead><tr><th>Employee</th><th>Paid days</th><th><abbr title="Loss of pay: unpaid days">LOP</abbr></th><th>Gross</th><th>Deductions</th><th>Net</th><th></th></tr></thead>
72
+ <thead><tr><th>Employee</th><th class="hrl-num">Paid days</th><th class="hrl-num"><abbr title="Loss of pay: unpaid days">LOP</abbr></th><th class="hrl-num">Gross</th><th class="hrl-num">Deductions</th><th class="hrl-num">Net</th><th></th></tr></thead>
73
73
  <tbody>
74
74
  <% @slips.each do |slip| %>
75
75
  <tr>
@@ -82,7 +82,7 @@
82
82
  <td data-label="Gross" class="hrl-num"><%= hrl_money(slip.gross_earnings) %></td>
83
83
  <td data-label="Deductions" class="hrl-num"><%= hrl_money(slip.total_deductions) %></td>
84
84
  <td data-label="Net" class="hrl-num"><strong><%= hrl_money(slip.net_pay) %></strong></td>
85
- <td data-label=""><a class="hrl-btn" href="<%= hr_lite.admin_salary_slip_path(slip) %>">Detail</a></td>
85
+ <td data-label=""><a class="hrl-btn" href="<%= hr_lite.admin_salary_slip_path(slip) %>">Detail</a><% if hr_can?("attendance.view", scope: :all) %><a class="hrl-btn" href="<%= hr_lite.admin_attendance_path(slip.user_id, month: @run.period_month.strftime("%Y-%m")) %>">Attendance</a><% end %></td>
86
86
  </tr>
87
87
  <% end %>
88
88
  </tbody>
@@ -35,9 +35,25 @@
35
35
  <%= f.label :tds_override, "Monthly TDS override" %>
36
36
  <%= f.number_field :tds_override, step: 1, value: @slip.tds_override %>
37
37
  </div>
38
+ <fieldset class="hrl-field">
39
+ <legend>Deduct this month</legend>
40
+ <p class="hrl-small hrl-muted">Untick one to leave it off this slip. PF, ESI, professional tax and TDS stay owed by law; check with your CA.</p>
41
+ <%= hidden_field_tag "salary_slip[deduct][]", "" %>
42
+ <% HrLite::SalarySlip::SKIPPABLE.each do |code, label| %>
43
+ <div class="hrl-field hrl-field--check">
44
+ <%= check_box_tag "salary_slip[deduct][]", code, @slip.skipped_deductions.split.exclude?(code), id: "deduct_#{code}" %>
45
+ <%= label_tag "deduct_#{code}", label %>
46
+ </div>
47
+ <% end %>
48
+ </fieldset>
38
49
  <div class="hrl-form-actions">
39
50
  <%= f.submit "Recompute with overrides", class: "hrl-btn hrl-btn--primary" %>
40
51
  </div>
52
+ <%# Its own row: two long labels do not fit side by side on a phone. %>
53
+ <div class="hrl-form-actions">
54
+ <%= button_tag "Pay full salary", name: "pay_full", value: "1", class: "hrl-btn",
55
+ data: { turbo_confirm: "Take no deductions from this slip this month?" } %>
56
+ </div>
41
57
  <% end %>
42
58
  </section>
43
59
  <% end %>
@@ -14,7 +14,7 @@
14
14
  </p>
15
15
  <div class="hrl-table-wrap">
16
16
  <table class="hrl-table hrl-table--stack">
17
- <thead><tr><th>Year</th><th>PF ceiling</th><th>ESI ceiling</th><th>Verified</th><th></th></tr></thead>
17
+ <thead><tr><th>Year</th><th class="hrl-num">PF ceiling</th><th class="hrl-num">ESI ceiling</th><th>Verified</th><th></th></tr></thead>
18
18
  <tbody>
19
19
  <% live = HrLite::StatutoryRateCardRecord.effective_for(Date.current.beginning_of_month) %>
20
20
  <% @cards.each do |card| %>
@@ -17,7 +17,7 @@
17
17
  <% else %>
18
18
  <div class="hrl-table-wrap">
19
19
  <table class="hrl-table hrl-table--stack">
20
- <thead><tr><th>Person</th><th>Year</th><th>Regime</th><th>Claimed</th><th></th></tr></thead>
20
+ <thead><tr><th>Person</th><th>Year</th><th>Regime</th><th class="hrl-num">Claimed</th><th></th></tr></thead>
21
21
  <tbody>
22
22
  <% @declarations.each do |declaration| %>
23
23
  <tr>
@@ -8,7 +8,7 @@
8
8
  <section class="hrl-card">
9
9
  <div class="hrl-table-wrap">
10
10
  <table class="hrl-table hrl-table--stack">
11
- <thead><tr><th>Person</th><th>Regime</th><th>Tax for the year</th><th>Deducted so far</th><th>TDS a month</th><th>Declaration</th></tr></thead>
11
+ <thead><tr><th>Person</th><th>Regime</th><th class="hrl-num">Tax for the year</th><th class="hrl-num">Deducted so far</th><th class="hrl-num">TDS a month</th><th>Declaration</th></tr></thead>
12
12
  <tbody>
13
13
  <% @profiles.each do |profile| %>
14
14
  <% declaration = @declarations[profile.user_id] %>
@@ -0,0 +1,17 @@
1
+ <% company = HrLite.config.company.call %>
2
+ <% name = company[:brand].presence || company[:name] %>
3
+ <div style="border:3px double #111; padding:140px 40px; text-align:center; color:#111;">
4
+ <% if company[:logo_url].present? %>
5
+ <img src="<%= company[:logo_url] %>" alt="<%= name %>" style="height:64px;">
6
+ <% end %>
7
+ <div style="font-size:13px; letter-spacing:4px; color:#666; margin-top:100px;">CERTIFICATE OF RECOGNITION</div>
8
+ <div style="font-size:42px; font-weight:700; margin-top:28px;">Employee of the <%= @award.kind.capitalize %></div>
9
+ <div style="font-size:20px; margin-top:10px;"><%= @award.period_label %></div>
10
+ <div style="font-size:15px; color:#666; margin-top:120px;">Presented to</div>
11
+ <div style="font-size:36px; margin-top:14px; padding-bottom:14px; border-bottom:1px solid #111; display:inline-block;"><%= HrLite.display_name(@award.user) %></div>
12
+ <div style="font-size:15px; line-height:1.6; margin-top:28px;">in recognition of outstanding work and dedication.</div>
13
+ <div style="font-size:12px; color:#666; margin-top:190px;">
14
+ Issued by <%= company[:name].presence || name %> on <%= @award.created_at.to_date.strftime("%d %B %Y") %>
15
+ <% if (contact = company.values_at(:phone, :email, :website).compact_blank).any? %><br><%= contact.join(" · ") %><% end %>
16
+ </div>
17
+ </div>
@@ -0,0 +1,12 @@
1
+ <% title = "#{HrLite.display_name(@award.user)} — #{@award.title}, #{@award.period_label}" %>
2
+ <% content_for(:page_title) { title } %>
3
+ <% content_for(:head) do %>
4
+ <meta property="og:title" content="<%= title %>">
5
+ <meta property="og:description" content="Certificate of recognition from <%= HrLite.config.company.call[:name] %>.">
6
+ <% if (logo = HrLite.config.company.call[:email_logo_url]).present? %><meta property="og:image" content="<%= logo %>"><% end %>
7
+ <% end %>
8
+ <div class="hrl-page__head">
9
+ <h1 class="hrl-page__title"><%= @award.title %> — <%= @award.period_label %></h1>
10
+ <p class="hrl-page__sub">Awarded to <strong><%= HrLite.display_name(@award.user) %></strong> in recognition of outstanding work and dedication.</p>
11
+ </div>
12
+ <a class="hrl-btn hrl-btn--primary" href="<%= hr_lite.shared_award_path(params[:token], format: :pdf) %>">Open certificate</a>
@@ -0,0 +1,24 @@
1
+ <% content_for(:page_title) { "Certificate" } %>
2
+ <% share_url = HrLite.public_url("/awards/shared/#{@award.signed_id(purpose: :certificate)}") %>
3
+ <div class="hrl-page__head">
4
+ <h1 class="hrl-page__title"><%= @award.title %> — <%= @award.period_label %></h1>
5
+ <p class="hrl-page__sub">Awarded to <strong><%= hr_display_name(@award.user) %></strong>.</p>
6
+ </div>
7
+ <section class="hrl-card">
8
+ <div class="hrl-row">
9
+ <a class="hrl-btn hrl-btn--primary" href="<%= hr_lite.award_path(@award, format: :pdf) %>" target="_blank" rel="noopener">Open certificate</a>
10
+ <% if @award.user_id == hr_current_user.id %>
11
+ <% if share_url %>
12
+ <a class="hrl-btn" href="https://www.linkedin.com/sharing/share-offsite/?url=<%= CGI.escape(share_url) %>" target="_blank" rel="noopener">Share on LinkedIn</a>
13
+ <% end %>
14
+ <% unless @print_requested %>
15
+ <%= button_to "Request printed copy", hr_lite.hr_requests_path, class: "hrl-btn",
16
+ params: { hr_request: { category: "award_certificate", subject: @award.print_subject,
17
+ body: HrLite.public_url("/awards/#{@award.id}.pdf") } } %>
18
+ <% end %>
19
+ <% end %>
20
+ </div>
21
+ <% if @print_requested %>
22
+ <p class="hrl-small hrl-muted">Printed copy requested on <%= @print_requested.to_date.strftime("%d %b %Y") %>.</p>
23
+ <% end %>
24
+ </section>
@@ -1,5 +1,5 @@
1
1
  <h1><%= @heading %></h1>
2
- <% if @body.present? %><p><%= @body %></p><% end %>
2
+ <%= simple_format(@body) if @body.present? %>
3
3
  <% if @lines.any? %>
4
4
  <ul class="lines">
5
5
  <% @lines.each do |line| %><li><%= line %></li><% end %>
@@ -13,7 +13,9 @@
13
13
  <td><%= attr.to_s.humanize %></td>
14
14
  <td>
15
15
  <% if change.is_a?(Array) %>
16
- <%= change[0].inspect %> &rarr; <%= change[1].inspect %>
16
+ <%# Text as written, with its line breaks — .inspect printed the quotes and a literal \r\n. %>
17
+ <% shown = change.map { |v| v.is_a?(String) ? safe_join(v.split(/\r?\n/), tag.br) : v.inspect } %>
18
+ <%= shown[0] %> &rarr; <%= shown[1] %>
17
19
  <% else %>
18
20
  <%= change %>
19
21
  <% end %>
@@ -8,7 +8,7 @@
8
8
  <% if @diff.present? %>
9
9
  Changes:
10
10
  <% @diff.each do |attr, change| %>
11
- - <%= attr.to_s.humanize %>: <%= change.is_a?(Array) ? "#{change[0].inspect} -> #{change[1].inspect}" : change %>
11
+ - <%= attr.to_s.humanize %>: <%= change.is_a?(Array) ? change.map { |v| v.is_a?(String) ? v : v.inspect }.join(" -> ") : change %>
12
12
  <% end %>
13
13
  <% end %>
14
14
  <% if @cta_url %>
@@ -66,6 +66,7 @@
66
66
  <div class="hrl-row">
67
67
  <a class="hrl-card__link" href="<%= hr_lite.person_timeline_path(award.user_id) %>"><%= hr_display_name(award.user) %></a>
68
68
  <span class="hrl-badge"><%= award.title %> · <%= award.period_label %></span>
69
+ <a class="hrl-card__link" href="<%= hr_lite.award_path(award) %>">Certificate</a>
69
70
  </div>
70
71
  <div class="hrl-feed__meta"><%= award.citation %></div>
71
72
  </div>
@@ -31,7 +31,7 @@
31
31
  <table class="hrl-table">
32
32
  <tbody>
33
33
  <% slip.deductions_rows.each do |row| %>
34
- <tr><td><%= row["label"] %></td><td class="hrl-num"><%= hrl_money(row["amount"]) %></td></tr>
34
+ <tr><td><%= row["label"] %><% if row["note"] %><div class="hrl-small hrl-muted"><%= row["note"] %></div><% end %></td><td class="hrl-num"><%= hrl_money(row["amount"]) %></td></tr>
35
35
  <% end %>
36
36
  <tr><td><strong>Total deductions</strong></td><td class="hrl-num"><strong><%= hrl_money(slip.total_deductions) %></strong></td></tr>
37
37
  </tbody>
@@ -56,7 +56,7 @@
56
56
  <thead><tr><th>Deductions</th><th class="num">Amount</th></tr></thead>
57
57
  <tbody>
58
58
  <% @slip.deductions_rows.each do |row| %>
59
- <tr><td><%= row["label"] %></td><td class="num"><%= HrLite::Money.format(row["amount"]) %></td></tr>
59
+ <tr><td><%= row["label"] %><% if row["note"] %> (<%= row["note"] %>)<% end %></td><td class="num"><%= HrLite::Money.format(row["amount"]) %></td></tr>
60
60
  <% end %>
61
61
  <tr class="total"><td>Total deductions</td><td class="num"><%= HrLite::Money.format(@slip.total_deductions) %></td></tr>
62
62
  </tbody>
@@ -38,7 +38,7 @@
38
38
  <% if rows.any? %>
39
39
  <div class="hrl-table-wrap">
40
40
  <table class="hrl-table hrl-table--stack">
41
- <thead><tr><th>Name</th><% if @statuses %><th>Now</th><% end %><th>Status</th><th>Hours <%= @date == Date.current ? "today" : "that day" %></th><th>Hours this month</th></tr></thead>
41
+ <thead><tr><th>Name</th><% if @statuses %><th>Now</th><% end %><th>Status</th><th class="hrl-num">Hours <%= @date == Date.current ? "today" : "that day" %></th><th class="hrl-num">Hours this month</th></tr></thead>
42
42
  <tbody>
43
43
  <% rows.each do |row| %>
44
44
  <tr>
@@ -5,6 +5,7 @@
5
5
  <title><%= [ content_for(:page_title), company[:brand].presence || company[:name] ].compact.join(" · ") %></title>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
7
7
  <meta name="robots" content="noindex, nofollow">
8
+ <%= yield :head %>
8
9
  <%= csrf_meta_tags %>
9
10
  <%= csp_meta_tag %>
10
11
  <%= stylesheet_link_tag "hr_lite/hr_lite", media: "all" %>
data/config/routes.rb CHANGED
@@ -60,6 +60,8 @@ HrLite::Engine.routes.draw do
60
60
  get "calendar", to: "calendar#show"
61
61
  get "search", to: "search#show", as: :search
62
62
  resources :salary_slips, only: %i[index show]
63
+ get "awards/shared/:token", to: "awards#shared", as: :shared_award
64
+ resources :awards, only: :show
63
65
  resource :employee_profile, only: :show, path: "profile"
64
66
  patch "id_card/photo", to: "id_cards#photo", as: :id_card_photo
65
67
  get "id_card(/:user_id)", to: "id_cards#show", as: :id_card
@@ -0,0 +1,20 @@
1
+ class BackfillHrLiteEnforcedPermissionKeys < ActiveRecord::Migration[8.1]
2
+ # 0.70.0 starts checking five keys that the screens never asked for. Every
3
+ # role keeps the access it has today: it gets the new key wherever it holds
4
+ # the key that opened the screen before.
5
+ NEW_KEYS = {
6
+ "profile.manage" => %w[audit.view settings.manage resignation.manage],
7
+ "payroll.manage" => %w[audit.view_money],
8
+ "expense.approve" => %w[expense.reimburse]
9
+ }.freeze
10
+
11
+ def up
12
+ NEW_KEYS.each do |held, keys|
13
+ HrLite::RoleGrant.where(permission_key: held, scope: "all").pluck(:role_id).each do |role_id|
14
+ keys.each { |key| HrLite::RoleGrant.find_or_initialize_by(role_id: role_id, permission_key: key).update!(scope: "all") }
15
+ end
16
+ end
17
+ end
18
+
19
+ def down; end
20
+ end
@@ -0,0 +1,7 @@
1
+ class AddSkippedDeductionsToHrLiteSalarySlips < ActiveRecord::Migration[8.1]
2
+ # Deductions payroll chose not to take from this person this month, as
3
+ # space-separated SalarySlip::SKIPPABLE codes.
4
+ def change
5
+ add_column :hr_lite_salary_slips, :skipped_deductions, :string, null: false, default: ""
6
+ end
7
+ end
@@ -8,7 +8,7 @@ module HrLite
8
8
  :employees_scope, :mentionable_users, :notify, :render_pdf, :company,
9
9
  :time_zone, :currency_symbol, :on_designation_change,
10
10
  :leadership_emails, :extra_stylesheets, :superadmin_emails,
11
- :mailer_from, :public_url_base, :notification_matrix, :back_link,
11
+ :mailer_from, :public_url_base, :notification_matrix, :email_opt_out, :back_link,
12
12
  :onboard_user, :offboard_user, :invite_url_for,
13
13
  # ->(user) { { url:, unread: } } — shows a notifications link in
14
14
  # the HR shell; nil (default) shows nothing.
@@ -124,6 +124,7 @@ module HrLite
124
124
  @mailer_from = "hr@example.com"
125
125
  @public_url_base = nil # e.g. "https://hr.example.com" — enables email links + HrLite.public_url
126
126
  @notification_matrix = nil # resolved lazily to Notifications::DEFAULT_MATRIX
127
+ @email_opt_out = nil # ->(event, user) { true } = this user does not want this event by email
127
128
  @back_link = nil # optional {label:, url:} for the shell nav
128
129
  @native_app = ->(request) { request.user_agent.to_s.match?(/Hotwire Native|Turbo Native/) }
129
130
  @leave_year_start_month = 1 # 1 = calendar year; 7 = July–June leave year
@@ -35,6 +35,7 @@ module HrLite
35
35
  "pip.started" => { bell: true, email: true, leadership_email: false, leadership_bell: false },
36
36
  "pip.closed" => { bell: true, email: true, leadership_email: false, leadership_bell: false },
37
37
  "award.won" => { bell: true, email: true, leadership_email: false, leadership_bell: false },
38
+ "award.team_notice" => { bell: true, email: true, leadership_email: false, leadership_bell: false },
38
39
  "policy.changed" => { bell: false, email: false, leadership_email: true, leadership_bell: true },
39
40
  # An approval past its deadline. Leadership hears too — a decision
40
41
  # nobody is making is a process problem, not just one person's inbox.
@@ -138,7 +139,7 @@ module HrLite
138
139
  # One query for everyone's Busy/Meeting end, not one per recipient.
139
140
  held_until = HrLite.config.office_geofence ? WorkStatus.do_not_disturb_for(users.map(&:id)) : {}
140
141
  users.each do |user|
141
- next if user.email.blank?
142
+ next if user.email.blank? || HrLite.config.email_opt_out&.call(event.to_s, user)
142
143
 
143
144
  begin
144
145
  mail = EventMailer.event(to: user.email, subject: title, heading: title,
@@ -1,3 +1,3 @@
1
1
  module HrLite
2
- VERSION = "0.69.1"
2
+ VERSION = "0.74.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hr_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.69.1
4
+ version: 0.74.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kshitiz sinha
@@ -135,6 +135,7 @@ files:
135
135
  - app/controllers/hr_lite/appraisals_controller.rb
136
136
  - app/controllers/hr_lite/approvals_controller.rb
137
137
  - app/controllers/hr_lite/attendance_controller.rb
138
+ - app/controllers/hr_lite/awards_controller.rb
138
139
  - app/controllers/hr_lite/benefits_controller.rb
139
140
  - app/controllers/hr_lite/calendar_controller.rb
140
141
  - app/controllers/hr_lite/career_controller.rb
@@ -396,6 +397,9 @@ files:
396
397
  - app/views/hr_lite/attendance/_trail.html.erb
397
398
  - app/views/hr_lite/attendance/_work_mode.html.erb
398
399
  - app/views/hr_lite/attendance/show.html.erb
400
+ - app/views/hr_lite/awards/pdf.html.erb
401
+ - app/views/hr_lite/awards/shared.html.erb
402
+ - app/views/hr_lite/awards/show.html.erb
399
403
  - app/views/hr_lite/benefits/index.html.erb
400
404
  - app/views/hr_lite/calendar/show.html.erb
401
405
  - app/views/hr_lite/career/show.html.erb
@@ -548,6 +552,8 @@ files:
548
552
  - db/migrate/20261022090000_create_hr_lite_hiring_replies.rb
549
553
  - db/migrate/20261022090100_add_allow_sunday_to_hr_lite_hiring_campaigns.rb
550
554
  - db/migrate/20261022120000_add_purpose_to_hr_lite_hiring_templates.rb
555
+ - db/migrate/20261116090000_backfill_hr_lite_enforced_permission_keys.rb
556
+ - db/migrate/20261202090000_add_skipped_deductions_to_hr_lite_salary_slips.rb
551
557
  - lib/generators/hr_lite/install/install_generator.rb
552
558
  - lib/generators/hr_lite/install/templates/AFTER_INSTALL
553
559
  - lib/generators/hr_lite/install/templates/initializer.rb