From ef43cf238c6f7614d50a65a4ba394fd727edfeba Mon Sep 17 00:00:00 2001 From: Patriots01 <424018289@pcpum.acatlan.unam.mx> Date: Sat, 7 Mar 2026 01:41:29 +0000 Subject: [PATCH] Modificaciones --- eslint.config.mjs | 4 ++ .../editar/[idCasoEspecial]/page.tsx | 50 ++++++++++--------- src/components/administrador/cuestionario.tsx | 31 ++++++++++-- .../administrador/informacion-servicio.tsx | 8 ++- tsconfig.json | 2 +- 5 files changed, 67 insertions(+), 28 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 719cea2..0a3d857 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -19,6 +19,10 @@ const eslintConfig = [ "build/**", "next-env.d.ts", ], + rules: { + // permit using `any` in the codebase, otherwise Next's defaults treat it as an error + '@typescript-eslint/no-explicit-any': 'off', + }, }, ]; diff --git a/src/app/administrador/casos_especiales/caso_especial/editar/[idCasoEspecial]/page.tsx b/src/app/administrador/casos_especiales/caso_especial/editar/[idCasoEspecial]/page.tsx index b39a947..c89a6b9 100644 --- a/src/app/administrador/casos_especiales/caso_especial/editar/[idCasoEspecial]/page.tsx +++ b/src/app/administrador/casos_especiales/caso_especial/editar/[idCasoEspecial]/page.tsx @@ -30,6 +30,33 @@ export default function EditarCasoEspecial() { const params = useParams(); const idCasoEspe = Number(params.idCasoEspecial); + + // fetch local storage and user data when component mounts + useEffect(() => { + const fetchUser = async () => { + await getLocalInfo(); + + if (!idCasoEspecial) return; + + try { + setIsLoading(true); + const data = await getUserCasoEspecial(idCasoEspecial); + + setDatos(data); + } catch (error: unknown) { + const axiosErr = error as AxiosError<{ message: string }>; + const mensaje = axiosErr?.response?.data?.message || 'No se pudo obtener la infromacion del caso especial.'; + Swal.fire({ + title: 'Error', + icon: 'error', + text: mensaje, + }); + } + }; + + fetchUser(); + }, []); + if (isNaN(idCasoEspe)) { return

Servicio inválido

; } @@ -100,29 +127,6 @@ export default function EditarCasoEspecial() { const updateIsLoading = (value: boolean) => setIsLoading(value); - useEffect(() => { - const fetchUser = async () => { - await getLocalInfo(); - - if (!idCasoEspecial) return - - try { - setIsLoading(true); - const data = await getUserCasoEspecial(idCasoEspecial) - - setDatos(data); - } catch (error) { - const axiosErr = error as AxiosError; - const mensaje = axiosErr?.response?.data?.message || 'No se pudo obtener la infromacion del caso especial.' - Swal.fire({ - title: 'Error', - icon: 'error', - text: mensaje, - }) - } - } - }, []) - return (
diff --git a/src/components/administrador/cuestionario.tsx b/src/components/administrador/cuestionario.tsx index 0b33794..588edcf 100644 --- a/src/components/administrador/cuestionario.tsx +++ b/src/components/administrador/cuestionario.tsx @@ -20,7 +20,32 @@ export default function Cuestionario({ years, admin, updateIsLoading }: Props) { try { //updateIsLoading(true); //const res = await axiosInstance.get(`/cuestionario_alumno?year=${selectedCuestionario}&version=${version}`, { - const res = await axiosInstance.get(`/cuestionario-alumno2`, { + + // Hacer la validacion de que tipo de cuestionario quiere + // if(selectedCuestionario === "cuestionario_alumno") { + // var res = await axiosInstance.get(`/cuestionario-alumno2`, { + // params: { anio: selectedYear, version }, + // responseType: "blob", + // }); + // } else if(selectedCuestionario === "cuestionario_programa") { + // var res = await axiosInstance.get(`/cuestionario-programa2`, { + // params: { anio: selectedYear, version }, + // responseType: "blob", + // }); + // } else { + // Swal.fire({ + // title: 'Error', + // text: 'Seleccione un cuestionario válido.', + // icon: 'error', + // }) + // return; + // } + + // antes + + console.log("Estos son los datos que se van a enviar para descargar el cuestionario", { selectedCuestionario, version, selectedYear }) + + const res = await axiosInstance.get(`/${selectedCuestionario}`, { params: { anio: selectedYear, version }, responseType: "blob", }); @@ -85,8 +110,8 @@ export default function Cuestionario({ years, admin, updateIsLoading }: Props) { setSelectedCuestionario(e.target.value)}> - - + + diff --git a/src/components/administrador/informacion-servicio.tsx b/src/components/administrador/informacion-servicio.tsx index 29b8c08..651f384 100644 --- a/src/components/administrador/informacion-servicio.tsx +++ b/src/components/administrador/informacion-servicio.tsx @@ -47,6 +47,7 @@ interface Datos { fechaLiberacion?: string; telefono?: string; direccion?: string; + responsableIntermo?: string; /* cartaAceptacion?: boolean; cartaTermino?: boolean; @@ -145,7 +146,7 @@ export default function InformacionServicio({ admin, imprimirError, updateIsLoad
- +

{datos.programa?.programa}

@@ -159,6 +160,11 @@ export default function InformacionServicio({ admin, imprimirError, updateIsLoad

{datos.programa?.usuario?.nombre}

+
+ +

{datos?.responsableIntermo || '-'}

+
+

{datos.programa?.usuario?.usuario}

diff --git a/tsconfig.json b/tsconfig.json index b575f7d..5d606a9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "react-jsx", + "jsx": "preserve", "incremental": true, "plugins": [ {