hr_lite 0.68.1 → 0.69.1
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/app/controllers/hr_lite/admin/holidays_controller.rb +13 -3
- data/app/controllers/hr_lite/calendar_controller.rb +2 -0
- data/app/models/hr_lite/leave_request.rb +5 -3
- data/app/views/hr_lite/calendar/show.html.erb +22 -1
- data/lib/hr_lite/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1baf60c535e3b5cdc3eac6c3cea7b16ef017d9a5bc544035c5baa84091aa665
|
|
4
|
+
data.tar.gz: 9061aa56cb55d265c5e998379103d346f3b170cf86b13b57d9bd0aef391b78d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05cbcd508ef90ef56166997654d61fcd0bcdd093c5b6eed42d2d5343adaba94bf697a0e4b2520884516d0d6aeaee8ac2b6317a76b8a53b08921bf01ad06925da
|
|
7
|
+
data.tar.gz: f04403add05a6a730e96e18ca7b554049979fe52bb32d1ba7e49ca526bb34f09855b19336665d8806307708514c66ca538349aeb0bb75c3ab5948c0d86dfbcc9
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.69.1] - 2026-11-10
|
|
11
|
+
|
|
12
|
+
HR (and admins) can record leave on any working day. No migrations.
|
|
13
|
+
|
|
14
|
+
- **"Record leave" no longer refuses a checked-in day.** HR recording full-day leave for someone who checked in got "Attendance is marked in this period" and nothing was saved. It now saves and is approved as usual; the day shows and pays as leave, which already outranks a punch.
|
|
15
|
+
- **…nor caps it at penalty-held days.** Leave HR records is no longer limited to the balance left after penalty holds ("you can apply for at most N days"); anything past the balance is loss of pay, as before. Comp-off still needs its credit, because it has no loss of pay.
|
|
16
|
+
- Unchanged: an employee applying for themselves still meets both checks, and nobody can record leave on days that are all weekly offs or holidays, or over leave already recorded.
|
|
17
|
+
|
|
18
|
+
## [0.69.0] - 2026-11-09
|
|
19
|
+
|
|
20
|
+
HR and leadership make or remove a holiday from the company calendar. No migrations.
|
|
21
|
+
|
|
22
|
+
- **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.
|
|
23
|
+
- **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.
|
|
24
|
+
- **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."
|
|
25
|
+
|
|
10
26
|
## [0.68.1] - 2026-11-08
|
|
11
27
|
|
|
12
28
|
A late check-in no longer takes a second. 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
|
-
|
|
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|
|
|
@@ -392,10 +392,11 @@ module HrLite
|
|
|
392
392
|
end
|
|
393
393
|
|
|
394
394
|
# A full-day leave over a day that already has a check-in makes no
|
|
395
|
-
# sense; a half-day alongside a punch is legitimate (worked half)
|
|
395
|
+
# sense; a half-day alongside a punch is legitimate (worked half), and
|
|
396
|
+
# HR may record leave over a checked-in day (leave outranks the punch).
|
|
396
397
|
def no_punch_conflict
|
|
397
398
|
return unless start_date && end_date
|
|
398
|
-
return if half_day
|
|
399
|
+
return if half_day || recorded_by_hr?
|
|
399
400
|
|
|
400
401
|
punched = AttendanceRecord.where(user_id: user_id, date: start_date..end_date)
|
|
401
402
|
.where.not(check_in_at: nil)
|
|
@@ -418,7 +419,8 @@ module HrLite
|
|
|
418
419
|
# balance with days held for penalties. Any other excess becomes loss of pay at approval.
|
|
419
420
|
def sufficient_balance
|
|
420
421
|
return unless start_date && end_date && leave_type
|
|
421
|
-
|
|
422
|
+
# HR records any day; past the balance it is loss of pay. Comp-off has no loss of pay.
|
|
423
|
+
return if leave_type.unlimited? || errors.any? || (recorded_by_hr? && !leave_type.comp_off)
|
|
422
424
|
|
|
423
425
|
held = balance.penalty_days
|
|
424
426
|
return unless leave_type.comp_off || held.positive?
|
|
@@ -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 %>
|
data/lib/hr_lite/version.rb
CHANGED