feat: email provider, admin password reset, portal new-patient, chat pill

Chat: history pill now shows a History icon + a Start-new-chat (SquarePen)
button; removed the duplicate chat-history list from the sidebar.

Email: deployment-wide email provider config (Resend/Postmark/SendGrid/SMTP) in
Settings → Developers, with encrypted API key and a Send-test action. sendEmail
dispatches via the chosen provider (REST via fetch; SMTP via nodemailer).

Forgot password with no provider: alert the clinic admin(s) via a "System"
message card in Messages + a bell notification (seeded system user + per-clinic
System conversation); clicking deep-links to /settings?tab=careTeam&member=<id>.
Admins can set a member's password directly from the employee dialog
(PATCH /api/staff/:id/password via Better Auth's internal context — no admin
plugin needed).

Patient Portal: "New patient" booking path registers a demographics-only patient
then books; bookings reject double-booked slots (409).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalid Abdi
2026-06-20 19:52:55 +03:00
parent 516de6ad60
commit 90e6ec4cc0
29 changed files with 5200 additions and 142 deletions
@@ -1,5 +1,6 @@
"use client";
import { useSearchParams } from "next/navigation";
import { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -31,7 +32,11 @@ type Tab = (typeof TABS)[number]["id"];
export function SettingsView() {
const { t } = useTranslation();
const role = useActiveRole();
const [tab, setTab] = useState<Tab>("profile");
const searchParams = useSearchParams();
// Deep-link support: /settings?tab=careTeam&member=<userId>.
const urlTab = searchParams.get("tab") as Tab | null;
const urlMember = searchParams.get("member");
const [tab, setTab] = useState<Tab>(urlTab ?? "profile");
// Only clinic owners/admins manage clinic-wide settings (care team, records,
// signing, developers). Everyone else gets their personal tabs (profile, AI).
@@ -71,7 +76,9 @@ export function SettingsView() {
{activeTab === "ai" && <AIPanel />}
{activeTab === "records" && <RecordsPanel />}
{activeTab === "signing" && <SigningPanel />}
{activeTab === "careTeam" && <CareTeamPanel />}
{activeTab === "careTeam" && (
<CareTeamPanel initialMemberId={urlMember ?? undefined} />
)}
{activeTab === "integrations" && <IntegrationsPanel />}
{activeTab === "developers" && <DevelopersPanel />}
</div>