feat(dashboard): show the user's work plan for today
Adds a "Můj plán na dnešek" card near the clock-in: for the logged-in user it shows today's work-plan entry — category (coloured dot + label), the project/site (the "where"), the note, and a "součást rozsahu …" badge only for genuinely multi-day ranges. A muted "Pro dnešek nemáte naplánováno." empty state when nothing is scheduled. Server: GET /api/admin/dashboard now returns today_plan, reusing plan.service resolveCell (override-beats-range precedence) for the current user + today's local (Prague) date, enriched with the category label + colour so the widget needs no extra query. Gated by attendance.record / attendance.manage (the plan permission); omitted otherwise. No migration. Verified in Chrome: renders today's entry (Práce · OBJ-2026-006 — koko) with the category colour. tsc -b --noEmit, npm run build, vitest 152/152. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,9 @@ import DashActivityFeed from "../components/dashboard/DashActivityFeed";
|
||||
import DashAttendanceToday from "../components/dashboard/DashAttendanceToday";
|
||||
import DashProfile from "../components/dashboard/DashProfile";
|
||||
import DashSessions from "../components/dashboard/DashSessions";
|
||||
import DashTodayPlan, {
|
||||
type TodayPlan,
|
||||
} from "../components/dashboard/DashTodayPlan";
|
||||
|
||||
const API_BASE = "/api/admin";
|
||||
|
||||
@@ -69,6 +72,7 @@ interface DashData {
|
||||
pending_orders?: number;
|
||||
unpaid_invoices?: number;
|
||||
pending_leave_requests?: number;
|
||||
today_plan?: TodayPlan | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
@@ -317,6 +321,13 @@ export default function Dashboard() {
|
||||
<DashKpiCards dashData={dashData ?? null} />
|
||||
)}
|
||||
|
||||
{/* My work plan for today — paired with the clock-in below */}
|
||||
{!dashLoading &&
|
||||
(hasPermission("attendance.record") ||
|
||||
hasPermission("attendance.manage")) && (
|
||||
<DashTodayPlan plan={dashData?.today_plan ?? null} />
|
||||
)}
|
||||
|
||||
{/* Quick actions */}
|
||||
{!dashLoading && (
|
||||
<DashQuickActions
|
||||
|
||||
Reference in New Issue
Block a user