diff --git a/FrontAdmin/src/API/AlumnosPendienteFirma.ts b/FrontAdmin/src/API/AlumnosPendienteFirma.ts index 58b28a7..8aa48c0 100644 --- a/FrontAdmin/src/API/AlumnosPendienteFirma.ts +++ b/FrontAdmin/src/API/AlumnosPendienteFirma.ts @@ -17,10 +17,7 @@ export const FetchPendientesFirma = async () => { if (response.ok) { const data = await response.json(); - return { - results: data.results, // Lista de resultados - count: data.count, // Total de elementos - }; + return data; } else { throw new Error('Error en la respuesta del servidor'); } diff --git a/FrontAdmin/src/API/EstadoCuentaAlumno.ts b/FrontAdmin/src/API/EstadoCuentaAlumno.ts index 394181f..962ca16 100644 --- a/FrontAdmin/src/API/EstadoCuentaAlumno.ts +++ b/FrontAdmin/src/API/EstadoCuentaAlumno.ts @@ -1,10 +1,10 @@ import Cookies from 'js-cookie'; -export const FetchEstadoCuenta = async (dni: number) => { +export const FetchEstadoCuenta = async (dni: number, limit: number, offset: number) => { try { const token = Cookies.get('tokennn'); - const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}/`, { + const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}?limit=${limit}&offset=${offset}`, { method: 'GET', headers: { 'Content-Type': 'application/json', @@ -14,7 +14,7 @@ export const FetchEstadoCuenta = async (dni: number) => { if (response.ok) { const data = await response.json(); - return data.results; + return data; } else { throw new Error('Error en la respuesta del servidor'); } diff --git a/FrontAdmin/src/API/Inhabilitaciones.ts b/FrontAdmin/src/API/Inhabilitaciones.ts index fc16135..583e33e 100644 --- a/FrontAdmin/src/API/Inhabilitaciones.ts +++ b/FrontAdmin/src/API/Inhabilitaciones.ts @@ -46,30 +46,24 @@ export const getAlumnosaInhabilitar = async () => { }; -export const inhabilitarAlumno = async (legajo: number) => { - try { - const token = Cookies.get('tokennn'); - const response = await fetch(`http://localhost:8000/api/alumnos/alumno-a-inhabilitar/${legajo}/` , { - method: 'DELETE', +export const alumnosaHabilitar = async () => { + const token = Cookies.get('tokennn'); + const response = await fetch('http://localhost:8000/api/alumnos/alumnos-a-habilitar', { + method: 'GET', headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${token}`, - }, - }); - if (response.ok) { - if (response.status === 204) { - // No hay contenido en la respuesta - return {}; - } else { - const data = await response.json(); - return data; - } - } else { - throw new Error('Error en la respuesta del servidor'); + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` } - } catch (error) { - throw new Error('Network error: ' + error); + }); + if (response.ok) { + const data = await response.json(); + return data; + } else { + const errorData = await response.json(); + throw new Error( + `Error en la respuesta del servidor: ${errorData.message}` + ); } +} -}; diff --git a/FrontAdmin/src/API/TareasProgramadas.ts b/FrontAdmin/src/API/TareasProgramadas.ts new file mode 100644 index 0000000..2a946cd --- /dev/null +++ b/FrontAdmin/src/API/TareasProgramadas.ts @@ -0,0 +1,82 @@ +import Cookies from 'js-cookie'; + + +export const actualizarpagos = async () => { + const token = Cookies.get('tokennn'); + const response = await fetch('http://localhost:8000/api/pagos/actualizar-pagos', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + if (response.ok) { + const data = await response.json(); + return data; + } else { + const errorData = await response.json(); + throw new Error( + `Error en la respuesta del servidor: ${errorData.message}` + ); + } +}; + +export const actualizarinhabilitaciones = async () => { + const token = Cookies.get('tokennn'); + const response = await fetch('http://localhost:8000/api/alumnos/actualizar-inhabiliciones', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + if (response.ok) { + const data = await response.json(); + return data; + } else { + const errorData = await response.json(); + throw new Error( + `Error en la respuesta del servidor: ${errorData.message}` + ); + } +}; + +export const actualizarmaterias = async () => { + const token = Cookies.get('tokennn'); + const response = await fetch('http://localhost:8000/api/materias/actualizar-materias', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + if (response.ok) { + const data = await response.json(); + return data; + } else { + const errorData = await response.json(); + throw new Error( + `Error en la respuesta del servidor: ${errorData.message}` + ); + } +}; + +export const actualizarcuotas = async () => { + const token = Cookies.get('tokennn'); + const response = await fetch('http://localhost:8000/api/cuotas/actualizar-cuotas', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + if (response.ok) { + const data = await response.json(); + return data; + } else { + const errorData = await response.json(); + throw new Error( + `Error en la respuesta del servidor: ${errorData.message}` + ); + } +}; diff --git a/FrontAdmin/src/components/Header/HeaderContent.tsx b/FrontAdmin/src/components/Header/HeaderContent.tsx index fd380c6..6bfc204 100644 --- a/FrontAdmin/src/components/Header/HeaderContent.tsx +++ b/FrontAdmin/src/components/Header/HeaderContent.tsx @@ -11,6 +11,7 @@ import { Text, useDisclosure, Avatar, + useBreakpointValue } from '@chakra-ui/react'; import imgLogo from '../icons/Logos TUP_Mesa de trabajo 1.png'; import logoUser from '../icons/logo-user.png'; @@ -33,6 +34,9 @@ export function HeaderContent({ onOpen }: { onOpen: any }) { return fullName.trim(); } + // Definir el ancho de la caja de SubMenuContent según el tamaño de la pantalla + const isMobile = useBreakpointValue({ base: true, xl: false }); + // Perfil const { isOpen: isOpen1, @@ -74,7 +78,7 @@ export function HeaderContent({ onOpen }: { onOpen: any }) { color="white" /> - {user} + {user} { if (ultimo) { - console.log(ultimo); if (ultimo.firmo_ultimo_compromiso === true) { setUltimoCompromiso(true); } @@ -152,13 +151,14 @@ export default function CompromisoDePago() { p={4} borderRadius="md" w="100%" - mt={4} + mt={1} > {pdfUrl ? (