Skip to content

Commit

Permalink
Ultima chillada del año (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasMaciel authored Dec 13, 2024
2 parents 0a7474a + 7685cf6 commit 59e5b1b
Show file tree
Hide file tree
Showing 179 changed files with 5,183 additions and 9,156 deletions.
97 changes: 96 additions & 1 deletion FrontAdmin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion FrontAdmin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-icons": "^5.2.1",
"react-router-dom": "^6.26.0"
"react-router-dom": "^6.26.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@types/js-cookie": "^3.0.6",
Expand Down
8 changes: 5 additions & 3 deletions FrontAdmin/src/API-Alumnos/Compromiso.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
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 () => {
export const FetchCompromisos = async (dni: number | undefined ) => {

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

View workflow job for this annotation

GitHub Actions / Linter de Código

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

if (!dni) {
dni = parseInt(Cookies.get('dni') || '', 10);

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 11 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 12 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 13 in FrontAdmin/src/API-Alumnos/Compromiso.ts

View workflow job for this annotation

GitHub Actions / Linter de Código

Replace `············` with `········`
Expand Down
121 changes: 121 additions & 0 deletions FrontAdmin/src/API-Alumnos/DarseBaja.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import Cookies from 'js-cookie';

export const solicitarBajaAlumno = async (dni: number, motivo: string) => {
try {
const response = await fetch(`http://localhost:8000/api/alumnos/${dni}/solicitar-baja/`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${Cookies.get('tokennn')}`,
},
body: JSON.stringify({
motivo: motivo,
}),
});

if (response.ok) {
console.log('Baja solicitada correctamente');
return true;
} else {
console.error('Error al solicitar la baja');
return false;
}
} catch (error) {
console.error('Error al solicitar la baja:', error);
return false;
}
};

export const verficarBajaAlumno = async (dni: number) => {
try {
const response = await fetch(`http://localhost:8000/api/alumnos/${dni}/puede-solicitar-baja/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${Cookies.get('tokennn')}`,
},
});

if (response.ok) {
const data = await response.json();
return data.puede_solicitar;
} else {
console.error('Error al verificar si el alumno puede solicitar la baja');
return false;
}
} catch (error) {
console.error('Error al verificar si el alumno puede solicitar la baja:', error);
return false;
}
};

export const bajasSolicitadas = async () => {
try {
const response = await fetch(`http://localhost:8000/api/alumnos/bajas_solicitadas/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${Cookies.get('tokennn')}`,
},
});

if (response.ok) {
const data = await response.json();
return data;
} else {
console.error('Error al verificar si el alumno puede solicitar la baja');
return false;
}
} catch (error) {
console.error('Error al verificar si el alumno puede solicitar la baja:', error);
return false;
}
};

export const responderBaja = async (dni: number, respuesta: string) => {
try {
const response = await fetch(`http://localhost:8000/api/alumnos/baja/${dni}/`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${Cookies.get('tokennn')}`,
},
body: JSON.stringify({
estado: respuesta,
}),

});

if (response.ok) {

return true;
} else {

return false;
}
} catch (error) {
console.error( error);
return false;
}
};

export const dadosDeBaja = async () => {
try {
const response = await fetch(`http://localhost:8000/api/alumnos/baja/`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${Cookies.get('tokennn')}`,
},

});

if (response.ok) {
const data = await response.json();
return data;
}
} catch (error) {
console.error( error);
return false;
}
};
32 changes: 32 additions & 0 deletions FrontAdmin/src/API-Alumnos/InhabilitacionesAlumno.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Cookies from 'js-cookie';

export const inhabilitacionesA = async (
dni: number,
) => {
try {
const token = Cookies.get('tokennn');

const response = await fetch(`http://localhost:8000/api/alumnos/${dni}/inhabilitaciones/`, {
method: 'GET',
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}`
);
}
} catch (error) {
console.error('Network error:', error);
throw error;
}


};
16 changes: 9 additions & 7 deletions FrontAdmin/src/API-Alumnos/Pagos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const FetchPostPago = async (
const token = Cookies.get('tokennn');
const dni = Cookies.get('dni');

const response = await fetch(`http://localhost:8000/api/pagos/alumno/${dni}`, {
const response = await fetch(`http://localhost:8000/api/pagos/alumno/${dni}/`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand All @@ -36,11 +36,12 @@ export const FetchPostPago = async (
};


export const FetchGetCuotas = async () => {
export const FetchGetCuotas = async (dni: number | undefined ) => {
try {
const token = Cookies.get('tokennn');
const dni = Cookies.get('dni');

if (!dni) {
dni = parseInt(Cookies.get('dni') || '', 10);
}
const response = await fetch(`http://localhost:8000/api/cuotas/alumno/${dni}/impagas/`, {
method: 'GET',
headers: {
Expand All @@ -61,11 +62,12 @@ export const FetchGetCuotas = async () => {
};


export const FetchResumenPagos = async () => {
export const FetchResumenPagos = async (dni: number | undefined ) => {
try {
const token = Cookies.get('tokennn');
const dni = Cookies.get('dni');

if (!dni) {
dni = parseInt(Cookies.get('dni') || '', 10);
}
const response = await fetch(`http://localhost:8000/api/pagos/alumno/resumen_pagos/${dni}`, {
method: 'GET',
headers: {
Expand Down
Loading

0 comments on commit 59e5b1b

Please sign in to comment.