hr_lite 0.68.0 → 0.69.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8a38970f466f4686d482beb5a705d7356f109d89f118ddff1312165aff8cbef
4
- data.tar.gz: 4fe73cf6bf089bf42c37907293abbe99daa1978e5b5e4116534eef84ce4d6f2b
3
+ metadata.gz: b9a2bc4764966f26e83853a97a693eed3266043e414f52c1c178f2f4859c065c
4
+ data.tar.gz: cd97550dda828b9cc83670668768d8622f6b13d345df5309c6732e77386412b4
5
5
  SHA512:
6
- metadata.gz: 134f5836878e991ed42a8c17f082fed1e45fcff2f341c9cf8f0520bbf7c20a70df33c0c5bdf36832b0ee6cff4ea1f1ee3f65557ca64b993e444c458a575558c5
7
- data.tar.gz: 177168117aecabdd14dab7c8ccbed17c1f2364f68f8f84ccef5478dd5ca0c3b080c5195b75e934851401b5e0956368d01f5acadf64cda6e969be96b780743046
6
+ metadata.gz: 9d84016266084cf26e04553da027592ba4eb24c02c22178a51b9a49607694b1e68f534745b9da6e9d73b89988f7d0de90609bc3fed7b53fdd60fba3c94c1cb2f
7
+ data.tar.gz: cdb3157feb52cb1e71bd519319835fa5360b5cd8dc90546efee400d6c4d16459e0fbe7c1658a10d9ec67b619557c6c4f03fca80aa86611d04a26f2663d4b9586
data/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.69.0] - 2026-11-09
11
+
12
+ HR and leadership make or remove a holiday from the company calendar. No migrations.
13
+
14
+ - **Tap a day on the company calendar to make it a holiday for every office, or remove one.** People with `profile.manage` at `all` scope (HR, Leadership and Super Admin by default) get a link on each day of `/calendar`. It opens a panel under the grid: a Name field and "Make holiday" when the day has no all-office holiday, or "Remove holiday" (it asks first) when the day has one today or later. A past one shows its name only, because removing it would turn the day off into an absence for everyone who stayed home. Both buttons go through `Admin::HolidaysController#create` and `#destroy` with its existing permission, and come back to that calendar month. Holidays made here are all-office and not optional; office-only and optional ones stay on Admin → Holidays. Everyone else sees the calendar as before.
15
+ - **A new all-office holiday removes that day's attendance penalties.** When `#create` saves a non-optional holiday for every office, the active penalties whose attendance record falls on that date get `removed_at`, `removed_by` and the reason "Holiday declared: <name>", in one update and with no notification per row. No penalty row is deleted. Putting a penalty back when the holiday is removed again is not done.
16
+ - **Removing a holiday tells the same people that adding it does**, by bell and email: "Holiday removed: <name> on <date>. It is a working day."
17
+
18
+ ## [0.68.1] - 2026-11-08
19
+
20
+ A late check-in no longer takes a second. No migrations.
21
+
22
+ - **Leadership is not told each time the system adds an attendance penalty.** Every late check-in created 1 to 3 penalty rows, and each one emailed leadership and rang a bell for every leadership user (about 18 live notifications per penalty). That made a late check-in take up to 1.2 s. The audit log row is still written, and an HR removal still notifies leadership.
23
+
10
24
  ## [0.68.0] - 2026-11-07
11
25
 
12
26
  HR takes a day out of leave when the person came in. No migrations.
@@ -12,10 +12,14 @@ module HrLite
12
12
  def create
13
13
  @holiday = Holiday.new(holiday_params)
14
14
  if @holiday.save
15
+ if @holiday.office_location_id.nil? && !@holiday.optional # a day off for everyone: that day's penalties go
16
+ AttendancePenalty.active.where(attendance_record_id: AttendanceRecord.where(date: @holiday.date).select(:id))
17
+ .update_all(removed_at: Time.current, removed_by_id: hr_current_user.id, removal_reason: "Holiday declared: #{@holiday.name}")
18
+ end
15
19
  announce("Holiday added: #{@holiday.name} on #{@holiday.date.strftime('%a %d %b %Y')}", @holiday.office_location_id)
16
- redirect_to admin_holidays_path(year: @holiday.date.year), notice: "Holiday added."
20
+ redirect_to back_to(admin_holidays_path(year: @holiday.date.year), @holiday.date), notice: "Holiday added."
17
21
  else
18
- redirect_to admin_holidays_path, alert: @holiday.errors.full_messages.to_sentence
22
+ redirect_to back_to(admin_holidays_path, @holiday.date), alert: @holiday.errors.full_messages.to_sentence
19
23
  end
20
24
  end
21
25
 
@@ -31,7 +35,8 @@ module HrLite
31
35
  def destroy
32
36
  holiday = Holiday.find(params[:id])
33
37
  holiday.destroy!
