import React from "react"; import { DollarSign } from "lucide-react"; import PaginationControls from "./pagination-controls"; export type GenericRow = { id: string | number; name: string; currentBalance: number; totalCharges: number; totalPayments: number; }; export default function PatientsBalancesList({ rows, reportType, loading, error, emptyMessage, pageIndex = 1, // 1-based perPage = 10, total, // optional totalCount from backend onPrev, onNext, hasPrev, hasNext, headerRight, // optional UI node to render in header }: { rows: GenericRow[]; reportType?: string | null; loading?: boolean; error?: string | boolean; emptyMessage?: string; // cursor props (required) pageIndex?: number; perPage?: number; total?: number | undefined; onPrev: () => void; onNext: () => void; hasPrev: boolean; hasNext: boolean; headerRight?: React.ReactNode; }) { const fmt = (v: number) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", }).format(v); const reportTypeTitle = (rt?: string | null) => { switch (rt) { case "patients_with_balance": return "Patients with Outstanding Balances"; case "patients_no_balance": return "Patients with Zero Balance"; case "monthly_collections": return "Monthly Collections"; case "collections_by_doctor": return "Collections by Doctor"; default: return "Balances"; } }; return (
{emptyMessage ?? "No rows for this report."}
ID: {r.id}