feat(hr): show attendance lateness to the owner only - #76
Merged
Conversation
b5092e3 removed the Late column and the Late Days tile outright, so the owner and HR lost them too. Put both back behind a `canSeeLate` role check (`owner` / `hr_manager`) instead, so the people who need the signal keep it and employees do not see their own lateness. Also closes a gap the removal left open: the Late badge on the Status cell still rendered "Late 15m" to everyone, one cell over from the column that had just been taken away. It now rides the same gate, as does the Late Days stat tile. All three late surfaces are gated together — hiding one alone leaks the same number from the others. Details: - The stat strip's column count follows the tile count (lg:grid-cols-5 -> lg:grid-cols-4) so the grid does not leave a hole; the skeleton count matches so the strip does not reflow on load. - 1c0ae90's `w-[40%]` on Status exists only to absorb the space the Late column would occupy, so it now applies only when that column is absent. - Restores the `Clock` and `formatMinutes` imports, and puts the `Tooltip` imports back to use — they were left unused by the removal and were raising three no-unused-vars warnings. Deliberately a role check rather than the `attendance.view_all` permission: that permission is also held by org_manager and finance_manager, who must not see it. Trade-off — a custom org role will not match; a dedicated `attendance.view_late` permission is the configurable version if wanted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Drops hr_manager from `canSeeLate`, so the Late column, the Late badge on the Status cell and the Late Days stat tile are now visible to the owner and to no one else. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on
qa_fe_ui(1c0ae90f). Targetsqa_fe_uiso the rest of that branch's work merges todeveloptogether, on your schedule.Why
b5092e30removed the Late column and the Late Days tile outright — for everyone, including the roles that actually need the signal. This puts both back behind a role check instead, so the owner keeps them and nobody else sees lateness.What changed
qa_fe_uiLate 15m)That third row is the gap worth flagging: the badge renders one cell to the left of the column that was removed, so employees could still read their lateness off the Status cell. All three surfaces now ride one flag —
canSeeLate = user.role === 'owner'— because hiding any one alone leaks the same number from the others.Layout follow-ups
lg:grid-cols-5→lg:grid-cols-4) so the grid doesn't leave a hole, and the skeleton count matches so it doesn't reflow on load.1c0ae90f'sw-[40%]on Status exists only to absorb the space the Late column would occupy, so it now applies only when that column is absent. The owner gets the original balanced table back.ClockandformatMinutesimports, and puts theTooltipimports back to use — the removal left them imported but unused, raising threeno-unused-varswarnings.One decision worth a look
Deliberately a role check, not the
attendance.view_allpermission — that permission is held byorg_manager,hr_managerandfinance_manageralike, none of whom should see this. Trade-off: the gate is hardcoded to theownerrole name. If it should be configurable per org, the clean version is a newattendance.view_latepermission granted to owner only inPermissionSeeder.Not touched
/hr/attendance/team,/hr/attendance/report, and the check-in CSV export (Late (min)column) all carry their own Late columns. Those are manager-facing, butorg_managerandhr_managercan reach them — say the word if they're in scope.Verification
tsc --noEmit— no errors in the changed file (the only tree-wide errors are pre-existing@tiptap/*module-resolution failures inrich-text-editor.tsx, from a stale linkednode_modules).eslinton the changed file — 2 problems, down from 5 on theqa_fe_uibaseline (the 3 unusedTooltipwarnings are cleared; thezodResolver as anycast and the react-hook-formwatch()compiler warning are pre-existing).Supersedes #75, which targeted
developand predated this branch.🤖 Generated with Claude Code