-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tup 121 fix agregar alumnos que estan inscriptos a materias y no firm…
…aron el compromiso de pago (#162)
- Loading branch information
Showing
6 changed files
with
175 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Cookies from 'js-cookie'; | ||
|
||
export const FetchPendientesFirma = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
|
||
const response = await fetch( | ||
`http://localhost:8000/api/estadisticas/firmas_pendientes/`, | ||
{ | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
} | ||
); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return { | ||
results: data.results, // Lista de resultados | ||
count: data.count, // Total de elementos | ||
}; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
FrontAdmin/src/components/Pages/Estadisticas/SubPages/PendientesFirma.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {Box, Flex, Alert, AlertIcon, Center} from '@chakra-ui/react'; | ||
import TablaAlumnos from './TablaAlumnos'; | ||
import { FetchPendientesFirma } from '../../../../API/AlumnosPendienteFirma'; | ||
import { obtenerFechaDeHoy } from '../../../../utils/general'; | ||
import { useState, useEffect } from 'react'; | ||
import { InfoIcon } from '@chakra-ui/icons'; | ||
|
||
const PendientesFirma = () => { | ||
const fechaHoy = obtenerFechaDeHoy(); | ||
const anio = fechaHoy.split('/')[2]; | ||
const cuatrimestre = parseInt(fechaHoy.split('/')[1]) <= 7 ? '1C' : '2C'; | ||
const [results, setResults] = useState([]); | ||
const [count, setCount] = useState(0); | ||
|
||
const fetchAndSetValues = async (setResults: any, setCount: any) => { | ||
try { | ||
const { results, count } = await FetchPendientesFirma(); // Llama al endpoint y obtiene ambos valores | ||
setResults(results); // Asigna los resultados a la variable de estado o callback | ||
setCount(count); // Asigna el conteo a la variable de estado o callback | ||
} catch (error) { | ||
console.error('Error al obtener los datos:', error); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
fetchAndSetValues(setResults, setCount); // Llama la función para obtener y setear los valores | ||
}, []); | ||
|
||
return ( | ||
<Box> | ||
<Alert status='warning' m={4}> <AlertIcon /> Alumnos que cursan una matería del cuatrimestre actual y no firmaron el compromiso de pago (Total: {count}).</Alert> | ||
{/* <Alert status='info' alignItems={'center'} maxW={'20%'} p={'10px'} m={4}> <AlertIcon /> Total: {count} alumnos.</Alert> */} | ||
<TablaAlumnos | ||
fetchFunction={async () => { | ||
return results; // Retorna solo los resultados al componente | ||
}} | ||
title="Alumnos que no firmaron compromiso actual" | ||
/> | ||
</Box> | ||
); | ||
} | ||
|
||
export default PendientesFirma; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { title } from "process"; | ||
|
||
export const ITEMS_SUBMENU = [ | ||
{ url: 'inhabilitaciones', title: 'Inhabilitaciones' }, | ||
{ url: 'baja-provisoria', title: 'Baja Provisoria' }, | ||
{ url: 'inhabilitaciones', title: 'Inhabilitaciones', tooltip: 'Alumnos que se encuentran inhabilitados' }, | ||
{ url: 'baja-provisoria', title: 'Baja Provisoria', tooltip: 'Alumnos que solicitaron la baja' }, | ||
{ url: 'cuotas', title: 'Cuotas' , tooltip: 'Alumnos que abonaron/no abonaron una respectiva cuota' }, | ||
{ url: 'matricula', title: 'Matricula' }, | ||
{ url: 'alumnos-que-firmaron-compromiso-de-pago', title: 'Compromiso de Pago'}, | ||
{ url: 'pagos', title: 'Pagos' }, | ||
{ url: 'deudas', title: 'Deudas' }, | ||
{ | ||
url: 'alumnos-que-cursan-materia', | ||
title: 'Alumnos que cursan una materia', | ||
}, | ||
{ url: 'matricula', title: 'Matricula', tooltip: 'Alumnos que abonaron la matricula' }, | ||
{ url: 'alumnos-que-firmaron-compromiso-de-pago', title: 'Compromiso de Pago', tooltip: 'Alumnos que firmaron el compromiso de pago' }, | ||
{ url: 'pagos', title: 'Pagos', tooltip: 'Alumnos que abonaron/no abonaron una respectiva cuota' }, | ||
{ url: 'deudas', title: 'Deudas', tooltipo: 'Alumnos que adeudan una cuota' }, | ||
{url: 'alumnos-que-cursan-materia',title: 'Alumnos que cursan una materia', tooltip: 'Alumnos que cursan una materia'}, | ||
{ url: 'pendientes-firma-compromiso', title: 'Alumnos pendiente de firma', tooltip: 'Alumnos que cursan una materia y no firmaron el último compromiso de pago' }, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters