mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-04-06 13:11:25 +00:00
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:
@ -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 },
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user