diff --git a/package.json b/package.json index 9d10668..c76b57b 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "next build", "start:local": "next build && next start -p 3246", "start:dev": "source ~/.nvm/nvm.sh && nvm use 22.10.0 && npm install && next build && next start -p 3246", - "start:prod": "source ~/.nvm/nvm.sh && nvm use 22.10.0 && npm install && next build && next start -p 3246", + "start:prod": "source ~/.nvm/nvm.sh && nvm use 22.10.0 && npm install && next build && next start -p 3240", "lint": "next lint" }, "dependencies": { diff --git a/src/app/(admins)/administrador/formulario/[id_formulario]/page.tsx b/src/app/(admins)/administrador/formulario/[id_formulario]/page.tsx index 0992585..fe68614 100644 --- a/src/app/(admins)/administrador/formulario/[id_formulario]/page.tsx +++ b/src/app/(admins)/administrador/formulario/[id_formulario]/page.tsx @@ -1,8 +1,10 @@ 'use client'; +import Button from '@/components/button'; import Input from '@/components/input'; import Table, { Header } from '@/components/table'; import { ParticipacionEvento } from '@/types/participante-evento'; import axiosInstance from '@/utils/api-config'; +import { downloadFile } from '@/utils/downloas-utils'; import { useParams } from 'next/navigation'; import React, { useEffect } from 'react'; import toast from 'react-hot-toast'; @@ -116,10 +118,29 @@ export default function Page() { p.participante.correo.toLowerCase().includes(busquedaCorreo.toLowerCase()) ); + const handleDownload = async () => { + try { + const res = await axiosInstance.get( + `/cuestionario-respondido/reporte-respuestas/${id_formulario}`, + { + responseType: 'blob', + } + ); + + downloadFile(res.data, 'lista_participantes', 'xlsx'); + } catch (error) { + toast.error('Error al descargar la lista de participantes'); + console.error('Error al descargar la lista de participantes:', error); + } + }; + return (
- No hay formularios disponibles. -
- )} + {eventos.map((cuestionario, index) => { + const fadeClass = `delay-${(index % 5) + 1}`; + + return ( +