'use client'; import { useQuery } from '@tanstack/react-query'; import { DashboardShell } from '@/components/layouts/dashboard-shell'; import { Card, CardContent, CardHeader, CardTitle, SortableHeader } from '@horux/shared-ui'; import { apiClient } from '@/lib/api/client'; import { formatCurrency } from '@/lib/utils'; import { useTableSort } from '@horux/shared-ui'; export default function ConcentracionClientesPage() { const { data, isLoading } = useQuery({ queryKey: ['drilldown-concentracion-clientes'], queryFn: async () => { const res = await apiClient.get('/alertas/drilldown/concentracion-clientes'); return res.data; }, }); const { sortedData, toggleSort, getSortIndicator } = useTableSort( data, { cfdis: (d) => Number(d.cantidad || 0), total: (d) => Number(d.total || 0), }, 'total', ); return ( Participacion por Cliente (Facturas Emitidas) {isLoading ? (
Cargando...
) : !data || data.length === 0 ? (
No hay datos
) : (
toggleSort('cfdis')} /> toggleSort('total')} /> {(sortedData || []).map((d: any) => ( ))}
RFC Nombre Participacion
{d.rfc} {d.nombre} {d.cantidad} {formatCurrency(d.total)}
{d.participacion}%
)}
); }