feat(swift): implement agenda planning module (Epic 4 UI)
- Add AgendaBlock core component with list, create, cancel, reschedule modes - Implement AgendaListView with patient/type/location details and actions - Implement AgendaCreateForm with fuzzy patient search and validation - Implement AgendaCancelView with disambiguation support - Implement AgendaRescheduleForm with date/time picker - Integrate with server actions (create, cancel, reschedule) - Add radio-group UI component - Update documentation and status
This commit is contained in:
66
components/swift/artifacts/blocks/agenda-block.tsx
Normal file
66
components/swift/artifacts/blocks/agenda-block.tsx
Normal file
@@ -0,0 +1,66 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { Encounter, AppointmentTypeCode, LocationClassCode, CalendarEvent } from '@/app/epd/agenda/types';
|
||||
import { AgendaListView } from './agenda-list-view';
|
||||
import { AgendaCreateForm } from './agenda-create-form';
|
||||
import { AgendaCancelView } from './agenda-cancel-view';
|
||||
import { AgendaRescheduleForm } from './agenda-reschedule-form';
|
||||
|
||||
export interface AgendaBlockProps {
|
||||
mode: 'list' | 'create' | 'cancel' | 'reschedule';
|
||||
appointments?: CalendarEvent[];
|
||||
dateRange?: { start: Date; end: Date; label: string };
|
||||
prefillData?: {
|
||||
patient?: { id: string; name: string };
|
||||
datetime?: { date: Date; time: string };
|
||||
type?: AppointmentTypeCode;
|
||||
location?: LocationClassCode;
|
||||
notes?: string;
|
||||
};
|
||||
disambiguationOptions?: CalendarEvent[];
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
export function AgendaBlock({
|
||||
mode,
|
||||
appointments,
|
||||
dateRange,
|
||||
prefillData,
|
||||
disambiguationOptions,
|
||||
onClose,
|
||||
}: AgendaBlockProps) {
|
||||
const renderContent = () => {
|
||||
switch (mode) {
|
||||
case 'list':
|
||||
return (
|
||||
<AgendaListView
|
||||
appointments={appointments}
|
||||
dateRange={dateRange}
|
||||
onClose={onClose}
|
||||
onCancelAppointment={(evt) => console.log('Cancel requested', evt)}
|
||||
onViewDetails={(evt) => window.location.href = `/epd/agenda?focus=${evt.id}`}
|
||||
/>
|
||||
);
|
||||
case 'create':
|
||||
return <AgendaCreateForm prefillData={prefillData} onClose={onClose} />;
|
||||
case 'cancel':
|
||||
return (
|
||||
<AgendaCancelView
|
||||
disambiguationOptions={disambiguationOptions}
|
||||
prefillData={prefillData}
|
||||
onClose={onClose}
|
||||
/>
|
||||
);
|
||||
case 'reschedule':
|
||||
return <AgendaRescheduleForm prefillData={prefillData} onClose={onClose} />;
|
||||
default:
|
||||
return <div className="p-4 text-red-500">Unknown mode: {mode}</div>;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-full max-w-[600px] max-h-[80vh] overflow-y-auto bg-white border rounded shadow-sm">
|
||||
{renderContent()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user