"use client"; import { AppointmentCard } from "./AppointmentCard"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import type { Appointment } from "@/types/appointments"; interface AppointmentsListProps { appointments: Appointment[]; userRole: "PATIENT" | "DOCTOR" | "ADMIN"; onApprove?: (id: string) => void; onReject?: (id: string) => void; onCancel?: (id: string) => void; } export const AppointmentsList = ({ appointments, userRole, onApprove, onReject, onCancel, }: AppointmentsListProps) => { const pendientes = appointments.filter((a) => a.estado === "PENDIENTE"); const aprobadas = appointments.filter((a) => a.estado === "APROBADA"); const completadas = appointments.filter((a) => a.estado === "COMPLETADA"); const otras = appointments.filter( (a) => a.estado === "RECHAZADA" || a.estado === "CANCELADA" ); return ( Pendientes {pendientes.length > 0 && `(${pendientes.length})`} Aprobadas {aprobadas.length > 0 && `(${aprobadas.length})`} Completadas {completadas.length > 0 && `(${completadas.length})`} Otras {pendientes.length === 0 ? (

No hay citas pendientes

) : ( pendientes.map((appointment) => ( )) )}
{aprobadas.length === 0 ? (

No hay citas aprobadas

) : ( aprobadas.map((appointment) => ( )) )}
{completadas.length === 0 ? (

No hay citas completadas

) : ( completadas.map((appointment) => ( )) )}
{otras.length === 0 ? (

No hay citas rechazadas o canceladas

) : ( otras.map((appointment) => ( )) )}
); };