import React from 'react'; import { Appointment, AppointmentParticipant } from 'fhir/r4'; import { Check } from 'lucide-react'; import { FhirCodeableConceptDisplay } from '../../utils/fhirCodeableConcept.tsx'; import { FhirCodeDisplay } from '../../utils/fhirCode.tsx'; import { renderField } from '../../utils/renderField.tsx'; import { FhirReferenceDisplay } from '../../utils/fhirReference.tsx'; import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/dialog'; import { Card, CardContent } from '../ui/card'; import { FieldHistoryProvider, FieldHistoryScope } from '../FieldHistory/FieldHistoryProvider'; import { ShowFieldHistoryToggle } from '../FieldHistory/ShowFieldHistoryToggle'; import { RecordEditedMarker } from '../FieldHistory/RecordEditedMarker'; import { FieldGroup, Section } from '../FieldHistory/FieldLayout'; interface FhirAppointmentDisplayProps { appointment: Appointment; isOpen: boolean; onClose: () => void; title?: string; } export const FhirAppointmentDisplay: React.FC = ({ appointment, isOpen, onClose, title = 'Appointment Details' }) => { const startTime = new Date(new Date(appointment.start).getTime() - new Date(appointment.start).getTimezoneOffset() * 60000).toISOString().slice(0, 16); const endTime = new Date(new Date(appointment.end).getTime() - new Date(appointment.end).getTimezoneOffset() * 60000).toISOString().slice(0, 16); if (!isOpen) return null; return ( { if (!next) onClose(); }}>
{title}
{renderField('Start', startTime, 'start')} {renderField('End', endTime, 'end')} {renderField('Appointment Status', , 'status')} {renderField('Appointment Type', , 'appointmentType.coding[0].display')} {renderField('Description', appointment.description ? appointment.description : '-', 'description')} {renderField('Patient Instructions', appointment.patientInstruction ? appointment.patientInstruction : '-', 'patientInstruction')} {renderField('Comment', appointment.comment ? appointment.comment : '-', 'comment')}
{appointment && appointment.participant.map((participant: AppointmentParticipant, index: number) => (
{participant.actor?.display} -
))}
{renderField('Reason Code', )} {renderField('Reason Reference', )}
); };