feat: Ajout de la configuration des tarifs de l'école [#18]

This commit is contained in:
N3WT DE COMPET
2025-01-19 21:00:58 +01:00
committed by Luc SORIGNET
parent 147a70135d
commit 5a0e65bb75
45 changed files with 2089 additions and 376 deletions

View File

@ -0,0 +1,24 @@
import {
BE_GESTIONMESSAGERIE_MESSAGES_URL
} from '@/utils/Url';
const requestResponseHandler = async (response) => {
const body = await response.json();
if (response.ok) {
return body;
}
// Throw an error with the JSON body containing the form errors
const error = new Error('Form submission error');
error.details = body;
throw error;
}
export const fetchMessages = (id) =>{
return fetch(`${BE_GESTIONMESSAGERIE_MESSAGES_URL}/${id}`, {
headers: {
'Content-Type': 'application/json',
},
}).then(requestResponseHandler)
}

View File

@ -2,7 +2,10 @@ import {
BE_SCHOOL_SPECIALITIES_URL,
BE_SCHOOL_TEACHERS_URL,
BE_SCHOOL_SCHOOLCLASSES_URL,
BE_SCHOOL_PLANNINGS_URL
BE_SCHOOL_PLANNINGS_URL,
BE_SCHOOL_FEES_URL,
BE_SCHOOL_DISCOUNTS_URL,
BE_SCHOOL_TUITION_FEES_URL
} from '@/utils/Url';
const requestResponseHandler = async (response) => {
@ -36,4 +39,19 @@ export const fetchClasses = () => {
export const fetchSchedules = () => {
return fetch(`${BE_SCHOOL_PLANNINGS_URL}`)
.then(requestResponseHandler)
};
};
export const fetchDiscounts = () => {
return fetch(`${BE_SCHOOL_DISCOUNTS_URL}`)
.then(requestResponseHandler)
};
export const fetchFees = () => {
return fetch(`${BE_SCHOOL_FEES_URL}`)
.then(requestResponseHandler)
};
export const fetchTuitionFees = () => {
return fetch(`${BE_SCHOOL_TUITION_FEES_URL}`)
.then(requestResponseHandler)
};

View File

@ -7,7 +7,8 @@ import {
BE_SUBSCRIPTION_REGISTERFORM_URL,
BE_SUBSCRIPTION_REGISTERFORMS_URL,
BE_SUBSCRIPTION_REGISTRATIONFORMFILE_TEMPLATE_URL,
BE_SUBSCRIPTION_LAST_GUARDIAN_URL
BE_SUBSCRIPTION_LAST_GUARDIAN_URL,
BE_SUBSCRIPTION_REGISTRATIONFORMFILE_URL
} from '@/utils/Url';
export const PENDING = 'pending';
@ -110,6 +111,32 @@ export const fetchRegisterFormFileTemplate = () => {
return fetch(request).then(requestResponseHandler)
};
export const fetchRegisterFormFile = (id) => {
const request = new Request(
`${BE_SUBSCRIPTION_REGISTRATIONFORMFILE_URL}/${id}`,
{
method:'GET',
headers: {
'Content-Type':'application/json'
},
}
);
return fetch(request).then(requestResponseHandler)
};
export const createRegistrationFormFile = (data,csrfToken) => {
return fetch(`${BE_SUBSCRIPTION_REGISTRATIONFORMFILE_URL}`, {
method: 'POST',
body: data,
headers: {
'X-CSRFToken': csrfToken,
},
credentials: 'include',
})
.then(requestResponseHandler)
}
export const createRegistrationFormFileTemplate = (data,csrfToken) => {
return fetch(`${BE_SUBSCRIPTION_REGISTRATIONFORMFILE_TEMPLATE_URL}`, {
@ -132,6 +159,19 @@ export const deleteRegisterFormFileTemplate = (fileId,csrfToken) => {
credentials: 'include',
})
}
export const editRegistrationFormFileTemplate = (fileId, data, csrfToken) => {
return fetch(`${BE_SUBSCRIPTION_REGISTRATIONFORMFILE_TEMPLATE_URL}/${fileId}`, {
method: 'PUT',
body: data,
headers: {
'X-CSRFToken': csrfToken,
},
credentials: 'include',
})
.then(requestResponseHandler)
}
export const fetchStudents = () => {
const request = new Request(
`${BE_SUBSCRIPTION_STUDENTS_URL}`,