Skip to content

feat(4/5): add SelectEmployees container for holiday pay policies (SDK-567)#1616

Merged
jeffredodd merged 5 commits intomainfrom
feat/select-employees-holiday
Apr 30, 2026
Merged

feat(4/5): add SelectEmployees container for holiday pay policies (SDK-567)#1616
jeffredodd merged 5 commits intomainfrom
feat/select-employees-holiday

Conversation

@jeffredodd
Copy link
Copy Markdown
Contributor

Summary

  • Adds SelectEmployeesHoliday container component for holiday pay policies
  • Fetches employees via useEmployeesListSuspense with pagination
  • Fetches holiday policy data (version field required by PUT endpoint) via useHolidayPayPoliciesGetSuspense
  • Supports standalone mode (calls useHolidayPayPoliciesAddEmployeesMutation directly) and wizard mode (emits TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE event)
  • Client-side search filtering across the current page of results

Test plan

  • npm run test -- --run src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday
  • Storybook: verify SelectEmployeesPresentation stories still render (holiday uses same presentation layer)
  • In sdk-app: navigate to UNSTABLE_TimeOff → AddEmployeesHoliday and verify employee list loads

Part of stacked PR series for SDK-567:

  • PR 1: feat/text-input-employee-table-search → main
  • PR 2: feat/select-employees-presentation → PR 1
  • PR 3: feat/select-employees-time-off → PR 2
  • PR 4 (this PR): feat/select-employees-holiday → PR 3
  • PR 5: feat/select-employees-flow-integration → PR 4

🤖 Generated with Claude Code

@jeffredodd jeffredodd changed the title feat: add SelectEmployees container for holiday pay policies (SDK-567) feat(4/5): add SelectEmployees container for holiday pay policies (SDK-567) 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-holiday branch from 55b3ce9 to 28d57da Compare April 27, 2026 20:24
@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-holiday branch from 28d57da to de815ad Compare April 27, 2026 20:37
@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-holiday branch from de815ad to d89a746 Compare April 27, 2026 21:52
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from 533317d to 73686e3 Compare April 27, 2026 21:55
@jeffredodd jeffredodd force-pushed the feat/select-employees-holiday branch from d89a746 to 270f050 Compare April 27, 2026 21:55
@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch from 73686e3 to c6b5911 Compare April 27, 2026 22:19
@jeffredodd jeffredodd force-pushed the feat/select-employees-holiday branch from 270f050 to ba3120e Compare April 27, 2026 22:19
@jeffredodd jeffredodd marked this pull request as ready for review April 27, 2026 23:06
Comment on lines +48 to +54
const filteredEmployees = useMemo(() => {
if (!searchValue) return employees
const lower = searchValue.toLowerCase()
return employees.filter(e =>
`${e.firstName ?? ''} ${e.lastName ?? ''}`.toLowerCase().includes(lower),
)
}, [employees, searchValue])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seeing some of these repeated across the PRs, there may be opportunities for shared utils?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — extracted a useSelectEmployeesData hook that consolidates the employee list fetching, mapping, filtering, pagination, selection state, and search handlers that were duplicated across both containers. Both SelectEmployeesHoliday and SelectEmployeesTimeOff now call into it.

Copy link
Copy Markdown
Member

@serikjensen serikjensen left a comment

Choose a reason for hiding this comment

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

Seems like there's some duplication here that we may be able to consolidate with a shared hook or utils. i trust you'll be able to resolve that

