Track preschool planning days, partner invites and real vacation forfeiture
Three strands of work that grew together across the same settings screen and
API client, so they land as one change.
Per-year preschool planning days ("studiedagar"): new table, repository
(SQLite + Postgres), service, router and migration 007, plus the hooks and
Settings UI to plan and record them per child and year. Allocation now
reserves the recorded figure for a year where one exists and only falls back
to the child-level estimate otherwise, marking that fallback as assumed.
Partner invitations: workspaces issue and list invitations, registration
accepts an invite token to join the inviter's workspace instead of creating a
personal one, and a /join/:token page plus the settings invite panel drive it.
Vacation forfeiture: tips and the dashboard now distinguish days a parent
genuinely loses from days that merely age, so the warning stops firing on
balances that were never at risk.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Vendored
+2
@@ -21,6 +21,8 @@ export function makeVacationYearBalance(
|
||||
left: 25,
|
||||
carriedOut: 5,
|
||||
expiring: 0,
|
||||
expiringAge: 0,
|
||||
expiringOverCap: 0,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+34
@@ -26,10 +26,13 @@ import type { usePlanSync } from '@/hooks/usePlanSync'
|
||||
import type { useVacationDays } from '@/hooks/useVacationDays'
|
||||
import type { useChildSettings } from '@/hooks/useChildSettings'
|
||||
import type { useCalendarDays } from '@/hooks/useCalendarDays'
|
||||
import type { usePreschoolPlanningDays } from '@/hooks/usePreschoolPlanningDays'
|
||||
import type { usePreschoolPlanningDaysList } from '@/hooks/usePreschoolPlanningDaysList'
|
||||
import type { useShowWeekNumbers } from '@/hooks/useCalendarPreferences'
|
||||
import { makeChild, makePersonalData, makeVacationDays, makeWorkspace, makeParentalLeaveFetch } from './mockData'
|
||||
import { makeWorkspaceOverview } from './analytics'
|
||||
import { makeCalendarWindow } from './calendar'
|
||||
import { makePreschoolPlanningDays } from './workspace'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Contexts
|
||||
@@ -166,6 +169,7 @@ export function makeDayOverridesResult(
|
||||
return {
|
||||
data: [],
|
||||
isLoading: false,
|
||||
isRefreshing: false,
|
||||
error: null,
|
||||
upsert: vi.fn(),
|
||||
remove: vi.fn(),
|
||||
@@ -232,6 +236,7 @@ export function makeVacationDaysResult(
|
||||
return {
|
||||
data: [makeVacationDays()],
|
||||
isLoading: false,
|
||||
isRefreshing: false,
|
||||
error: null,
|
||||
upsert: vi.fn(),
|
||||
...overrides,
|
||||
@@ -244,6 +249,7 @@ export function makeChildSettingsResult(
|
||||
return {
|
||||
data: makeChild(),
|
||||
isLoading: false,
|
||||
isRefreshing: false,
|
||||
error: null,
|
||||
update: vi.fn(),
|
||||
...overrides,
|
||||
@@ -256,12 +262,40 @@ export function makeCalendarDaysResult(
|
||||
return {
|
||||
data: makeCalendarWindow(),
|
||||
isLoading: false,
|
||||
isRefreshing: false,
|
||||
error: null,
|
||||
refetch: vi.fn(),
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makePreschoolPlanningDaysResult(
|
||||
overrides: Partial<ReturnType<typeof usePreschoolPlanningDays>> = {},
|
||||
): ReturnType<typeof usePreschoolPlanningDays> {
|
||||
return {
|
||||
data: makePreschoolPlanningDays(),
|
||||
isLoading: false,
|
||||
isRefreshing: false,
|
||||
error: null,
|
||||
setPlanned: vi.fn(),
|
||||
recordTaken: vi.fn(),
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makePreschoolPlanningDaysListResult(
|
||||
overrides: Partial<ReturnType<typeof usePreschoolPlanningDaysList>> = {},
|
||||
): ReturnType<typeof usePreschoolPlanningDaysList> {
|
||||
return {
|
||||
data: [makePreschoolPlanningDays()],
|
||||
isLoading: false,
|
||||
isRefreshing: false,
|
||||
error: null,
|
||||
refresh: vi.fn(),
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Local-storage-backed preference hook (a tuple, not an object)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Vendored
+28
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import type { addPartner } from '@/services/api'
|
||||
import type { Invitation, PreschoolPlanningDays } from '@/types'
|
||||
|
||||
/** Shared by `addPartner` and `updateParentSettings` — both return the same
|
||||
* `{ uuid, name, salary_type, employment_status }` wire shape. */
|
||||
@@ -23,3 +24,30 @@ export function makePartnerMemberResponse(
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makePreschoolPlanningDays(
|
||||
overrides: Partial<PreschoolPlanningDays> = {},
|
||||
): PreschoolPlanningDays {
|
||||
return {
|
||||
id: 'ppd-1',
|
||||
childId: 'child-1',
|
||||
year: 2025,
|
||||
plannedDays: 5,
|
||||
takenDays: null,
|
||||
isDefault: false,
|
||||
createdAt: '2025-01-01T00:00:00Z',
|
||||
updatedAt: '2025-01-01T00:00:00Z',
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
export function makeInvitation(overrides: Partial<Invitation> = {}): Invitation {
|
||||
return {
|
||||
id: 'inv-1',
|
||||
workspaceId: 'ws-1',
|
||||
status: 'pending',
|
||||
expiresAt: '2025-01-08T00:00:00Z',
|
||||
createdAt: '2025-01-01T00:00:00Z',
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user