Exportar OSP en excel con formato especifico (falta img y datos que no estan en el formulario)

This commit is contained in:
2026-02-01 16:58:50 -04:00
parent 2566e5e9a7
commit 26fb849fa3
10 changed files with 372 additions and 61 deletions

View File

@@ -4,42 +4,48 @@ import { Badge } from '@repo/shadcn/badge';
import { ColumnDef } from '@tanstack/react-table';
import { CellAction } from './cell-action';
export const columns: ColumnDef<TrainingSchema>[] = [
{
accessorKey: 'ospName',
header: 'Nombre OSP',
},
{
accessorKey: 'ospRif',
header: 'RIF',
},
{
accessorKey: 'ospType',
header: 'Tipo',
},
{
accessorKey: 'currentStatus',
header: 'Estatus',
cell: ({ row }) => {
const status = row.getValue('currentStatus') as string;
return (
<Badge variant={status === 'ACTIVA' ? 'default' : 'secondary'}>
{status}
</Badge>
);
interface ColumnsProps {
apiUrl: string;
}
export function columns({ apiUrl }: ColumnsProps): ColumnDef<TrainingSchema>[] {
return [
{
accessorKey: 'ospName',
header: 'Nombre OSP',
},
},
{
accessorKey: 'visitDate',
header: 'Fecha Visita',
cell: ({ row }) => {
const date = row.getValue('visitDate') as string;
return date ? new Date(date).toLocaleString() : 'N/A';
{
accessorKey: 'ospRif',
header: 'RIF',
},
},
{
id: 'actions',
header: 'Acciones',
cell: ({ row }) => <CellAction data={row.original} />,
},
];
{
accessorKey: 'ospType',
header: 'Tipo',
},
{
accessorKey: 'currentStatus',
header: 'Estatus',
cell: ({ row }) => {
const status = row.getValue('currentStatus') as string;
return (
<Badge variant={status === 'ACTIVA' ? 'default' : 'secondary'}>
{status}
</Badge>
);
},
},
{
accessorKey: 'visitDate',
header: 'Fecha Visita',
cell: ({ row }) => {
const date = row.getValue('visitDate') as string;
return date ? new Date(date).toLocaleString() : 'N/A';
},
},
{
id: 'actions',
header: 'Acciones',
cell: ({ row }) => <CellAction data={row.original} apiUrl={apiUrl} />,
},
];
}