fix: clinic creation gating, analysis line charts, username + task assignee, delete confirm

- Hide "Create clinic" (sidebar footer) for non-admins; only owner/admin can
  spin up additional clinics. Onboarding for brand-new users is unaffected.
- Analysis: drop the bar charts; show line charts (Sparkline) inside KPI cards
  that open a detail dialog with the full chart + per-point breakdown.
- Add Team Member: validate the username client-side (no spaces; letters,
  numbers, dots, underscores) with a clear warning + field hint.
- Tasks: New Task now has an Assignee selector (Myself / Other → department).
  Tasks are visible to the department they're assigned to (or the creator), and
  show who created them. Backend adds assignee_role + created_by_name with
  visibility filtering in listTasks; owners/admins see all.
- Care team: removing a member now asks for confirmation first (dialog) and
  surfaces success/failure + refreshes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalid Abdi
2026-06-08 19:52:12 +03:00
parent 8ab0552cf8
commit 4f8793c765
19 changed files with 2878 additions and 144 deletions
+5
View File
@@ -1,9 +1,14 @@
import { z } from "zod";
// Departments a task can be assigned to (member roles). Null = a personal task
// that belongs to its creator.
export const TASK_DEPARTMENTS = ["admin", "doctor", "reception"] as const;
// Payload accepted by POST /api/tasks (full create).
export const taskInputSchema = z.object({
title: z.string().trim().min(1, "A task subject is required.").max(200),
assignee: z.string().trim().max(200).default("Unassigned"),
assigneeRole: z.enum(TASK_DEPARTMENTS).nullish(),
due: z.string().trim().max(120).default("No due date"),
priority: z.enum(["high", "medium", "low"]).default("medium"),
patient: z.string().trim().max(200).nullish(),