Add Workforce rota integration to HK Planner

Pulls HK staff shifts from Workforce.com API into the staff rota section.
Rota rows (read-only, WF badge, times+hours per day) appear above manual rows;
manual name inputs get a datalist populated from WF staff. Sync triggered via
button with stale-week detection. Dept selection stored per-app in CategorySettings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-07 20:47:09 +00:00
parent 490a9a558b
commit b803b01ae1
8 changed files with 498 additions and 27 deletions

View file

@ -1,4 +1,4 @@
import type { BookingsData, StaffMember, GeneralTask, PickupData, TimeReqs } from './types'
import type { BookingsData, StaffMember, GeneralTask, PickupData, TimeReqs, WorkforceRota } from './types'
const BASE = '/hk-planner/api'
@ -9,6 +9,8 @@ export interface ConfigData {
general_tasks: GeneralTask[]
last_reviewed: string
tolerance_minutes: number
workforce_rota: WorkforceRota | null
workforce_departments: string[]
}
export interface CategoryConfig {
@ -94,3 +96,23 @@ export function putCategories(order: string[], excluded: string[]): Promise<{ ok
export function testNewbook(): Promise<{ ok: boolean; message?: string; error?: string }> {
return request('/newbook/test', { method: 'POST' })
}
export function getWorkforceDepartments(): Promise<{ id: string; name: string }[]> {
return request('/workforce/departments')
}
export function putWorkforceDepartments(dept_ids: string[]): Promise<{ ok: boolean }> {
return request('/config/workforce-departments', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ dept_ids }),
})
}
export function syncWorkforceRota(start: string, end: string): Promise<WorkforceRota> {
return request(`/workforce/sync?start=${start}&end=${end}`, { method: 'POST' })
}
export function getWorkforceStaff(): Promise<{ id: string; name: string }[]> {
return request('/workforce/staff')
}