import { History } from "lucide-react"; import { Link, useNavigate } from "react-router-dom"; import { Table, Text } from "@mantine/core"; import { BookingPriorityBadge } from "@/components/bookings/BookingPriorityBadge"; import { BookingStatusBadge } from "@/components/bookings/BookingStatusBadge"; import type { IOverviewRecentBooking } from "@/types/overview"; import { SummaryCard } from "./summary/SummaryCard"; function formatAmount(amount: number | null, currency: string | null) { if (amount == null) return "—"; return new Intl.NumberFormat("en-US", { style: "currency", currency: currency || "ETB", maximumFractionDigits: 0, }).format(amount); } export function OverviewRecentBookingsTable({ bookings, }: { bookings: IOverviewRecentBooking[]; }) { const navigate = useNavigate(); return ( View all → } > {bookings.length === 0 ? ( No recent bookings ) : ( {["Reference", "Customer", "Status", "Priority", "Amount", "Created"].map( (header) => ( {header} ), )} {bookings.map((booking) => ( navigate(`/dashboard/booking-requests/${booking.id}`)} > {booking.reference} {booking.customerLabel} {formatAmount(booking.totalAmount, booking.paymentCurrency)} {new Date(booking.createdAt).toLocaleDateString()} ))}
)}
); }