Comment on lines +81 to +101
const handleContinue = useCallback(async () => {
if (mode === 'wizard') {
onEvent(componentEvents.TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE, {
employeeUuids: [...selectedUuids],
})
return
}

await baseSubmitHandler({}, async () => {
await addEmployees({
request: {
companyUuid: companyId,
requestBody: {
version: policyData.holidayPayPolicy?.version ?? '',
employees: [...selectedUuids].map(uuid => ({ uuid })),
},
},
})
onEvent(componentEvents.TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE)
})
}, [mode, baseSubmitHandler, addEmployees, companyId, policyData, selectedUuids, onEvent])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually this feels extremely similar to the last one i looked at 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, same shape entirely. Refactored both containers to use useSelectEmployeesData — the shared hook now owns all the common logic and each container is left with only its policy-specific mutation and continue handler.

},
},
})
onEvent(componentEvents.TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same feedback here where we might consider passing the result of the add employees call

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — now captures the result and passes result.holidayPayPolicy to onEvent, matching the existing response.timeOffPolicy pattern in SelectEmployeesTimeOff.

@jeffredodd jeffredodd force-pushed the feat/select-employees-time-off branch 2 times, most recently from 4afa962 to c0c078a Compare April 30, 2026 15:50
Base automatically changed from feat/select-employees-time-off to main April 30, 2026 15:52
jeffredodd and others added 5 commits April 30, 2026 09:00
…arch

- Add min, max, maxLength passthrough props to Input and TextInput
- Add search input with inline clear button to EmployeeTable
- Add isFetching loading state and pagination support to EmployeeTable

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes the absolutely-positioned custom clear button and its SCSS.
The browser's built-in search cancel button is now used, which works
naturally with component adapter overrides since type is a standard
HTML attribute forwarded by any TextInput implementation.

Bridges native clear (fires onChange('')) to onSearchClear so
pagination resets in consumers remain intact.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches active employees and the holiday pay policy (for the required
version field), manages selection/search/pagination state, and calls
useHolidayPayPoliciesAddEmployeesMutation on Continue in standalone mode.
In wizard mode, emits TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE with selected
UUIDs.

No starting balance column (holiday policies don't support it) and no
reassignment warning (employees can be in both holiday and time-off
policies simultaneously).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…yees containers

- Extract useSelectEmployeesData hook consolidating employee list fetching,
  mapping, filtering, pagination, selection, and search state shared between
  SelectEmployeesHoliday and SelectEmployeesTimeOff
- Pass result.holidayPayPolicy to onEvent in SelectEmployeesHoliday standalone
  mode, matching the existing pattern in SelectEmployeesTimeOff
- Wrap SelectEmployeesTimeOff handleContinue in useCallback

Addresses code duplication and result-passing feedback from PR #1616 review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 30, 2026 16:12
@jeffredodd jeffredodd force-pushed the feat/select-employees-holiday branch from ba3120e to a0bd1ad Compare April 30, 2026 16:12
@jeffredodd jeffredodd merged commit 9a7486b into main Apr 30, 2026
21 checks passed
@jeffredodd jeffredodd deleted the feat/select-employees-holiday branch April 30, 2026 16:18
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 holiday-pay-policy “Select Employees” container and refactors shared employee-list selection/search/pagination logic into a reusable hook, along with tests and endpoint inventory/docs updates for the new holiday add-employees endpoint.

Changes:

  • Introduces SelectEmployeesHoliday container with standalone vs wizard mode behavior.
  • Extracts shared employees list + selection + search + pagination logic into useSelectEmployeesData and updates SelectEmployeesTimeOff to use it.
  • Adds SelectEmployeesHoliday unit tests and updates endpoint reference/inventory to include the holiday add endpoint.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.ts New shared hook for paginated employees fetch, selection state, and search filtering.
src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx Refactors Time Off container to use the shared hook and simplifies search/selection wiring.
src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.tsx New Holiday container that fetches holiday policy version and adds employees (or emits wizard event).
src/components/UNSTABLE_TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.test.tsx New tests covering holiday selection UI, standalone mutation behavior, and wizard event behavior.
docs/reference/endpoint-reference.md Adds the holiday add-employees PUT endpoint to the UNSTABLE_TimeOff endpoint tables.
docs/reference/endpoint-inventory.json Adds the holiday add-employees PUT endpoint to the endpoint inventory entries.

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

Comment on lines +45 to +49
const result = await addEmployees({
request: {
companyUuid: companyId,
requestBody: {
version: policyData.holidayPayPolicy?.version ?? '',
Comment on lines +40 to +41
// eslint-disable-next-line react-hooks/exhaustive-deps
[employeesData.httpMeta.response.headers, isFetching, currentPage, itemsPerPage],
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