feat: Ajout d'un système de notation par classe et par matière et par élève [N3WTS-6]

This commit is contained in:
N3WT DE COMPET
2026-04-03 22:10:32 +02:00
parent edb9ace6ae
commit 905fa5dbfb
15 changed files with 1970 additions and 79 deletions

View File

@ -9,6 +9,8 @@ import {
BE_SCHOOL_PAYMENT_MODES_URL,
BE_SCHOOL_ESTABLISHMENT_URL,
BE_SCHOOL_ESTABLISHMENT_COMPETENCIES_URL,
BE_SCHOOL_EVALUATIONS_URL,
BE_SCHOOL_STUDENT_EVALUATIONS_URL,
} from '@/utils/Url';
import { fetchWithAuth } from '@/utils/fetchWithAuth';
@ -132,3 +134,71 @@ export const removeDatas = (url, id, csrfToken) => {
headers: { 'X-CSRFToken': csrfToken },
});
};
// ===================== EVALUATIONS =====================
export const fetchEvaluations = (establishmentId, schoolClassId = null, period = null) => {
let url = `${BE_SCHOOL_EVALUATIONS_URL}?establishment_id=${establishmentId}`;
if (schoolClassId) url += `&school_class=${schoolClassId}`;
if (period) url += `&period=${period}`;
return fetchWithAuth(url);
};
export const createEvaluation = (data, csrfToken) => {
return fetchWithAuth(BE_SCHOOL_EVALUATIONS_URL, {
method: 'POST',
headers: { 'X-CSRFToken': csrfToken },
body: JSON.stringify(data),
});
};
export const updateEvaluation = (id, data, csrfToken) => {
return fetchWithAuth(`${BE_SCHOOL_EVALUATIONS_URL}/${id}`, {
method: 'PUT',
headers: { 'X-CSRFToken': csrfToken },
body: JSON.stringify(data),
});
};
export const deleteEvaluation = (id, csrfToken) => {
return fetchWithAuth(`${BE_SCHOOL_EVALUATIONS_URL}/${id}`, {
method: 'DELETE',
headers: { 'X-CSRFToken': csrfToken },
});
};
// ===================== STUDENT EVALUATIONS =====================
export const fetchStudentEvaluations = (studentId = null, evaluationId = null, period = null, schoolClassId = null) => {
let url = `${BE_SCHOOL_STUDENT_EVALUATIONS_URL}?`;
const params = [];
if (studentId) params.push(`student_id=${studentId}`);
if (evaluationId) params.push(`evaluation_id=${evaluationId}`);
if (period) params.push(`period=${period}`);
if (schoolClassId) params.push(`school_class_id=${schoolClassId}`);
url += params.join('&');
return fetchWithAuth(url);
};
export const saveStudentEvaluations = (data, csrfToken) => {
return fetchWithAuth(`${BE_SCHOOL_STUDENT_EVALUATIONS_URL}/bulk`, {
method: 'PUT',
headers: { 'X-CSRFToken': csrfToken },
body: JSON.stringify(data),
});
};
export const updateStudentEvaluation = (id, data, csrfToken) => {
return fetchWithAuth(`${BE_SCHOOL_STUDENT_EVALUATIONS_URL}/${id}`, {
method: 'PUT',
headers: { 'X-CSRFToken': csrfToken },
body: JSON.stringify(data),
});
};
export const deleteStudentEvaluation = (id, csrfToken) => {
return fetchWithAuth(`${BE_SCHOOL_STUDENT_EVALUATIONS_URL}/${id}`, {
method: 'DELETE',
headers: { 'X-CSRFToken': csrfToken },
});
};