34
- redirect_to admin_holidays_path(year: holiday.date.year),
38
+ announce("Holiday removed: #{holiday.name} on #{holiday.date.strftime('%a %d %b %Y')}. It is a working day.", holiday.office_location_id)
39
+ redirect_to back_to(admin_holidays_path(year: holiday.date.year), holiday.date),
35
40
  notice: "Holiday removed.", status: :see_other
36
41
  end
37
42
 
@@ -77,6 +82,11 @@ module HrLite
77
82
  Notifications.publish("holiday.published", title: title, path: "/holidays", bell_to: staff, email_to: staff)
78
83
  end
79
84
 
85
+ # A request sent from the company calendar goes back to that month of it.
86
+ def back_to(fallback, date)
87
+ params[:from] == "calendar" ? calendar_path(month: date&.strftime("%Y-%m")) : fallback
88
+ end
89
+
80
90
  def holiday_params
81
91
  params.require(:holiday).permit(:date, :name, :optional, :office_location_id)
82
92
  end
@@ -9,6 +9,8 @@ module HrLite
9
9
  office = WorkingCalendar.office_for(hr_current_user.id) # the viewer's office's holidays
10
10
  @calendar = WorkingCalendar.new(range, office_id: office)
11
11
  @holidays = Holiday.in_range(range).for_office(office).order(:date).group_by(&:date)
12
+ day = Date.strptime(params[:day].to_s, "%Y-%m-%d") rescue nil
13
+ @day = day if hr_leadership? && range.cover?(day) # the tapped day's add/remove panel
12
14
  @leaves = LeaveRequest.approved.includes(:leave_type, :user)
13
15
  .overlapping_range(range.first, range.last)
14
16
  .each_with_object(Hash.new { |h, k| h[k] = [] }) do |request, acc|
@@ -49,5 +49,11 @@ module HrLite
49
49
  end
50
50
  "#{why} So #{date.strftime('%a %-d %b')} needs #{minutes} min more before checkout."
51
51
  end
52
+
53
+ private
54
+
55
+ # The puncher creates these on every late check-in; telling leadership each time cost ~1 s per punch.
56
+ # The audit row stays, and an HR removal (update) still notifies.
57
+ def hr_lite_publish_policy_change(log) = (super unless log.action == "create")
52
58
  end
53
59
  end
@@ -25,7 +25,7 @@
25
25
  elsif @leaves[date].any? then [ "hrl-mgrid__day--leave", "#{@leaves[date].size} off" ]
26
26
  end %>
27
27
  <div class="<%= class_names("hrl-mgrid__day", cell_class, "hrl-mgrid__day--today": date == Date.current) %>">
28
- <span class="hrl-mgrid__num"><%= date.day %></span>
28
+ <span class="hrl-mgrid__num"><%= hr_leadership? ? link_to(date.day, hr_lite.calendar_path(month: @month.strftime("%Y-%m"), day: date.iso8601, anchor: "calendar-day"), aria: { label: date.strftime("%a %-d %b") }) : date.day %></span>
29
29
  <% if code %><span class="hrl-mgrid__tag"><%= code %></span><% end %>
30
30
  </div>
31
31
  <% end %>
@@ -50,3 +50,24 @@
50
50
  <p class="hrl-muted hrl-small hrl-mt">No holidays or leave this month.</p>
51
51
  <% end %>
52
52
  </section>
53
+
54
+ <%# HR and leadership: make the tapped day a holiday for every office, or undo one. A past one stays, or its day off turns into absences. %>
55
+ <% if @day %>
56
+ <% holiday = @holidays[@day]&.find { |h| h.office_location_id.nil? } %>
57
+ <section class="hrl-card" id="calendar-day">
58
+ <h2 class="hrl-card__title"><%= @day.strftime("%A %-d %B %Y") %></h2>
59
+ <% if holiday %>
60
+ <p><%= holiday.name %></p>
61
+ <% if !holiday.optional && @day >= Date.current %>
62
+ <%= button_to "Remove holiday", hr_lite.admin_holiday_path(holiday, from: "calendar"), method: :delete, class: "hrl-btn hrl-btn--danger",
63
+ form: { data: { turbo_confirm: "Remove #{holiday.name}? #{@day.strftime('%a %-d %b %Y')} becomes a working day and everyone is told." } } %>
64
+ <% end %>
65
+ <% else %>
66
+ <%= form_with scope: :holiday, url: hr_lite.admin_holidays_path(from: "calendar"), local: true do |f| %>
67
+ <%= f.hidden_field :date, value: @day.iso8601 %>
68
+ <div class="hrl-field"><%= f.label :name %><%= f.text_field :name, required: true %></div>
69
+ <div class="hrl-form-actions"><%= f.submit "Make holiday", class: "hrl-btn hrl-btn--primary" %></div>
70
+ <% end %>
71
+ <% end %>
72
+ </section>
73
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module HrLite
2
- VERSION = "0.68.0"
2
+ VERSION = "0.69.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.68.0
4
+ version: 0.69.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kshitiz sinha