Skip to content

feat(3/5): add SelectEmployees container for time-off/sick policies (SDK-565)#1614

Merged
jeffredodd merged 6 commits intomainfrom
feat/select-employees-time-off
Apr 30, 2026
Merged

feat(3/5): add SelectEmployees container for time-off/sick policies (SDK-565)#1614
jeffredodd merged 6 commits intomainfrom
feat/select-employees-time-off

Conversation

@jeffredodd
Copy link
Copy Markdown
Contributor

Summary

  • Add SelectEmployeesTimeOff container component for adding employees to time-off/sick policies
  • Fetches active employees via useEmployeesListSuspense, manages selection/search/pagination state
  • Standalone mode: calls useTimeOffPoliciesAddEmployeesMutation with selected UUIDs and optional per-employee starting balances
  • Wizard mode: emits TIME_OFF_ADD_EMPLOYEES_DONE with selected UUIDs (no API call)
  • Shows reassignment warning (employees can only be in one time-off policy)

Depends on: #1613

Test plan

  • npm run test -- --run src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff

🤖 Generated with Claude Code

@jeffredodd jeffredodd changed the title feat: add SelectEmployees container for time-off/sick policies (SDK-565) feat(3/5): add SelectEmployees container for time-off/sick policies (SDK-565) Apr 27, 2026
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from fcbf391 to 63e1327 Compare April 27, 2026 20:23
@jeffredodd jeffredodd force-pushed the feat/select-employees-presentation branch from 05586fe to 0b75d6d Compare April 27, 2026 20:32
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from 63e1327 to 1cc43ea Compare April 27, 2026 20:33
@jeffredodd jeffredodd force-pushed the feat/select-employees-presentation branch from 0b75d6d to 1bd2878 Compare April 27, 2026 21:52
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from 1cc43ea to 533317d Compare April 27, 2026 21:52
@jeffredodd jeffredodd force-pushed the feat/select-employees-presentation branch from 1bd2878 to 16ed8ed Compare April 27, 2026 21:55
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch 2 times, most recently from 73686e3 to c6b5911 Compare April 27, 2026 22:19
@jeffredodd jeffredodd marked this pull request as ready for review April 27, 2026 22:57
@jeffredodd jeffredodd force-pushed the feat/select-employees-presentation branch from 24dcbf6 to 0826592 Compare April 29, 2026 21:22
Base automatically changed from feat/select-employees-presentation to main April 29, 2026 21:36
Copilot AI review requested due to automatic review settings April 30, 2026 15:43
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from c6b5911 to 4afa962 Compare April 30, 2026 15:43
@jeffredodd jeffredodd enabled auto-merge (squash) April 30, 2026 15:44
jeffredodd and others added 4 commits April 30, 2026 08:47
Shared stateless UI consumed by both the time-off and holiday container
components. Renders the employee table with search, multi-select,
optional starting-balance column, reassignment warning, and Back/Continue
actions.

Storybook stories cover: default, partial/full selection, search filtered,
empty results, with/without reassignment warning, pagination.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches active employees, manages selection/search/pagination state, and
calls useTimeOffPoliciesAddEmployeesMutation on Continue in standalone
mode. In wizard mode, emits TIME_OFF_ADD_EMPLOYEES_DONE with selected
UUIDs instead of calling the API.

Supports optional per-employee starting balance (sent only when provided).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new time-off “Select Employees” container that fetches active employees, manages selection/search/pagination state, and either calls the “add employees” time-off policy mutation (standalone) or emits a completion event (wizard). Also updates endpoint inventory/reference docs to include the new add_employees endpoint.

Changes:

  • Introduces SelectEmployeesTimeOff container integrating employees list + selection/search/pagination and the add-employees mutation.
  • Adds unit tests covering rendering, search filtering, Back/Continue actions, and wizard vs standalone behavior.
  • Updates endpoint inventory/reference docs to include PUT /v1/time_off_policies/:timeOffPolicyUuid/add_employees for relevant TimeOff components.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx New container wiring employees list + selection/search/pagination + mutation/event behavior
src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.test.tsx Tests for the new container’s modes and basic UI behavior
docs/reference/endpoint-reference.md Adds the add_employees endpoint to the UNSTABLE_TimeOff component endpoint table
docs/reference/endpoint-inventory.json Adds add_employees endpoint entries and introduces PolicySettings inventory entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2 to +5
import { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'
import { useTimeOffPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees'
import { SelectEmployeesPresentation } from './SelectEmployeesPresentation'
import type { EmployeeItem } from './SelectEmployeesPresentationTypes'
Comment on lines +27 to +31
const { data: employeesData, isFetching } = useEmployeesListSuspense({
companyId,
terminated: false,
page: currentPage,
per: itemsPerPage,
Comment on lines +79 to +83
const handleContinue = async () => {
if (mode === 'wizard') {
onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, {
employeeUuids: [...selectedUuids],
})
Comment on lines +92 to +95
employees: [...selectedUuids].map(uuid => ({
uuid,
...(balances[uuid] !== undefined && { balance: balances[uuid] }),
})),
Comment on lines +152 to +156
await waitFor(() => {
expect(mockAddEmployees).toHaveBeenCalledWith({
request: {
timeOffPolicyUuid: 'policy-456',
requestBody: {
jeffredodd and others added 2 commits April 30, 2026 08:50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove useMemo around getPaginationProps (direct call, matches PayrollList pattern)
- Forward response.timeOffPolicy in TIME_OFF_ADD_EMPLOYEES_DONE payload
- Remove useCallback from handleContinue (memoization was a no-op; fixes stale balances closure)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from 4afa962 to c0c078a Compare April 30, 2026 15:50
@jeffredodd jeffredodd merged commit 0084c0b into main Apr 30, 2026
17 checks passed
@jeffredodd jeffredodd deleted the feat/select-employees-time-off branch April 30, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants