feat: staff work schedule — weekly grid for all roles, shift assignment, day off marking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-26 01:18:02 +03:00
parent 17012ae3ca
commit 5d5efecd9e
7 changed files with 587 additions and 1 deletions

View File

@@ -274,6 +274,19 @@ export const api = {
req<void>('DELETE', `/api/hotels/${slug}/users/${id}`),
},
// ── Schedule ──────────────────────────────────────────────────────────────
schedule: {
list: (slug: string, from: string, to: string) =>
req<ScheduleEntry[]>('GET', `/api/hotels/${slug}/schedule?from=${from}&to=${to}`),
upsert: (slug: string, data: {
user_id: string; date: string; shift_start?: string; shift_end?: string;
is_day_off?: boolean; notes?: string
}) =>
req<ScheduleEntry>('PUT', `/api/hotels/${slug}/schedule`, data),
remove: (slug: string, userId: string, date: string) =>
req<void>('DELETE', `/api/hotels/${slug}/schedule/${userId}/${date}`),
},
// ── Hotels ────────────────────────────────────────────────────────────────
hotels: {
get: (slug: string) =>
@@ -487,6 +500,21 @@ export const api = {
},
}
// ── Schedule ─────────────────────────────────────────────────────────────────
export interface ScheduleEntry {
id: string
userId: string
date: string
shiftStart: string | null
shiftEnd: string | null
isDayOff: boolean
notes: string | null
userName: string
userRole: string
userPosition: string | null
}
// ── Payload types & converters ───────────────────────────────────────────────
export interface RoomPayload {