fix: Ajout du mode Visu

This commit is contained in:
N3WT DE COMPET
2025-05-04 14:32:06 +02:00
parent 4ecf25a6ab
commit e1c607308c
29 changed files with 531 additions and 414 deletions

View File

@ -9,12 +9,12 @@ export default function ScheduleEventModal({
setEventData,
specialities,
teachers,
classes
classes,
}) {
const { addEvent, handleUpdateEvent, handleDeleteEvent, schedules } = usePlanning();
const { addEvent, handleUpdateEvent, handleDeleteEvent, schedules } =
usePlanning();
React.useEffect(() => {
if (!eventData?.planning && schedules.length > 0) {
const defaultSchedule = schedules[0];
if (eventData?.planning !== defaultSchedule.id) {
@ -26,9 +26,10 @@ export default function ScheduleEventModal({
}
}, [schedules, eventData?.planning]);
const handleSpecialityChange = (specialityId) => {
const selectedSpeciality = specialities.find((s) => s.id === parseInt(specialityId, 10));
const selectedSpeciality = specialities.find(
(s) => s.id === parseInt(specialityId, 10)
);
if (selectedSpeciality) {
setEventData((prev) => ({
...prev,
@ -40,7 +41,9 @@ export default function ScheduleEventModal({
};
const handleTeacherChange = (teacherId) => {
const selectedTeacher = teachers.find((t) => t.id === parseInt(teacherId, 10));
const selectedTeacher = teachers.find(
(t) => t.id === parseInt(teacherId, 10)
);
if (selectedTeacher) {
setEventData((prev) => ({
...prev,
@ -51,7 +54,9 @@ export default function ScheduleEventModal({
};
const handlePlanningChange = (planningId) => {
const selectedSchedule = schedules.find((s) => s.id === parseInt(planningId, 10));
const selectedSchedule = schedules.find(
(s) => s.id === parseInt(planningId, 10)
);
if (selectedSchedule) {
setEventData((prev) => ({
...prev,