'use client'; import React from 'react'; import { format } from 'date-fns'; import { nl } from 'date-fns/locale'; import { Calendar, MapPin, Globe, Home, Clock, X, Info, ChevronRight, Ban } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { CalendarEvent, APPOINTMENT_TYPE_COLORS, APPOINTMENT_TYPES, LOCATION_CLASSES, LocationClassCode, AppointmentTypeCode } from '@/app/epd/agenda/types'; interface AgendaListViewProps { appointments?: CalendarEvent[]; dateRange?: { start: Date; end: Date; label: string }; onClose?: () => void; onCancelAppointment?: (encounter: CalendarEvent) => void; onViewDetails?: (encounter: CalendarEvent) => void; } export function AgendaListView({ appointments = [], dateRange, onClose, onCancelAppointment, onViewDetails }: AgendaListViewProps) { const formatDateLabel = () => { if (dateRange?.label) { if (dateRange.label === 'vandaag' || dateRange.label === 'morgen') { const dateStr = format(dateRange.start, 'd MMMM', { locale: nl }); return `Afspraken ${dateRange.label} - ${dateStr}`; } return `Afspraken ${dateRange.label}`; } // Fallback if no specific label if (appointments.length > 0) { return `Afspraken ${format(new Date(appointments[0].start), 'd MMMM', { locale: nl })}`; } return 'Afspraken'; }; const getLocationIcon = (classCode: string) => { switch (classCode as LocationClassCode) { case 'AMB': return ; case 'VR': return ; case 'HH': return ; default: return ; } }; return (
{/* Header */}

{formatDateLabel()}

{/* Body */}
{appointments.length === 0 ? (

Geen afspraken gevonden

Er staan geen afspraken gepland voor deze periode.

) : ( appointments.map((evt) => { const encounter = evt.extendedProps.encounter; const patient = evt.extendedProps.patient; const typeCode = encounter.type_code as AppointmentTypeCode; const typeColor = APPOINTMENT_TYPE_COLORS[typeCode] || APPOINTMENT_TYPE_COLORS.overig; const classCode = encounter.class_code as LocationClassCode; const startTime = format(new Date(evt.start), 'HH:mm'); const endTime = evt.end ? format(new Date(evt.end), 'HH:mm') : ''; return (
{startTime} {endTime && `- ${endTime}`}
{encounter.type_display || APPOINTMENT_TYPES[typeCode] || typeCode}
{getLocationIcon(classCode)} {encounter.class_display || LOCATION_CLASSES[classCode] || classCode}
{encounter.status === 'cancelled' && ( Geannuleerd )}
); }) )}
{/* Footer */}
); }