improvement: time period dropdown added to appropriate dashboard charts.

This commit is contained in:
2026-07-19 00:37:59 +03:30
parent 538121d653
commit db515f9630
18 changed files with 557 additions and 95 deletions

View File

@@ -35,10 +35,21 @@ Use `useRouter` from `@/i18n/navigation` for chart clicks. KPI cards use `Link`/
## Charts (LAB examples)
- **Tasks by prosthesis** — `TodayBarChart` + `colorForCode` from prosthesis catalog; `canViewTasks`
- **Cases due this week** — `casesDueWeek` buckets (next 7 local days); active sent cases with due date + in-progress task; `canViewCases`; empty card still shown
- **Lab task activity** — stacked week chart; `canViewCases \|\| canViewTasks`
- **Cases due** — forward day buckets (next 7 / 30); active sent cases with due date + in-progress task; `canViewCases`; empty card still shown
- **Lab task activity** — stacked lookback day chart (7 / 30); `canViewCases \|\| canViewTasks`
Week day labels: `useTodayDayLabelFormatter` + `mapWeekChartBuckets`.
Week/month day labels: `useTodayDayLabelFormatter` + `mapWeekChartBuckets`.
## Chart period dropdowns
Seven time-window charts support a compact header `<select>` via `ChartCard` `headerAction` (no taller widgets). Periods persist in `localStorage` (`chart-periods.ts`) and are sent on `GET /today/summary`.
| Chart | Periods | Direction |
|-------|---------|-----------|
| Appointments (all / mine), lab task activity, cases due | week, month | lookback (cases due = **forward**) |
| Treatment mix, case partners, efficiency | week, month, year | lookback |
Do **not** put year on day-series charts. Backend: `daysForChartPeriod` + `buildLocalDayBuckets` in `today.service.ts`.
## Permissions (task KPIs)