GLS Registry

Billing Table

A paginated table of invoice dates, status, amounts, and PDF links.

Fecha de emisiónEstadoImporteFactura
20 ago 2026Pendiente438,00 €Factura 20 ago 2026
6 ago 2026Pendiente327,00 €Factura 6 ago 2026
15 jul 2026Enviada164,00 €Factura 15 jul 2026
7 jul 2026Enviada473,00 €Factura 7 jul 2026
1 jun 2026Enviada486,00 €Factura 1 jun 2026

Página 1 de 1

Installation

pnpm dlx shadcn@latest add @ecodeliver/billing-table

Installing this item also copies paginated-table.tsx.

Usage

Pass the full billings array. Date filtering is a TanStack column filter on emissionDate; the parent owns that state. Rows sort by emissionDate descending and paginate at 10 by default.

import { useState } from "react";
import { endOfDay, startOfDay, subDays } from "date-fns";
import { BillingTable } from "@/components/registry/billing-table";
import { DateRangeSelector } from "@/components/registry/date-range-picker";

export function Example() {
  const [columnFilters, setColumnFilters] = useState(() => {
    const to = endOfDay(new Date());
    return [
      {
        id: "emissionDate",
        value: { from: startOfDay(subDays(to, 29)), to },
      },
    ];
  });

  return (
    <>
      <DateRangeSelector
        value={columnFilters.find((filter) => filter.id === "emissionDate")?.value}
        onDateChange={(range) =>
          setColumnFilters([{ id: "emissionDate", value: range }])
        }
        presets={[
          { value: "30days", label: "Último mes", daysBack: 29 },
          { value: "90days", label: "Últimos 3 meses", daysBack: 89 },
          { value: "365days", label: "Último año", daysBack: 364 },
        ]}
      />
      <BillingTable
        billings={billings}
        columnFilters={columnFilters}
        onColumnFiltersChange={setColumnFilters}
      />
    </>
  );
}

Display

  • Fecha de emisión: format(parseISO(emissionDate), "PP", { locale: es })
  • Estado: badge, "Pendiente" or "Enviada"
  • Importe: es-ES EUR
  • Factura: link labeled Factura <date>, opens in a new tab

The date-range filter uses isWithinInterval from date-fns. If from or to is missing, every row passes.

API Reference

BillingTable

The BillingTable component wraps PaginatedTable with billing columns.

PropTypeDefault
billingsBillingEntry[]-
columnFiltersColumnFiltersState-
onColumnFiltersChangeOnChangeFn<ColumnFiltersState>-
isPendingbooleanfalse

BillingEntry

PropTypeDefault
emissionDatestring-
state"pending" | "sent"-
importsnumber-
billstring-

On this page