Add Today action lists and clickable KPI links (Phase 3).
Show upcoming appointments for the rest of today and link each KPI card to its relevant dashboard tab. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,6 +27,16 @@ type TodayCharts = {
|
|||||||
tasksByWorkflowStep?: ChartBucket[];
|
tasksByWorkflowStep?: ChartBucket[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type TodayActions = {
|
||||||
|
upcomingAppointmentsToday?: Array<{
|
||||||
|
id: string;
|
||||||
|
patientName: string;
|
||||||
|
startAt: string;
|
||||||
|
endAt: string;
|
||||||
|
purpose: string;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
|
||||||
type TodayWidgets = {
|
type TodayWidgets = {
|
||||||
appointmentsToday?: { count: number };
|
appointmentsToday?: { count: number };
|
||||||
patientsToday?: { count: number };
|
patientsToday?: { count: number };
|
||||||
@@ -71,6 +81,7 @@ export class TodayService {
|
|||||||
|
|
||||||
const widgets: TodayWidgets = {};
|
const widgets: TodayWidgets = {};
|
||||||
const charts: TodayCharts = {};
|
const charts: TodayCharts = {};
|
||||||
|
const actions: TodayActions = {};
|
||||||
const tasks: Promise<void>[] = [];
|
const tasks: Promise<void>[] = [];
|
||||||
|
|
||||||
if (orgType === 'CLINIC') {
|
if (orgType === 'CLINIC') {
|
||||||
@@ -78,6 +89,9 @@ export class TodayService {
|
|||||||
tasks.push(
|
tasks.push(
|
||||||
this.loadAppointmentsToday(organizationId, from, to, widgets),
|
this.loadAppointmentsToday(organizationId, from, to, widgets),
|
||||||
);
|
);
|
||||||
|
tasks.push(
|
||||||
|
this.loadUpcomingAppointmentsToday(organizationId, from, to, actions),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -136,6 +150,7 @@ export class TodayService {
|
|||||||
range: { from: from.toISOString(), to: to.toISOString() },
|
range: { from: from.toISOString(), to: to.toISOString() },
|
||||||
widgets,
|
widgets,
|
||||||
charts,
|
charts,
|
||||||
|
actions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -247,6 +262,35 @@ export class TodayService {
|
|||||||
widgets.appointmentsToday = { count };
|
widgets.appointmentsToday = { count };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async loadUpcomingAppointmentsToday(
|
||||||
|
organizationId: string,
|
||||||
|
from: Date,
|
||||||
|
to: Date,
|
||||||
|
actions: TodayActions,
|
||||||
|
) {
|
||||||
|
const now = new Date();
|
||||||
|
const items = await this.prisma.appointment.findMany({
|
||||||
|
where: {
|
||||||
|
organizationId,
|
||||||
|
startAt: { lt: to },
|
||||||
|
endAt: { gt: now > from ? now : from },
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
patient: { select: { firstName: true, lastName: true } },
|
||||||
|
},
|
||||||
|
orderBy: { startAt: 'asc' },
|
||||||
|
take: 5,
|
||||||
|
});
|
||||||
|
|
||||||
|
actions.upcomingAppointmentsToday = items.map((appointment) => ({
|
||||||
|
id: appointment.id,
|
||||||
|
patientName: `${appointment.patient.firstName} ${appointment.patient.lastName}`.trim(),
|
||||||
|
startAt: appointment.startAt.toISOString(),
|
||||||
|
endAt: appointment.endAt.toISOString(),
|
||||||
|
purpose: appointment.purpose,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
private async loadPatientsToday(
|
private async loadPatientsToday(
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
from: Date,
|
from: Date,
|
||||||
|
|||||||
@@ -212,7 +212,11 @@
|
|||||||
"chartTreatmentMixSubtitle": "Last 7 days",
|
"chartTreatmentMixSubtitle": "Last 7 days",
|
||||||
"chartTasksByStepTitle": "Tasks by Workflow Step",
|
"chartTasksByStepTitle": "Tasks by Workflow Step",
|
||||||
"chartTasksByStepSubtitle": "In progress now",
|
"chartTasksByStepSubtitle": "In progress now",
|
||||||
"chartEmpty": "No data for this period yet."
|
"chartEmpty": "No data for this period yet.",
|
||||||
|
"upcomingAppointmentsTitle": "Upcoming Today",
|
||||||
|
"upcomingAppointmentsSubtitle": "Appointments not yet finished",
|
||||||
|
"viewAllAppointments": "View schedule",
|
||||||
|
"noUpcomingAppointments": "No upcoming appointments for the rest of today."
|
||||||
},
|
},
|
||||||
"staff": {
|
"staff": {
|
||||||
"redirecting": "Redirecting…",
|
"redirecting": "Redirecting…",
|
||||||
|
|||||||
@@ -212,7 +212,11 @@
|
|||||||
"chartTreatmentMixSubtitle": "۷ روز گذشته",
|
"chartTreatmentMixSubtitle": "۷ روز گذشته",
|
||||||
"chartTasksByStepTitle": "وظایف بر اساس مرحله گردش کار",
|
"chartTasksByStepTitle": "وظایف بر اساس مرحله گردش کار",
|
||||||
"chartTasksByStepSubtitle": "در حال انجام",
|
"chartTasksByStepSubtitle": "در حال انجام",
|
||||||
"chartEmpty": "هنوز دادهای برای این بازه وجود ندارد."
|
"chartEmpty": "هنوز دادهای برای این بازه وجود ندارد.",
|
||||||
|
"upcomingAppointmentsTitle": "نوبتهای پیش رو",
|
||||||
|
"upcomingAppointmentsSubtitle": "نوبتهای باقیمانده امروز",
|
||||||
|
"viewAllAppointments": "مشاهده برنامه",
|
||||||
|
"noUpcomingAppointments": "نوبت پیشرویی برای باقی امروز وجود ندارد."
|
||||||
},
|
},
|
||||||
"staff": {
|
"staff": {
|
||||||
"redirecting": "در حال انتقال...",
|
"redirecting": "در حال انتقال...",
|
||||||
|
|||||||
@@ -212,7 +212,11 @@
|
|||||||
"chartTreatmentMixSubtitle": "Afgelopen 7 dagen",
|
"chartTreatmentMixSubtitle": "Afgelopen 7 dagen",
|
||||||
"chartTasksByStepTitle": "Taken per workflowstap",
|
"chartTasksByStepTitle": "Taken per workflowstap",
|
||||||
"chartTasksByStepSubtitle": "Nu in uitvoering",
|
"chartTasksByStepSubtitle": "Nu in uitvoering",
|
||||||
"chartEmpty": "Nog geen gegevens voor deze periode."
|
"chartEmpty": "Nog geen gegevens voor deze periode.",
|
||||||
|
"upcomingAppointmentsTitle": "Komende afspraken vandaag",
|
||||||
|
"upcomingAppointmentsSubtitle": "Afspraken die nog niet zijn afgerond",
|
||||||
|
"viewAllAppointments": "Bekijk planning",
|
||||||
|
"noUpcomingAppointments": "Geen komende afspraken meer voor vandaag."
|
||||||
},
|
},
|
||||||
"staff": {
|
"staff": {
|
||||||
"redirecting": "Bezig met doorsturen...",
|
"redirecting": "Bezig met doorsturen...",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { Link } from '@/i18n/navigation';
|
|||||||
import { useAuth } from '@/lib/hooks/useAuth';
|
import { useAuth } from '@/lib/hooks/useAuth';
|
||||||
import { TodayKpiGrid } from '@/components/today/TodayKpiGrid';
|
import { TodayKpiGrid } from '@/components/today/TodayKpiGrid';
|
||||||
import { TodayChartsSection } from '@/components/today/TodayChartsSection';
|
import { TodayChartsSection } from '@/components/today/TodayChartsSection';
|
||||||
|
import { TodayUpcomingAppointments } from '@/components/today/TodayUpcomingAppointments';
|
||||||
import { useTodaySummary } from '@/lib/hooks/useTodaySummary';
|
import { useTodaySummary } from '@/lib/hooks/useTodaySummary';
|
||||||
import { formatApiErrorMessage } from '@/components/shared/formatApiError';
|
import { formatApiErrorMessage } from '@/components/shared/formatApiError';
|
||||||
|
|
||||||
@@ -41,6 +42,8 @@ export default function TodayPage() {
|
|||||||
|
|
||||||
<TodayKpiGrid widgets={data?.widgets ?? {}} loading={loading} />
|
<TodayKpiGrid widgets={data?.widgets ?? {}} loading={loading} />
|
||||||
|
|
||||||
|
<TodayUpcomingAppointments actions={data?.actions ?? {}} loading={loading} />
|
||||||
|
|
||||||
<TodayChartsSection charts={data?.charts ?? {}} loading={loading} />
|
<TodayChartsSection charts={data?.charts ?? {}} loading={loading} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { Link } from '@/i18n/navigation';
|
||||||
import { Card } from '@/components/ui/shared/Card';
|
import { Card } from '@/components/ui/shared/Card';
|
||||||
import type { KpiCardColor } from '@/components/today/widget-registry';
|
import type { KpiCardColor } from '@/components/today/widget-registry';
|
||||||
import type { LucideIcon } from 'lucide-react';
|
import type { LucideIcon } from 'lucide-react';
|
||||||
@@ -18,6 +19,7 @@ interface KpiCardProps {
|
|||||||
icon?: LucideIcon;
|
icon?: LucideIcon;
|
||||||
color?: KpiCardColor;
|
color?: KpiCardColor;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
|
href?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function KpiCard({
|
export function KpiCard({
|
||||||
@@ -27,9 +29,12 @@ export function KpiCard({
|
|||||||
icon: Icon,
|
icon: Icon,
|
||||||
color = 'default',
|
color = 'default',
|
||||||
loading = false,
|
loading = false,
|
||||||
|
href,
|
||||||
}: KpiCardProps) {
|
}: KpiCardProps) {
|
||||||
return (
|
const card = (
|
||||||
<Card className={colorClasses[color]}>
|
<Card
|
||||||
|
className={`${colorClasses[color]} ${href && !loading ? 'transition-opacity hover:opacity-90' : ''}`}
|
||||||
|
>
|
||||||
<div className="flex items-start justify-between gap-3">
|
<div className="flex items-start justify-between gap-3">
|
||||||
<p className="text-sm font-medium">{title}</p>
|
<p className="text-sm font-medium">{title}</p>
|
||||||
{Icon ? <Icon className="h-4 w-4 shrink-0 opacity-80" aria-hidden /> : null}
|
{Icon ? <Icon className="h-4 w-4 shrink-0 opacity-80" aria-hidden /> : null}
|
||||||
@@ -44,4 +49,14 @@ export function KpiCard({
|
|||||||
) : null}
|
) : null}
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (href && !loading) {
|
||||||
|
return (
|
||||||
|
<Link href={href} className="block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 rounded-[var(--radius-lg)]">
|
||||||
|
{card}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return card;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export function TodayKpiGrid({ widgets, loading = false }: TodayKpiGridProps) {
|
|||||||
icon={definition.icon}
|
icon={definition.icon}
|
||||||
color={definition.color}
|
color={definition.color}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
|
href={definition.href}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
98
frontend/src/components/today/TodayUpcomingAppointments.tsx
Normal file
98
frontend/src/components/today/TodayUpcomingAppointments.tsx
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useTranslations } from 'next-intl';
|
||||||
|
import { ChevronRight } from 'lucide-react';
|
||||||
|
import { Link } from '@/i18n/navigation';
|
||||||
|
import { Card } from '@/components/ui/shared/Card';
|
||||||
|
import { formatTimeForInput } from '@/components/appointments/appointmentTime';
|
||||||
|
import { canAccessAppointmentsSection } from '@/components/shared/permissions';
|
||||||
|
import { useAuth } from '@/lib/hooks/useAuth';
|
||||||
|
import type { TodaySummaryActions } from '@/types/today';
|
||||||
|
|
||||||
|
interface TodayUpcomingAppointmentsProps {
|
||||||
|
actions: TodaySummaryActions;
|
||||||
|
loading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TodayUpcomingAppointments({
|
||||||
|
actions,
|
||||||
|
loading = false,
|
||||||
|
}: TodayUpcomingAppointmentsProps) {
|
||||||
|
const t = useTranslations('today');
|
||||||
|
const { currentOrganization } = useAuth();
|
||||||
|
|
||||||
|
if (!canAccessAppointmentsSection(currentOrganization)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const appointments = actions.upcomingAppointmentsToday ?? [];
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<Card>
|
||||||
|
<h2 className="text-base font-semibold text-card-foreground">{t('upcomingAppointmentsTitle')}</h2>
|
||||||
|
<div className="mt-4 space-y-3">
|
||||||
|
{[0, 1, 2].map((key) => (
|
||||||
|
<div key={key} className="h-12 animate-pulse rounded bg-background-secondary/60" />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card>
|
||||||
|
<div className="flex items-center justify-between gap-3 mb-4">
|
||||||
|
<div>
|
||||||
|
<h2 className="text-base font-semibold text-card-foreground">
|
||||||
|
{t('upcomingAppointmentsTitle')}
|
||||||
|
</h2>
|
||||||
|
<p className="text-xs text-text-muted mt-1">{t('upcomingAppointmentsSubtitle')}</p>
|
||||||
|
</div>
|
||||||
|
<Link
|
||||||
|
href="/appointments"
|
||||||
|
className="text-xs font-medium text-primary hover:underline underline-offset-2 shrink-0"
|
||||||
|
>
|
||||||
|
{t('viewAllAppointments')}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{appointments.length === 0 ? (
|
||||||
|
<p className="text-sm text-text-muted">{t('noUpcomingAppointments')}</p>
|
||||||
|
) : (
|
||||||
|
<ul className="divide-y divide-border/40">
|
||||||
|
{appointments.map((appointment) => {
|
||||||
|
const start = new Date(appointment.startAt);
|
||||||
|
const end = new Date(appointment.endAt);
|
||||||
|
const timeLabel = `${formatTimeForInput(start)} – ${formatTimeForInput(end)}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li key={appointment.id}>
|
||||||
|
<Link
|
||||||
|
href="/appointments"
|
||||||
|
className="flex items-center justify-between gap-3 py-3 -mx-2 px-2 rounded-[var(--radius-md)] hover:bg-background-secondary/45 transition-colors group"
|
||||||
|
>
|
||||||
|
<div className="min-w-0">
|
||||||
|
<p className="text-sm font-medium text-text-primary truncate">
|
||||||
|
{appointment.patientName}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs text-text-muted mt-0.5">
|
||||||
|
{timeLabel}
|
||||||
|
{appointment.purpose ? (
|
||||||
|
<span className="text-text-secondary"> · {appointment.purpose}</span>
|
||||||
|
) : null}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<ChevronRight
|
||||||
|
className="h-4 w-4 shrink-0 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity"
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ export interface TodayKpiDefinition {
|
|||||||
icon: LucideIcon;
|
icon: LucideIcon;
|
||||||
color: KpiCardColor;
|
color: KpiCardColor;
|
||||||
orgTypes: OrgTypeName[];
|
orgTypes: OrgTypeName[];
|
||||||
|
href: string;
|
||||||
isVisible: (org: Organization | null) => boolean;
|
isVisible: (org: Organization | null) => boolean;
|
||||||
formatValue: (widgets: TodaySummaryWidgets) => string | null;
|
formatValue: (widgets: TodaySummaryWidgets) => string | null;
|
||||||
formatSubtitle?: (widgets: TodaySummaryWidgets) => string | null;
|
formatSubtitle?: (widgets: TodaySummaryWidgets) => string | null;
|
||||||
@@ -65,6 +66,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: CalendarDays,
|
icon: CalendarDays,
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
orgTypes: ['CLINIC'],
|
orgTypes: ['CLINIC'],
|
||||||
|
href: '/appointments',
|
||||||
isVisible: (org) => canAccessAppointmentsSection(org),
|
isVisible: (org) => canAccessAppointmentsSection(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'appointmentsToday');
|
const count = countWidget(widgets, 'appointmentsToday');
|
||||||
@@ -77,6 +79,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: Users,
|
icon: Users,
|
||||||
color: 'green',
|
color: 'green',
|
||||||
orgTypes: ['CLINIC'],
|
orgTypes: ['CLINIC'],
|
||||||
|
href: '/patients',
|
||||||
isVisible: (org) => canViewPatients(org) || canAccessAppointmentsSection(org),
|
isVisible: (org) => canViewPatients(org) || canAccessAppointmentsSection(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'patientsToday');
|
const count = countWidget(widgets, 'patientsToday');
|
||||||
@@ -89,6 +92,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: Stethoscope,
|
icon: Stethoscope,
|
||||||
color: 'purple',
|
color: 'purple',
|
||||||
orgTypes: ['CLINIC'],
|
orgTypes: ['CLINIC'],
|
||||||
|
href: '/treatment',
|
||||||
isVisible: (org) => canViewTreatment(org),
|
isVisible: (org) => canViewTreatment(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'treatmentsToday');
|
const count = countWidget(widgets, 'treatmentsToday');
|
||||||
@@ -101,6 +105,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: ClipboardList,
|
icon: ClipboardList,
|
||||||
color: 'yellow',
|
color: 'yellow',
|
||||||
orgTypes: ['CLINIC'],
|
orgTypes: ['CLINIC'],
|
||||||
|
href: '/treatment',
|
||||||
isVisible: (org) => canViewTreatment(org),
|
isVisible: (org) => canViewTreatment(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'draftTreatments');
|
const count = countWidget(widgets, 'draftTreatments');
|
||||||
@@ -113,6 +118,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: FlaskConical,
|
icon: FlaskConical,
|
||||||
color: 'red',
|
color: 'red',
|
||||||
orgTypes: ['CLINIC'],
|
orgTypes: ['CLINIC'],
|
||||||
|
href: '/treatment',
|
||||||
isVisible: (org) => canViewTreatment(org),
|
isVisible: (org) => canViewTreatment(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'labCasesPendingSend');
|
const count = countWidget(widgets, 'labCasesPendingSend');
|
||||||
@@ -125,6 +131,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: FlaskConical,
|
icon: FlaskConical,
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
orgTypes: ['LAB'],
|
orgTypes: ['LAB'],
|
||||||
|
href: '/cases',
|
||||||
isVisible: (org) => canViewCases(org),
|
isVisible: (org) => canViewCases(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'casesReceivedToday');
|
const count = countWidget(widgets, 'casesReceivedToday');
|
||||||
@@ -137,6 +144,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: ClipboardList,
|
icon: ClipboardList,
|
||||||
color: 'yellow',
|
color: 'yellow',
|
||||||
orgTypes: ['LAB'],
|
orgTypes: ['LAB'],
|
||||||
|
href: '/tasks',
|
||||||
isVisible: (org) => canViewTasks(org),
|
isVisible: (org) => canViewTasks(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'tasksInProgress');
|
const count = countWidget(widgets, 'tasksInProgress');
|
||||||
@@ -149,6 +157,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: AlertCircle,
|
icon: AlertCircle,
|
||||||
color: 'red',
|
color: 'red',
|
||||||
orgTypes: ['LAB'],
|
orgTypes: ['LAB'],
|
||||||
|
href: '/tasks',
|
||||||
isVisible: (org) => canViewTasks(org),
|
isVisible: (org) => canViewTasks(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'importantTasks');
|
const count = countWidget(widgets, 'importantTasks');
|
||||||
@@ -161,6 +170,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: Link2,
|
icon: Link2,
|
||||||
color: 'yellow',
|
color: 'yellow',
|
||||||
orgTypes: ['CLINIC', 'LAB'],
|
orgTypes: ['CLINIC', 'LAB'],
|
||||||
|
href: '/organizations',
|
||||||
isVisible: (org) => canManageOrganizations(org),
|
isVisible: (org) => canManageOrganizations(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'pendingConnections');
|
const count = countWidget(widgets, 'pendingConnections');
|
||||||
@@ -173,6 +183,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: UserCog,
|
icon: UserCog,
|
||||||
color: 'default',
|
color: 'default',
|
||||||
orgTypes: ['CLINIC', 'LAB'],
|
orgTypes: ['CLINIC', 'LAB'],
|
||||||
|
href: '/staff',
|
||||||
isVisible: (org) => canViewStaff(org),
|
isVisible: (org) => canViewStaff(org),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const seats = widgets.seats;
|
const seats = widgets.seats;
|
||||||
@@ -192,6 +203,7 @@ export const TODAY_KPI_DEFINITIONS: TodayKpiDefinition[] = [
|
|||||||
icon: UserCog,
|
icon: UserCog,
|
||||||
color: 'purple',
|
color: 'purple',
|
||||||
orgTypes: ['CLINIC', 'LAB'],
|
orgTypes: ['CLINIC', 'LAB'],
|
||||||
|
href: '/staff',
|
||||||
isVisible: (org) => canEditStaff(org) || Boolean(org?.isOwner),
|
isVisible: (org) => canEditStaff(org) || Boolean(org?.isOwner),
|
||||||
formatValue: (widgets) => {
|
formatValue: (widgets) => {
|
||||||
const count = countWidget(widgets, 'pendingStaffInvites');
|
const count = countWidget(widgets, 'pendingStaffInvites');
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
export type TodayUpcomingAppointment = {
|
||||||
|
id: string;
|
||||||
|
patientName: string;
|
||||||
|
startAt: string;
|
||||||
|
endAt: string;
|
||||||
|
purpose: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TodaySummaryActions = {
|
||||||
|
upcomingAppointmentsToday?: TodayUpcomingAppointment[];
|
||||||
|
};
|
||||||
|
|
||||||
export type TodayChartBucket = {
|
export type TodayChartBucket = {
|
||||||
code: string;
|
code: string;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -36,6 +48,7 @@ export interface TodaySummaryData {
|
|||||||
range: { from: string; to: string };
|
range: { from: string; to: string };
|
||||||
widgets: TodaySummaryWidgets;
|
widgets: TodaySummaryWidgets;
|
||||||
charts: TodaySummaryCharts;
|
charts: TodaySummaryCharts;
|
||||||
|
actions: TodaySummaryActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TodaySummaryResponse {
|
export interface TodaySummaryResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user