-
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.
- Loading branch information
Showing
48 changed files
with
3,059 additions
and
1,349 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import Cookies from 'js-cookie' | ||
// los dni son la mama de lo hardcodeado | ||
|
||
export const FetchCompromisos = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const dni = Cookies.get('dni'); | ||
|
||
const response = await fetch(`http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
||
export const FetchUltimoCompromiso = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const response = await fetch(`http://localhost:8000/api/ultimo-compromiso-de-pago/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
||
export const FirmarCompromiso = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const dni = Cookies.get('dni') | ||
|
||
const response = await fetch(`http://localhost:8000/api/firmas/firmar-compromiso/${dni}/`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
return; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
||
export const FetchCompromisosAlumno = async (dni: number) => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
|
||
|
||
const response = await fetch(`http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
}; | ||
|
||
export const FetchDetalleCompromiso = async (id: number) => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
|
||
|
||
const response = await fetch(`http://localhost:8000/api/compromisos/${id}/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Cookies from 'js-cookie'; | ||
|
||
export const FetchCuotas = async (limit: number, offset:number) => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const dni = Cookies.get('dni'); | ||
|
||
const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}/?limit=${limit}&offset=${offset}&ordering=id_cuota`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,86 @@ | ||
import Cookies from 'js-cookie'; | ||
|
||
export const FetchPostPago = async ( | ||
cuotas: any, | ||
montoInformado: number, | ||
comentario: string, | ||
) => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const dni = Cookies.get('dni'); | ||
|
||
const cuotas = [ | ||
{ | ||
numero: 0, | ||
monto1erVencimiento: 10000, | ||
monto2doVencimiento: 0, | ||
monto3erVencimiento: 0, | ||
valortotal: 10000, | ||
valorpagado: 10000, | ||
valoradeudado: 0, | ||
estado: "PAGADO", | ||
}, | ||
{ | ||
numero: 1, | ||
monto1erVencimiento: 10000, | ||
monto2doVencimiento: 15000, | ||
monto3erVencimiento: 20000, | ||
valortotal: 10000, | ||
valorpagado: 0, | ||
valoradeudado: 10000, | ||
estado: "INFORMADO", | ||
}, | ||
{ | ||
numero: 2, | ||
monto1erVencimiento: 10000, | ||
monto2doVencimiento: 15000, | ||
monto3erVencimiento: 20000, | ||
valortotal: 10000, | ||
valorpagado: 0, | ||
valoradeudado: 10000, | ||
estado: "ADEUDADO", | ||
}, | ||
{ | ||
numero: 3, | ||
monto1erVencimiento: 10000, | ||
monto2doVencimiento: 15000, | ||
monto3erVencimiento: 20000, | ||
valortotal: 10000, | ||
valorpagado: 0, | ||
valoradeudado: 10000, | ||
estado: "ADEUDADO", | ||
}, | ||
{ | ||
numero: 4, | ||
monto1erVencimiento: 10000, | ||
monto2doVencimiento: 15000, | ||
monto3erVencimiento: 20000, | ||
valortotal: 10000, | ||
valorpagado: 0, | ||
valoradeudado: 10000, | ||
estado: "ADEUDADO", | ||
}, | ||
{ | ||
numero: 5, | ||
monto1erVencimiento: 10000, | ||
monto2doVencimiento: 15000, | ||
monto3erVencimiento: 20000, | ||
valortotal: 10000, | ||
valorpagado: 0, | ||
valoradeudado: 10000, | ||
estado: "ADEUDADO", | ||
const response = await fetch(`http://localhost:8000/api/pagos/alumno/${dni}`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
body: JSON.stringify({alumno:dni, cuotas , monto_informado:montoInformado, comentario}), | ||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; //nose si lo dejo o que hago | ||
} else { | ||
const errorData = await response.json(); | ||
throw new Error( | ||
`Error en la respuesta del servidor: ${errorData.message}` | ||
); | ||
} | ||
} catch (error) { | ||
console.error('Network error:', error); | ||
throw error; | ||
} | ||
|
||
|
||
}; | ||
|
||
|
||
export const FetchGetCuotas = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const dni = Cookies.get('dni'); | ||
|
||
const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}/impagas/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} else { | ||
throw new Error('Error en la respuesta del servidor'); | ||
} | ||
} catch (error) { | ||
throw new Error('Network error: ' + error); | ||
} | ||
]; | ||
}; | ||
|
||
|
||
export default cuotas; | ||
|
||
export const FetchResumenPagos = async () => { | ||
try { | ||
const token = Cookies.get('tokennn'); | ||
const dni = Cookies.get('dni'); | ||
|
||
const response = await fetch(`http://localhost:8000/api/pagos/alumno/resumen_pagos/${dni}`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; | ||
} 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Cookies from 'js-cookie'; | ||
|
||
export const AbonaronCuota = async (fecha: string) => { | ||
try { | ||
|
||
const token = Cookies.get('tokennn'); | ||
const response = await fetch(`http://localhost:8000/api/alumnos/pagaron-cuota/${fecha}/`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': `Bearer ${token}`, | ||
} | ||
|
||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; //nose si lo dejo o que hago | ||
} else { | ||
const errorData = await response.json(); | ||
throw new Error( | ||
`Error en la respuesta del servidor: ${errorData.message}` | ||
); | ||
} | ||
} catch (error) { | ||
console.error('Network error:', error); | ||
} | ||
}; | ||
|
||
export const NoAbonaronCuota = async (fecha: string, limit: number, offset:number) => { | ||
try { | ||
|
||
const token = Cookies.get('tokennn'); | ||
const response = await fetch(`http://localhost:8000/api/alumnos/no-pagaron-cuota/${fecha}/?limit=${limit}&offset=${offset}&ordering=full_name`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': `Bearer ${token}`, | ||
} | ||
}); | ||
|
||
if (response.ok) { | ||
const data = await response.json(); | ||
return data; //nose si lo dejo o que hago | ||
} else { | ||
const errorData = await response.json(); | ||
throw new Error( | ||
`Error en la respuesta del servidor: ${errorData.message}` | ||
); | ||
} | ||
} catch (error) { | ||
console.error('Network error:', error); | ||
} | ||
}; | ||
|
Oops, something went wrong.