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

@@ -9,16 +9,17 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@repo/shadcn/tooltip';
import { Edit, Eye, Trash } from 'lucide-react';
import { Edit, Eye, Trash, FileDown } from 'lucide-react';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { TrainingViewModal } from '../training-view-modal';
interface CellActionProps {
data: TrainingSchema;
apiUrl: string;
}
export const CellAction: React.FC<CellActionProps> = ({ data }) => {
export const CellAction: React.FC<CellActionProps> = ({ data, apiUrl }) => {
const [loading, setLoading] = useState(false);
const [open, setOpen] = useState(false);
const [viewOpen, setViewOpen] = useState(false);
@@ -37,6 +38,10 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
}
};
const handleExport = (id?: number | undefined) => {
window.open(`${apiUrl}/training/export/${id}`, '_blank');
};
return (
<>
<AlertModal
@@ -72,6 +77,23 @@ export const CellAction: React.FC<CellActionProps> = ({ data }) => {
</Tooltip>
</TooltipProvider>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="outline"
size="icon"
onClick={() => handleExport(data.id)}
>
<FileDown className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Exportar Excel</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>