mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
refactor: Changement des IconTextInput en TextInput, modification du composant step
This commit is contained in:
@ -39,7 +39,7 @@ export const ClassesProvider = ({ children }) => {
|
||||
{ id: 2, label: 'Semestriel' },
|
||||
{ id: 3, label: 'Trimestriel' },
|
||||
];
|
||||
|
||||
|
||||
const selectedDays = {
|
||||
1: 'lundi',
|
||||
2: 'mardi',
|
||||
@ -60,14 +60,14 @@ export const ClassesProvider = ({ children }) => {
|
||||
const getNiveauxTabs = (levels) => {
|
||||
// Trier les levels par id
|
||||
const sortedNiveaux = levels.sort((a, b) => a - b);
|
||||
|
||||
|
||||
// Mapper les labels correspondants
|
||||
return sortedNiveaux.map(niveauId => {
|
||||
const niveau = allNiveaux.find(n => n.id === niveauId);
|
||||
return niveau ? { id: niveau.id, title: niveau.name, icon: School } : { id: 'unknown', title: 'Niveau inconnu', icon: null };
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
const generateAgeToNiveaux = (minAge, maxAge) => {
|
||||
if (minAge === null || isNaN(minAge)) {
|
||||
@ -112,7 +112,7 @@ export const ClassesProvider = ({ children }) => {
|
||||
const updatePlannings = (formData, existingPlannings) => {
|
||||
return formData.levels.map(niveau => {
|
||||
let existingPlanning = existingPlannings.find(planning => planning.niveau === niveau);
|
||||
|
||||
|
||||
const emploiDuTemps = formData.opening_days.reduce((acc, dayId) => {
|
||||
const dayName = selectedDays[dayId];
|
||||
if (dayName) {
|
||||
@ -167,7 +167,7 @@ export const ClassesProvider = ({ children }) => {
|
||||
}
|
||||
|
||||
// Fusionner les plannings existants avec les nouvelles données
|
||||
return existingPlanning
|
||||
return existingPlanning
|
||||
? { ...existingPlanning, ...updatedPlanning }
|
||||
: updatedPlanning;
|
||||
});
|
||||
@ -176,17 +176,21 @@ export const ClassesProvider = ({ children }) => {
|
||||
const groupSpecialitiesBySubject = (teachers) => {
|
||||
const groupedSpecialities = {};
|
||||
|
||||
if (!teachers) return [];
|
||||
|
||||
teachers.forEach(teacher => {
|
||||
teacher.specialites.forEach(specialite => {
|
||||
if (!groupedSpecialities[specialite.id]) {
|
||||
groupedSpecialities[specialite.id] = {
|
||||
...specialite,
|
||||
teachers: [`${teacher.nom} ${teacher.prenom}`],
|
||||
};
|
||||
} else {
|
||||
groupedSpecialities[specialite.id].teachers.push(`${teacher.nom} ${teacher.prenom}`);
|
||||
}
|
||||
});
|
||||
if (teacher && teacher.specialites) {
|
||||
teacher.specialites.forEach(specialite => {
|
||||
if (!groupedSpecialities[specialite.id]) {
|
||||
groupedSpecialities[specialite.id] = {
|
||||
...specialite,
|
||||
teachers: [`${teacher.nom} ${teacher.prenom}`],
|
||||
};
|
||||
} else {
|
||||
groupedSpecialities[specialite.id].teachers.push(`${teacher.nom} ${teacher.prenom}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return Object.values(groupedSpecialities);
|
||||
@ -202,15 +206,15 @@ export const ClassesProvider = ({ children }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<ClassesContext.Provider value={{ schoolYears,
|
||||
getNiveauxLabels,
|
||||
getNiveauxTabs,
|
||||
generateAgeToNiveaux,
|
||||
niveauxPremierCycle,
|
||||
niveauxSecondCycle,
|
||||
niveauxTroisiemeCycle,
|
||||
typeEmploiDuTemps,
|
||||
updatePlannings,
|
||||
<ClassesContext.Provider value={{ schoolYears,
|
||||
getNiveauxLabels,
|
||||
getNiveauxTabs,
|
||||
generateAgeToNiveaux,
|
||||
niveauxPremierCycle,
|
||||
niveauxSecondCycle,
|
||||
niveauxTroisiemeCycle,
|
||||
typeEmploiDuTemps,
|
||||
updatePlannings,
|
||||
getAmbianceText,
|
||||
getAmbianceName,
|
||||
groupSpecialitiesBySubject,
|
||||
|
||||
Reference in New Issue
Block a user