refactor: refactoring du FRONT page subscribe

This commit is contained in:
Luc SORIGNET
2025-01-12 14:37:49 +01:00
parent 58fe509734
commit 427b6c7588
25 changed files with 671 additions and 652 deletions

View File

@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import SelectChoice from '@/components/SelectChoice';
import { useClasses } from '@/context/ClassesContext';
import { useClasseForm } from '@/context/ClasseFormContext';
import { BK_GESTIONENSEIGNANTS_PLANNING_URL } from '@/utils/Url';
import { BE_SCHOOL_PLANNING_URL } from '@/utils/Url';
import { BookOpen, Users } from 'lucide-react';
const SpecialityEventModal = ({ isOpen, onClose, selectedCell, existingEvent, handleUpdatePlanning, classe }) => {
@ -56,17 +56,17 @@ const SpecialityEventModal = ({ isOpen, onClose, selectedCell, existingEvent, ha
const handleSubmit = (e) => {
e.preventDefault();
if (!eventData.specialiteId) {
alert('Veuillez sélectionner une spécialité');
return;
}
if (!eventData.teacherId) {
alert('Veuillez sélectionner un enseignant');
return;
}
// Transformer eventData pour correspondre au format du planning
const selectedTeacherData = formData.enseignants.find(teacher => teacher.id === parseInt(eventData.teacherId, 10));
const newCourse = {
@ -114,14 +114,14 @@ const SpecialityEventModal = ({ isOpen, onClose, selectedCell, existingEvent, ha
const planningId = updatedPlanning ? updatedPlanning.planning.id : null;
console.log("id : ", planningId)
if (planningId) {
handleUpdatePlanning(BK_GESTIONENSEIGNANTS_PLANNING_URL, planningId, updatedPlanning.emploiDuTemps);
handleUpdatePlanning(BE_SCHOOL_PLANNING_URL, planningId, updatedPlanning.emploiDuTemps);
}
onClose();
};
const filteredTeachers = selectedSpeciality
? formData.enseignants.filter(teacher =>
const filteredTeachers = selectedSpeciality
? formData.enseignants.filter(teacher =>
teacher.specialites_ids.includes(parseInt(selectedSpeciality, 10))
)
: formData.enseignants;