mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-04-03 16:51:26 +00:00
135 lines
3.8 KiB
JavaScript
135 lines
3.8 KiB
JavaScript
import {
|
|
BE_SCHOOL_SPECIALITIES_URL,
|
|
BE_SCHOOL_TEACHERS_URL,
|
|
BE_SCHOOL_SCHOOLCLASSES_URL,
|
|
BE_SCHOOL_PLANNINGS_URL,
|
|
BE_SCHOOL_FEES_URL,
|
|
BE_SCHOOL_DISCOUNTS_URL,
|
|
BE_SCHOOL_PAYMENT_PLANS_URL,
|
|
BE_SCHOOL_PAYMENT_MODES_URL,
|
|
BE_SCHOOL_ESTABLISHMENT_URL,
|
|
BE_SCHOOL_ESTABLISHMENT_COMPETENCIES_URL,
|
|
} from '@/utils/Url';
|
|
import { fetchWithAuth } from '@/utils/fetchWithAuth';
|
|
|
|
export const deleteEstablishmentCompetencies = (ids, csrfToken) => {
|
|
return fetchWithAuth(BE_SCHOOL_ESTABLISHMENT_COMPETENCIES_URL, {
|
|
method: 'DELETE',
|
|
headers: { 'X-CSRFToken': csrfToken },
|
|
body: JSON.stringify({ ids }),
|
|
});
|
|
};
|
|
|
|
export const createEstablishmentCompetencies = (newData, csrfToken) => {
|
|
return fetchWithAuth(BE_SCHOOL_ESTABLISHMENT_COMPETENCIES_URL, {
|
|
method: 'POST',
|
|
headers: { 'X-CSRFToken': csrfToken },
|
|
body: JSON.stringify(newData),
|
|
});
|
|
};
|
|
|
|
export const fetchEstablishmentCompetencies = (establishment, cycle = 1) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_ESTABLISHMENT_COMPETENCIES_URL}?establishment_id=${establishment}&cycle=${cycle}`
|
|
);
|
|
};
|
|
|
|
export const fetchSpecialities = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_SPECIALITIES_URL}?establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchTeachers = (establishment) => {
|
|
return fetchWithAuth(`${BE_SCHOOL_TEACHERS_URL}?establishment_id=${establishment}`);
|
|
};
|
|
|
|
export const fetchClasses = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_SCHOOLCLASSES_URL}?establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchClasse = (id) => {
|
|
return fetchWithAuth(`${BE_SCHOOL_SCHOOLCLASSES_URL}/${id}`);
|
|
};
|
|
|
|
export const fetchSchedules = () => {
|
|
return fetchWithAuth(`${BE_SCHOOL_PLANNINGS_URL}`);
|
|
};
|
|
|
|
export const fetchRegistrationDiscounts = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_DISCOUNTS_URL}?filter=registration&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchTuitionDiscounts = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_DISCOUNTS_URL}?filter=tuition&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchRegistrationFees = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_FEES_URL}?filter=registration&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchTuitionFees = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_FEES_URL}?filter=tuition&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchRegistrationPaymentPlans = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_PAYMENT_PLANS_URL}?filter=registration&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchTuitionPaymentPlans = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_PAYMENT_PLANS_URL}?filter=tuition&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchRegistrationPaymentModes = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_PAYMENT_MODES_URL}?filter=registration&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchTuitionPaymentModes = (establishment) => {
|
|
return fetchWithAuth(
|
|
`${BE_SCHOOL_PAYMENT_MODES_URL}?filter=tuition&establishment_id=${establishment}`
|
|
);
|
|
};
|
|
|
|
export const fetchEstablishment = (establishment) => {
|
|
return fetchWithAuth(`${BE_SCHOOL_ESTABLISHMENT_URL}/${establishment}`);
|
|
};
|
|
|
|
export const createDatas = (url, newData, csrfToken) => {
|
|
return fetchWithAuth(url, {
|
|
method: 'POST',
|
|
headers: { 'X-CSRFToken': csrfToken },
|
|
body: JSON.stringify(newData),
|
|
});
|
|
};
|
|
|
|
export const updateDatas = (url, id, updatedData, csrfToken) => {
|
|
return fetchWithAuth(`${url}/${id}`, {
|
|
method: 'PUT',
|
|
headers: { 'X-CSRFToken': csrfToken },
|
|
body: JSON.stringify(updatedData),
|
|
});
|
|
};
|
|
|
|
export const removeDatas = (url, id, csrfToken) => {
|
|
return fetchWithAuth(`${url}/${id}`, {
|
|
method: 'DELETE',
|
|
headers: { 'X-CSRFToken': csrfToken },
|
|
});
|
|
};
|