diff --git a/package-lock.json b/package-lock.json index 15bbb20..004ec19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,8 @@ "next": "15.2.4", "react": "^19.0.0", "react-dom": "^19.0.0", - "react-hot-toast": "^2.5.2" + "react-hot-toast": "^2.5.2", + "xlsx": "^0.18.5" }, "devDependencies": { "@eslint/eslintrc": "^3", @@ -1444,6 +1445,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/adler-32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz", + "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1914,6 +1924,19 @@ ], "license": "CC-BY-4.0" }, + "node_modules/cfb": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", + "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==", + "license": "Apache-2.0", + "dependencies": { + "adler-32": "~1.3.0", + "crc-32": "~1.2.0" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1975,6 +1998,15 @@ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", "license": "MIT" }, + "node_modules/codepage": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz", + "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, "node_modules/color": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", @@ -2039,6 +2071,18 @@ "dev": true, "license": "MIT" }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -3020,6 +3064,15 @@ "node": ">= 6" } }, + "node_modules/frac": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz", + "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -4957,6 +5010,18 @@ "node": ">=0.10.0" } }, + "node_modules/ssf": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz", + "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==", + "license": "Apache-2.0", + "dependencies": { + "frac": "~1.1.2" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/stable-hash": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz", @@ -5545,6 +5610,24 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/wmf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz", + "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/word": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz", + "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -5555,6 +5638,27 @@ "node": ">=0.10.0" } }, + "node_modules/xlsx": { + "version": "0.18.5", + "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz", + "integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==", + "license": "Apache-2.0", + "dependencies": { + "adler-32": "~1.3.0", + "cfb": "~1.2.1", + "codepage": "~1.15.0", + "crc-32": "~1.2.1", + "ssf": "~0.11.2", + "wmf": "~1.0.1", + "word": "~0.3.0" + }, + "bin": { + "xlsx": "bin/xlsx.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index c76b57b..caef36d 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "next": "15.2.4", "react": "^19.0.0", "react-dom": "^19.0.0", - "react-hot-toast": "^2.5.2" + "react-hot-toast": "^2.5.2", + "xlsx": "^0.18.5" }, "devDependencies": { "@eslint/eslintrc": "^3", diff --git a/public/.~lock.participantes_formulario_1 (2).xlsx# b/public/.~lock.participantes_formulario_1 (2).xlsx# new file mode 100644 index 0000000..f735681 --- /dev/null +++ b/public/.~lock.participantes_formulario_1 (2).xlsx# @@ -0,0 +1 @@ +,cidwa,cidwa,21.04.2025 12:05,file:///home/cidwa/.config/libreoffice/4; \ No newline at end of file diff --git a/public/acta-jornada.pdf b/public/acta-jornada.pdf new file mode 100644 index 0000000..ec5406d --- /dev/null +++ b/public/acta-jornada.pdf @@ -0,0 +1,153 @@ +%PDF-1.3 +% +8 0 obj +<< +/Type /ExtGState +/ca 1 +>> +endobj +9 0 obj +<< +/Type /ExtGState +/ca 1 +/CA 1 +>> +endobj +12 0 obj +<< +/Type /ExtGState +/CA 1 +>> +endobj +7 0 obj +<< +/Type /Page +/Parent 1 0 R +/MediaBox [0 0 595.28 841.89] +/Contents 5 0 R +/Resources 6 0 R +>> +endobj +6 0 obj +<< +/ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/ExtGState << +/Gs1 8 0 R +/Gs2 9 0 R +/Gs3 12 0 R +>> +/Font << +/F1 10 0 R +/F2 11 0 R +/F3 13 0 R +>> +/ColorSpace << +>> +>> +endobj +5 0 obj +<< +/Length 1506 +/Filter /FlateDecode +>> +stream +xZ]k\7}B cͷf<---u5~:]{sh4sf5bx!$)Cá.wD@d-wǿ~:)t7o1@1]I 5 y|!ӛT~z?;c@r`p%݇[U9JVUR, í]ݻ!rjl(8/\b˾u íN8` 6)'^ Ϛ$ Kuר S&Y\v! 98炪w!{ʬNV*"&*eUE#T5LVm9dG9^?A ݂+-L)5[ELa*WUVRr!ҷv:-|*[}|`9h\{C$(V#JE'߅"䣂^J 3D`H=G4 %c8\>B6:N!;$L5F>C VorHX 9W>#Y9OѺ8L&ia6r~͏em\cbPyЕV3NU@^eK@ajEߜ +!6҂J#hp>d0DC+FPo19L<̫* (tY@vC\ 䊀-'Wò's dO lnb A:(,[ 0VyJ!QfEG9XO7l˂NV~9 ªτXQ*:y!'6CfG"5p:ynV__be-n=> +endobj +10 0 obj +<< +/Type /Font +/BaseFont /Helvetica-Bold +/Subtype /Type1 +/Encoding /WinAnsiEncoding +>> +endobj +11 0 obj +<< +/Type /Font +/BaseFont /Helvetica +/Subtype /Type1 +/Encoding /WinAnsiEncoding +>> +endobj +13 0 obj +<< +/Type /Font +/BaseFont /Helvetica-Oblique +/Subtype /Type1 +/Encoding /WinAnsiEncoding +>> +endobj +4 0 obj +<< +>> +endobj +3 0 obj +<< +/Type /Catalog +/Pages 1 0 R +/Names 2 0 R +>> +endobj +1 0 obj +<< +/Type /Pages +/Count 1 +/Kids [7 0 R] +>> +endobj +2 0 obj +<< +/Dests << + /Names [ +] +>> +>> +endobj +xref +0 18 +0000000000 65535 f +0000002578 00000 n +0000002635 00000 n +0000002516 00000 n +0000002495 00000 n +0000000445 00000 n +0000000264 00000 n +0000000154 00000 n +0000000015 00000 n +0000000059 00000 n +0000002188 00000 n +0000002291 00000 n +0000000109 00000 n +0000002389 00000 n +0000002112 00000 n +0000002024 00000 n +0000002050 00000 n +0000002076 00000 n +trailer +<< +/Size 18 +/Root 3 0 R +/Info 14 0 R +/ID [<9268f2c88641c22ef19a769193d37029> <9268f2c88641c22ef19a769193d37029>] +>> +startxref +2682 +%%EOF diff --git a/public/banner1.png b/public/banner1.png new file mode 100644 index 0000000..f7a928f Binary files /dev/null and b/public/banner1.png differ diff --git a/public/participantes_formulario_1 (1).xlsx b/public/participantes_formulario_1 (1).xlsx new file mode 100644 index 0000000..1d784cf Binary files /dev/null and b/public/participantes_formulario_1 (1).xlsx differ diff --git a/public/participantes_formulario_1 (2).xlsx b/public/participantes_formulario_1 (2).xlsx new file mode 100644 index 0000000..9888d0b Binary files /dev/null and b/public/participantes_formulario_1 (2).xlsx differ diff --git a/public/participantes_formulario_1 (3).xlsx b/public/participantes_formulario_1 (3).xlsx new file mode 100644 index 0000000..95660e6 Binary files /dev/null and b/public/participantes_formulario_1 (3).xlsx differ diff --git a/public/participantes_formulario_1 (4).xlsx b/public/participantes_formulario_1 (4).xlsx new file mode 100644 index 0000000..01f5f2e Binary files /dev/null and b/public/participantes_formulario_1 (4).xlsx differ diff --git a/public/participantes_formulario_1 (5).xlsx b/public/participantes_formulario_1 (5).xlsx new file mode 100644 index 0000000..82d491c Binary files /dev/null and b/public/participantes_formulario_1 (5).xlsx differ diff --git a/public/participantes_formulario_1 (6).xlsx b/public/participantes_formulario_1 (6).xlsx new file mode 100644 index 0000000..82d491c Binary files /dev/null and b/public/participantes_formulario_1 (6).xlsx differ diff --git a/public/participantes_formulario_1.xlsx b/public/participantes_formulario_1.xlsx new file mode 100644 index 0000000..a634680 Binary files /dev/null and b/public/participantes_formulario_1.xlsx differ diff --git a/src/app/(admins)/administrador/crear-formulario/page.tsx b/src/app/(admins)/administrador/crear-formulario/page.tsx index 56ea72e..ca92207 100644 --- a/src/app/(admins)/administrador/crear-formulario/page.tsx +++ b/src/app/(admins)/administrador/crear-formulario/page.tsx @@ -217,7 +217,7 @@ export default function AdminFormPage() {

Plantillas

{ const { nombre_form, @@ -249,8 +249,8 @@ export default function AdminFormPage() { > {`Plantilla @@ -313,7 +313,8 @@ export default function AdminFormPage() { />
-
+
+

Fechas de inicio y fin del formulario

(); @@ -118,20 +119,37 @@ 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); + const handleDownload = () => { + if (participantesFiltrados.length === 0) { + toast.error('No hay participantes para exportar'); + return; } + + const rows = participantesFiltrados.map((item) => ({ + ID_Participante: item.id_participante, + ID_Evento: item.id_evento, + Correo: item.participante.correo, + Fecha_Inscripcion: new Date(item.fecha_inscripcion).toLocaleString(), + Estatus: item.fecha_asistencia ? 'Asistio' : 'No asistio', + Fecha_Asistencia: item.fecha_asistencia + ? new Date(item.fecha_asistencia).toLocaleString() + : '', + })); + + const worksheet = XLSX.utils.json_to_sheet(rows); + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, 'Participantes'); + + const excelBuffer = XLSX.write(workbook, { + bookType: 'xlsx', + type: 'array', + }); + + const blob = new Blob([excelBuffer], { + type: 'application/octet-stream', + }); + + downloadFile(blob, `participantes_formulario_${id_formulario}`, 'xlsx'); }; return ( diff --git a/src/app/(public)/page.tsx b/src/app/(public)/page.tsx index 2e4a618..8378add 100644 --- a/src/app/(public)/page.tsx +++ b/src/app/(public)/page.tsx @@ -70,7 +70,7 @@ export default function Page() { return (