Skip to content

Commit

Permalink
QUEEE CHILLEEEEEEEEEE (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasMaciel authored Oct 9, 2024
2 parents 50a6fa8 + 92a474c commit 0a7474a
Show file tree
Hide file tree
Showing 48 changed files with 3,059 additions and 1,349 deletions.
203 changes: 114 additions & 89 deletions FrontAdmin/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion FrontAdmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@types/react-router-dom": "^5.3.3",
"chart.js": "^4.4.3",
"date-fns": "^3.6.0",
"framer-motion": "^11.9.0",
"js-cookie": "^3.0.5",
"material-react-table": "^2.13.1",
"pdfjs-dist": "^3.4.120",
Expand Down Expand Up @@ -52,6 +53,6 @@
"eslint-plugin-react-refresh": "^0.4.6",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"vite": "^5.4.0"
"vite": "^5.4.7"
}
}
116 changes: 116 additions & 0 deletions FrontAdmin/src/API-Alumnos/Compromiso.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import Cookies from 'js-cookie'

Check warning on line 1 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Insert `;`
// los dni son la mama de lo hardcodeado

export const FetchCompromisos = async () => {
try {

Check warning on line 5 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Insert `·`
const token = Cookies.get('tokennn');
const dni = Cookies.get('dni');

Check warning on line 8 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Delete `···`
const response = await fetch(`http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`, {

Check warning on line 9 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Replace ``http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`,·{` with `⏎······`http://localhost:8000/api/firmas/firmas-de-alumno/${dni}/`,`
method: 'GET',

Check warning on line 10 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Insert `··{⏎`
headers: {

Check warning on line 11 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Replace `············` with `········`
'Content-Type': 'application/json',

Check warning on line 12 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Delete `······`
Authorization: `Bearer ${token}`,

Check warning on line 13 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Delete `······`
},

Check warning on line 14 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Replace `····},` with `},⏎······}`
});

Check warning on line 15 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Delete `}`
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);
}
};


26 changes: 26 additions & 0 deletions FrontAdmin/src/API-Alumnos/Cuotas.ts
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);
}
};

145 changes: 82 additions & 63 deletions FrontAdmin/src/API-Alumnos/Pagos.ts
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);
}
};
55 changes: 55 additions & 0 deletions FrontAdmin/src/API/AbonaronCuota.ts
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);
}
};

Loading

0 comments on commit 0a7474a

Please sign in to comment.