diff --git a/Front-End/src/app/[locale]/admin/layout.js b/Front-End/src/app/[locale]/admin/layout.js
index b30edd1..c35aac9 100644
--- a/Front-End/src/app/[locale]/admin/layout.js
+++ b/Front-End/src/app/[locale]/admin/layout.js
@@ -16,15 +16,15 @@ import {
import DropdownMenu from '@/components/DropdownMenu';
import Logo from '@/components/Logo';
import {
- FR_ADMIN_HOME_URL,
- FR_ADMIN_SUBSCRIPTIONS_URL,
- FR_ADMIN_STRUCTURE_URL,
- FR_ADMIN_GRADES_URL,
- FR_ADMIN_PLANNING_URL,
- FR_ADMIN_SETTINGS_URL
+ FE_ADMIN_HOME_URL,
+ FE_ADMIN_SUBSCRIPTIONS_URL,
+ FE_ADMIN_STRUCTURE_URL,
+ FE_ADMIN_GRADES_URL,
+ FE_ADMIN_PLANNING_URL,
+ FE_ADMIN_SETTINGS_URL
} from '@/utils/Url';
-import { disconnect } from '@/app/lib/actions';
+import { disconnect } from '@/app/lib/authAction';
export default function Layout({
children,
@@ -32,12 +32,12 @@ export default function Layout({
const t = useTranslations('sidebar');
const sidebarItems = {
- "admin": { "id": "admin", "name": t('dashboard'), "url": FR_ADMIN_HOME_URL, "icon": Home },
- "subscriptions": { "id": "subscriptions", "name": t('subscriptions'), "url": FR_ADMIN_SUBSCRIPTIONS_URL, "icon": Users },
- "structure": { "id": "structure", "name": t('structure'), "url": FR_ADMIN_STRUCTURE_URL, "icon": Building },
- "grades": { "id": "grades", "name": t('grades'), "url": FR_ADMIN_GRADES_URL, "icon": FileText },
- "planning": { "id": "planning", "name": t('planning'), "url": FR_ADMIN_PLANNING_URL, "icon": Calendar },
- "settings": { "id": "settings", "name": t('settings'), "url": FR_ADMIN_SETTINGS_URL, "icon": Settings }
+ "admin": { "id": "admin", "name": t('dashboard'), "url": FE_ADMIN_HOME_URL, "icon": Home },
+ "subscriptions": { "id": "subscriptions", "name": t('subscriptions'), "url": FE_ADMIN_SUBSCRIPTIONS_URL, "icon": Users },
+ "structure": { "id": "structure", "name": t('structure'), "url": FE_ADMIN_STRUCTURE_URL, "icon": Building },
+ "grades": { "id": "grades", "name": t('grades'), "url": FE_ADMIN_GRADES_URL, "icon": FileText },
+ "planning": { "id": "planning", "name": t('planning'), "url": FE_ADMIN_PLANNING_URL, "icon": Calendar },
+ "settings": { "id": "settings", "name": t('settings'), "url": FE_ADMIN_SETTINGS_URL, "icon": Settings }
};
const pathname = usePathname();
diff --git a/Front-End/src/app/[locale]/admin/page.js b/Front-End/src/app/[locale]/admin/page.js
index 85e18fa..0a1f2f3 100644
--- a/Front-End/src/app/[locale]/admin/page.js
+++ b/Front-End/src/app/[locale]/admin/page.js
@@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react';
import { useTranslations } from 'next-intl';
import { Users, Clock, CalendarCheck, School, TrendingUp, UserCheck } from 'lucide-react';
import Loader from '@/components/Loader';
-import { BK_GESTIONENSEIGNANTS_CLASSES_URL } from '@/utils/Url';
+import { BE_SCHOOL_SCHOOLCLASSES_URL } from '@/utils/Url';
import ClasseDetails from '@/components/ClasseDetails';
// Composant StatCard pour afficher une statistique
@@ -59,7 +59,7 @@ export default function DashboardPage() {
const [classes, setClasses] = useState([]);
const fetchClasses = () => {
- fetch(`${BK_GESTIONENSEIGNANTS_CLASSES_URL}`)
+ fetch(`${BE_SCHOOL_SCHOOLCLASSES_URL}`)
.then(response => response.json())
.then(data => {
setClasses(data);
diff --git a/Front-End/src/app/[locale]/admin/structure/page.js b/Front-End/src/app/[locale]/admin/structure/page.js
index 06ec2f1..7ae7b2f 100644
--- a/Front-End/src/app/[locale]/admin/structure/page.js
+++ b/Front-End/src/app/[locale]/admin/structure/page.js
@@ -4,10 +4,10 @@ import { School, Calendar } from 'lucide-react';
import TabsStructure from '@/components/Structure/Configuration/TabsStructure';
import ScheduleManagement from '@/components/Structure/Planning/ScheduleManagement'
import StructureManagement from '@/components/Structure/Configuration/StructureManagement'
-import { BK_GESTIONENSEIGNANTS_SPECIALITES_URL,
- BK_GESTIONENSEIGNANTS_CLASSES_URL,
- BK_GESTIONENSEIGNANTS_TEACHERS_URL,
- BK_GESTIONENSEIGNANTS_PLANNINGS_URL } from '@/utils/Url';
+import { BE_SCHOOL_SPECIALITIES_URL,
+ BE_SCHOOL_SCHOOLCLASSES_URL,
+ BE_SCHOOL_TEACHERS_URL,
+ BE_SCHOOL_PLANNINGS_URL } from '@/utils/Url';
import DjangoCSRFToken from '@/components/DjangoCSRFToken'
import useCsrfToken from '@/hooks/useCsrfToken';
import { ClassesProvider } from '@/context/ClassesContext';
@@ -34,13 +34,13 @@ export default function Page() {
// Fetch data for classes
fetchClasses();
-
+
// Fetch data for schedules
fetchSchedules();
}, []);
const fetchSpecialities = () => {
- fetch(`${BK_GESTIONENSEIGNANTS_SPECIALITES_URL}`)
+ fetch(`${BE_SCHOOL_SPECIALITIES_URL}`)
.then(response => response.json())
.then(data => {
setSpecialities(data);
@@ -51,7 +51,7 @@ export default function Page() {
};
const fetchTeachers = () => {
- fetch(`${BK_GESTIONENSEIGNANTS_TEACHERS_URL}`)
+ fetch(`${BE_SCHOOL_TEACHERS_URL}`)
.then(response => response.json())
.then(data => {
setTeachers(data);
@@ -62,7 +62,7 @@ export default function Page() {
};
const fetchClasses = () => {
- fetch(`${BK_GESTIONENSEIGNANTS_CLASSES_URL}`)
+ fetch(`${BE_SCHOOL_SCHOOLCLASSES_URL}`)
.then(response => response.json())
.then(data => {
setClasses(data);
@@ -73,7 +73,7 @@ export default function Page() {
};
const fetchSchedules = () => {
- fetch(`${BK_GESTIONENSEIGNANTS_PLANNINGS_URL}`)
+ fetch(`${BE_SCHOOL_PLANNINGS_URL}`)
.then(response => response.json())
.then(data => {
setSchedules(data);
@@ -141,13 +141,13 @@ export default function Page() {
console.error('Erreur :', error);
});
};
-
+
const handleDelete = (url, id, setDatas) => {
fetch(`${url}/${id}`, {
method:'DELETE',
headers: {
- 'Content-Type':'application/json',
+ 'Content-Type':'application/json',
'X-CSRFToken': csrfToken
},
credentials: 'include'
@@ -172,12 +172,12 @@ export default function Page() {
{activeTab === 'Configuration' && (
<>
-
+ />
)}
diff --git a/Front-End/src/app/[locale]/admin/subscriptions/components/FileUpload.js b/Front-End/src/app/[locale]/admin/subscriptions/components/FileUpload.js
index beab467..db1c60b 100644
--- a/Front-End/src/app/[locale]/admin/subscriptions/components/FileUpload.js
+++ b/Front-End/src/app/[locale]/admin/subscriptions/components/FileUpload.js
@@ -34,11 +34,11 @@ export default function FileUpload({ onFileUpload }) {
};
const handleUpload = () => {
- if (file) {
+
onFileUpload(file, fileName);
setFile(null);
setFileName('');
- }
+
};
return (
@@ -66,8 +66,8 @@ export default function FileUpload({ onFileUpload }) {
/>
diff --git a/Front-End/src/app/[locale]/admin/subscriptions/editInscription/page.js b/Front-End/src/app/[locale]/admin/subscriptions/editInscription/page.js
index 1149b3b..4f2eaa5 100644
--- a/Front-End/src/app/[locale]/admin/subscriptions/editInscription/page.js
+++ b/Front-End/src/app/[locale]/admin/subscriptions/editInscription/page.js
@@ -2,9 +2,9 @@
import React, { useState, useEffect } from 'react';
import { useSearchParams } from 'next/navigation';
import InscriptionFormShared from '@/components/Inscription/InscriptionFormShared';
-import { FR_ADMIN_SUBSCRIPTIONS_URL,
- BK_GESTIONINSCRIPTION_ELEVE_URL,
- BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL } from '@/utils/Url';
+import { FE_ADMIN_SUBSCRIPTIONS_URL,
+ BE_SUBSCRIPTION_STUDENT_URL,
+ BE_SUBSCRIPTION_REGISTERFORM_URL } from '@/utils/Url';
import useCsrfToken from '@/hooks/useCsrfToken';
import { mockStudent } from '@/data/mockStudent';
@@ -13,7 +13,7 @@ const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
export default function Page() {
const searchParams = useSearchParams();
const idProfil = searchParams.get('id');
- const idEleve = searchParams.get('idEleve'); // Changé de codeDI à idEleve
+ const studentId = searchParams.get('studentId'); // Changé de codeDI à studentId
const [initialData, setInitialData] = useState(null);
const [isLoading, setIsLoading] = useState(true);
@@ -24,7 +24,7 @@ export default function Page() {
setInitialData(mockStudent);
setIsLoading(false);
} else {
- fetch(`${BK_GESTIONINSCRIPTION_ELEVE_URL}/${idEleve}`) // Utilisation de idEleve au lieu de codeDI
+ fetch(`${BE_SUBSCRIPTION_STUDENT_URL}/${studentId}`) // Utilisation de studentId au lieu de codeDI
.then(response => response.json())
.then(data => {
console.log('Fetched data:', data); // Pour le débogage
@@ -49,7 +49,7 @@ export default function Page() {
setIsLoading(false);
});
}
- }, [idEleve]); // Dépendance changée à idEleve
+ }, [studentId]); // Dépendance changée à studentId
const handleSubmit = async (data) => {
if (useFakeData) {
@@ -58,7 +58,7 @@ export default function Page() {
}
try {
- const response = await fetch(`${BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL}/${idEleve}`, { // Utilisation de idEleve
+ const response = await fetch(`${BE_SUBSCRIPTION_REGISTERFORM_URL}/${studentId}`, { // Utilisation de studentId
method: 'PUT',
headers: {
'Content-Type': 'application/json',
@@ -72,7 +72,7 @@ export default function Page() {
const result = await response.json();
console.log('Success:', result);
// Redirection après succès
- window.location.href = FR_ADMIN_SUBSCRIPTIONS_URL;
+ window.location.href = FE_ADMIN_SUBSCRIPTIONS_URL;
} catch (error) {
console.error('Error:', error);
alert('Une erreur est survenue lors de la mise à jour des données');
@@ -84,7 +84,7 @@ export default function Page() {
initialData={initialData}
csrfToken={csrfToken}
onSubmit={handleSubmit}
- cancelUrl={FR_ADMIN_SUBSCRIPTIONS_URL}
+ cancelUrl={FE_ADMIN_SUBSCRIPTIONS_URL}
isLoading={isLoading}
/>
);
diff --git a/Front-End/src/app/[locale]/admin/subscriptions/page.js b/Front-End/src/app/[locale]/admin/subscriptions/page.js
index cc94eec..67e3a13 100644
--- a/Front-End/src/app/[locale]/admin/subscriptions/page.js
+++ b/Front-End/src/app/[locale]/admin/subscriptions/page.js
@@ -9,25 +9,33 @@ import { Search } from 'lucide-react';
import Popup from '@/components/Popup';
import Loader from '@/components/Loader';
import AlertWithModal from '@/components/AlertWithModal';
-import Button from '@/components/Button';
import DropdownMenu from "@/components/DropdownMenu";
-import { swapFormatDate } from '@/utils/Date';
import { formatPhoneNumber } from '@/utils/Telephone';
-import { MoreVertical, Send, Edit, Trash2, FileText, ChevronUp, UserPlus, CheckCircle, Plus, Download } from 'lucide-react';
+import { MoreVertical, Send, Edit, Trash2, FileText, CheckCircle, Plus, Download } from 'lucide-react';
import Modal from '@/components/Modal';
import InscriptionForm from '@/components/Inscription/InscriptionForm'
import AffectationClasseForm from '@/components/AffectationClasseForm'
import FileUpload from './components/FileUpload';
-import { BASE_URL, BK_GESTIONINSCRIPTION_FICHESINSCRIPTION_URL,
- BK_GESTIONINSCRIPTION_SEND_URL,
- FR_ADMIN_SUBSCRIPTIONS_EDIT_URL,
- BK_GESTIONINSCRIPTION_ARCHIVE_URL,
- BK_GESTIONENSEIGNANTS_CLASSES_URL,
- BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL,
- BK_GESTIONINSCRIPTION_FICHERSINSCRIPTION_URL ,
- BK_GESTIONINSCRIPTION_ELEVES_URL,
- BK_PROFILE_URL } from '@/utils/Url';
+import {
+ PENDING,
+ SUBSCRIBED,
+ ARCHIVED,
+ fetchRegisterForm,
+ createRegisterForm,
+ sendRegisterForm,
+ archiveRegisterForm,
+ fetchRegisterFormFileTemplate,
+ deleteRegisterFormFileTemplate,
+ fetchStudents,
+ editRegisterForm } from "@/app/lib/subscriptionAction"
+
+import { fetchClasses } from '@/app/lib/schoolAction';
+import { createProfile } from '@/app/lib/authAction';
+
+import {
+ BASE_URL,
+ FE_ADMIN_SUBSCRIPTIONS_EDIT_URL } from '@/utils/Url';
import DjangoCSRFToken from '@/components/DjangoCSRFToken'
import useCsrfToken from '@/hooks/useCsrfToken';
@@ -56,14 +64,13 @@ export default function Page({ params: { locale } }) {
const [itemsPerPage, setItemsPerPage] = useState(5); // Définir le nombre d'éléments par page
const [fichiers, setFichiers] = useState([]);
- const [nomFichier, setNomFichier] = useState('');
- const [fichier, setFichier] = useState(null);
+
const [isOpen, setIsOpen] = useState(false);
const [isOpenAffectationClasse, setIsOpenAffectationClasse] = useState(false);
- const [eleve, setEleve] = useState('');
+ const [student, setStudent] = useState('');
const [classes, setClasses] = useState([]);
- const [eleves, setEleves] = useState([]);
+ const [students, setEleves] = useState([]);
const csrfToken = useCsrfToken();
@@ -77,152 +84,90 @@ export default function Page({ params: { locale } }) {
const openModalAssociationEleve = (eleveSelected) => {
setIsOpenAffectationClasse(true);
- setEleve(eleveSelected);
+ setStudent(eleveSelected);
}
- // Modifier la fonction fetchData pour inclure le terme de recherche
- const fetchData = (page, pageSize, search = '') => {
- const url = `${BK_GESTIONINSCRIPTION_FICHESINSCRIPTION_URL}/pending?page=${page}&page_size=${pageSize}&search=${search}`;
- fetch(url, {
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(response => response.json())
- .then(data => {
- setIsLoading(false);
- if (data) {
- const { fichesInscriptions, count } = data;
- if (ficheInscriptions) {
- setFichesInscriptionsDataEnCours(fichesInscriptions);
- }
- const calculatedTotalPages = count === 0 ? 1 : Math.ceil(count / pageSize);
- setTotalPending(count);
- setTotalPages(calculatedTotalPages);
- }
- console.log('Success PENDING:', data);
- })
- .catch(error => {
- console.error('Error fetching data:', error);
- setIsLoading(false);
- });
- };
- const fetchDataSubscribed = () => {
- fetch(`${BK_GESTIONINSCRIPTION_FICHESINSCRIPTION_URL}/subscribed`, {
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(response => response.json())
- .then(data => {
- setIsLoading(false);
- if (data) {
- const { fichesInscriptions, count } = data;
- setTotalSubscribed(count);
- if (fichesInscriptions) {
- setFichesInscriptionsDataInscrits(fichesInscriptions);
- }
- }
- console.log('Success SUBSCRIBED:', data);
- })
- .catch(error => {
- console.error('Error fetching data:', error);
- setIsLoading(false);
- });
- };
+ const requestErrorHandler = (err)=>{
+ setIsLoading(false);
+ }
- const fetchDataArchived = () => {
- fetch(`${BK_GESTIONINSCRIPTION_FICHESINSCRIPTION_URL}/archived`, {
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(response => response.json())
- .then(data => {
- setIsLoading(false);
- if (data) {
- const { fichesInscriptions, count } = data;
- setTotalArchives(count);
- if (fichesInscriptions) {
- setFichesInscriptionsDataArchivees(fichesInscriptions);
- }
- }
- console.log('Success ARCHIVED:', data);
- })
- .catch(error => {
- console.error('Error fetching data:', error);
- setIsLoading(false);
- });
- };
+ const registerFormPendingDataHandler = (data) => {
+ setIsLoading(false);
+ if (data) {
+ const { registerForms, count } = data;
+ if (registerForms) {
+ setFichesInscriptionsDataEnCours(registerForms);
+ }
+ const calculatedTotalPages = count === 0 ? 1 : Math.ceil(count / pageSize);
+ setTotalPending(count);
+ setTotalPages(calculatedTotalPages);
+ }
+ }
- const fetchClasses = () => {
- fetch(`${BK_GESTIONENSEIGNANTS_CLASSES_URL}`)
- .then(response => response.json())
- .then(data => {
+ const registerFormSubscribedDataHandler = (data) => {
+ setIsLoading(false);
+ if (data) {
+ const { registerForms, count } = data;
+ setTotalSubscribed(count);
+ if (registerForms) {
+ setFichesInscriptionsDataInscrits(registerForms);
+ }
+ }
+ }
+
+const registerFormArchivedDataHandler = (data) => {
+ setIsLoading(false);
+ if (data) {
+ const { registerForms, count } = data;
+ setTotalArchives(count);
+ if (registerForms) {
+ setFichesInscriptionsDataArchivees(registerForms);
+ }
+ }
+}
+
+
+
+
+ useEffect(() => {
+ fetchRegisterFormFileTemplate()
+ .then((data)=> {setFichiers(data)})
+ .catch((err)=>{ err = err.message; console.log(err);});
+ }, []);
+
+ useEffect(() => {
+ fetchClasses()
+ .then(data => {
setClasses(data);
console.log("Success CLASSES : ", data)
})
.catch(error => {
console.error('Error fetching classes:', error);
});
- };
-
- const fetchStudents = () => {
- const request = new Request(
- `${BK_GESTIONINSCRIPTION_ELEVES_URL}`,
- {
- method:'GET',
- headers: {
- 'Content-Type':'application/json'
- },
- }
- );
- fetch(request).then(response => response.json())
- .then(data => {
- console.log('Success STUDENTS:', data);
- setEleves(data);
- })
- .catch(error => {
- console.error('Error fetching data:', error);
- error = error.message;
- console.log(error);
+ fetchStudents()
+ .then(data => {
+ console.log('Success STUDENTS:', data);
+ setEleves(data);
+ })
+ .catch(error => {
+ console.error('Error fetching data:', error);
+ error = error.message;
+ console.log(error);
});
- };
-
- useEffect(() => {
- const fetchFichiers = () => {
- const request = new Request(
- `${BK_GESTIONINSCRIPTION_FICHERSINSCRIPTION_URL}`,
- {
- method:'GET',
- headers: {
- 'Content-Type':'application/json'
- },
- }
- );
- fetch(request).then(response => response.json())
- .then(data => {
- console.log('Success FILES:', data);
- setFichiers(data);
- })
- .catch(error => {
- console.error('Error fetching data:', error);
- error = error.message;
- console.log(error);
- });
-
- };
-
- fetchFichiers();
- }, []);
- useEffect(() => {
- fetchClasses();
- fetchStudents();
}, [fichesInscriptionsDataEnCours]);
useEffect(() => {
const fetchDataAndSetState = () => {
if (!useFakeData) {
- fetchData(currentPage, itemsPerPage, searchTerm);
- fetchDataSubscribed();
- fetchDataArchived();
+ fetchRegisterForm(PENDING, currentPage, itemsPerPage, searchTerm)
+ .then(registerFormPendingDataHandler)
+ .catch(requestErrorHandler)
+ fetchRegisterForm(SUBSCRIBED)
+ .then(registerFormSubscribedDataHandler)
+ .catch(requestErrorHandler)
+ fetchRegisterForm(ARCHIVED)
+ .then(registerFormArchivedDataHandler)
+ .catch(requestErrorHandler)
} else {
setTimeout(() => {
setFichesInscriptionsDataEnCours(mockFicheInscription);
@@ -239,7 +184,9 @@ export default function Page({ params: { locale } }) {
// Modifier le useEffect pour la recherche
useEffect(() => {
const timeoutId = setTimeout(() => {
- fetchData(currentPage, itemsPerPage, searchTerm);
+ fetchRegisterForm(PENDING, currentPage, itemsPerPage, searchTerm)
+ .then(registerFormPendingDataHandler)
+ .catch(requestErrorHandler)
}, 500); // Debounce la recherche
return () => clearTimeout(timeoutId);
@@ -250,13 +197,7 @@ export default function Page({ params: { locale } }) {
visible: true,
message: `Attentions ! \nVous êtes sur le point d'archiver le dossier d'inscription de ${nom} ${prenom}\nÊtes-vous sûr(e) de vouloir poursuivre l'opération ?`,
onConfirm: () => {
- const url = `${BK_GESTIONINSCRIPTION_ARCHIVE_URL}/${id}`;
- fetch(url, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(response => response.json())
+ archiveRegisterForm(id)
.then(data => {
console.log('Success:', data);
setFicheInscriptions(ficheInscriptions.filter(fiche => fiche.id !== id));
@@ -271,18 +212,12 @@ export default function Page({ params: { locale } }) {
});
};
- const sendConfirmFicheInscription = (id, nom, prenom) => {
+ const sendConfirmRegisterForm = (id, nom, prenom) => {
setPopup({
visible: true,
message: `Avertissement ! \nVous êtes sur le point d'envoyer un dossier d'inscription à ${nom} ${prenom}\nÊtes-vous sûr(e) de vouloir poursuivre l'opération ?`,
onConfirm: () => {
- const url = `${BK_GESTIONINSCRIPTION_SEND_URL}/${id}`;
- fetch(url, {
- headers: {
- 'Content-Type': 'application/json',
- },
- }).then(response => response.json())
- .then(data => {
+ sendRegisterForm(id).then(data => {
console.log('Success:', data);
setMailSent(true);
})
@@ -292,15 +227,19 @@ export default function Page({ params: { locale } }) {
}
});
};
-
+ const affectationClassFormSubmitHandler = (formdata)=> {
+ editRegisterForm(student.id,formData, csrfToken)
+ .then(data => {
+ console.log('Success:', data);
+ })
+ .catch(error => {
+ console.error('Error :', error);
+ });
+ }
const updateStatusAction = (id, newStatus) => {
console.log('Edit fiche inscription with id:', id);
};
- const handleLetterClick = (letter) => {
- setFilter(letter);
- };
-
const handleSearchChange = (event) => {
setSearchTerm(event.target.value);
};
@@ -310,28 +249,20 @@ export default function Page({ params: { locale } }) {
fetchData(newPage, itemsPerPage); // Appeler fetchData directement ici
};
- const createDI = (updatedData) => {
- if (updatedData.selectedResponsables.length !== 0) {
- const selectedResponsablesIds = updatedData.selectedResponsables.map(responsableId => responsableId)
+ const createRF = (updatedData) => {
+ console.log("updateDATA",updatedData);
+ if (updatedData.selectedGuardians.length !== 0) {
+ const selectedGuardiansIds = updatedData.selectedGuardians.map(guardianId => guardianId)
const data = {
- eleve: {
- nom: updatedData.eleveNom,
- prenom: updatedData.elevePrenom,
+ student: {
+ last_name: updatedData.studentLastName,
+ first_name: updatedData.studentFirstName,
},
- idResponsables: selectedResponsablesIds
+ idGuardians: selectedGuardiansIds
};
- const url = `${BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL}`;
- fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'X-CSRFToken': csrfToken
- },
- body: JSON.stringify(data),
- credentials: 'include'
- })
+ createRegisterForm(data,csrfToken)
.then(response => response.json())
.then(data => {
console.log('Success:', data);
@@ -343,7 +274,7 @@ export default function Page({ params: { locale } }) {
});
setTotalPending(totalPending+1);
if (updatedData.autoMail) {
- sendConfirmFicheInscription(data.eleve.id, updatedData.eleveNom, updatedData.elevePrenom);
+ sendConfirmRegisterForm(data.student.id, updatedData.studentLastName, updatedData.studentFirstName);
}
})
.catch((error) => {
@@ -353,55 +284,35 @@ export default function Page({ params: { locale } }) {
else {
// Création d'un profil associé à l'adresse mail du responsable saisie
// Le profil est inactif
- const request = new Request(
- `${BK_PROFILE_URL}`,
- {
- method:'POST',
- headers: {
- 'Content-Type':'application/json',
- 'X-CSRFToken': csrfToken
- },
- credentials: 'include',
- body: JSON.stringify( {
- email: updatedData.responsableEmail,
- password: 'Provisoire01!',
- username: updatedData.responsableEmail,
- is_active: 0, // On rend le profil inactif : impossible de s'y connecter dans la fenêtre du login tant qu'il ne s'est pas inscrit
- droit:2 // Profil PARENT
- }),
- }
- );
- fetch(request).then(response => response.json())
+ const data = {
+ email: updatedData.guardianEmail,
+ password: 'Provisoire01!',
+ username: updatedData.guardianEmail,
+ is_active: 0, // On rend le profil inactif : impossible de s'y connecter dans la fenêtre du login tant qu'il ne s'est pas inscrit
+ droit:2 // Profil PARENT
+ }
+ createProfile(data,csrfToken)
.then(response => {
console.log('Success:', response);
if (response.id) {
- let idProfil = response.id;
+ let idProfile = response.id;
const data = {
- eleve: {
- nom: updatedData.eleveNom,
- prenom: updatedData.elevePrenom,
- responsables: [
+ student: {
+ last_name: updatedData.studentLastName,
+ first_name: updatedData.studentFirstName,
+ guardians: [
{
- mail: updatedData.responsableEmail,
- telephone: updatedData.responsableTel,
- profilAssocie: idProfil // Association entre le reponsable de l'élève et le profil créé par défaut précédemment
+ email: updatedData.guardianEmail,
+ phone: updatedData.guardianPhone,
+ associated_profile: idProfile // Association entre le responsable de l'élève et le profil créé par défaut précédemment
}
],
- freres: []
+ sibling: []
}
};
- const url = `${BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL}`;
- fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- 'X-CSRFToken': csrfToken
- },
- body: JSON.stringify(data),
- credentials: 'include'
- })
- .then(response => response.json())
+
+ createRegisterForm(data,csrfToken)
.then(data => {
console.log('Success:', data);
setFichesInscriptionsDataEnCours(prevState => {
@@ -412,7 +323,7 @@ export default function Page({ params: { locale } }) {
});
setTotalPending(totalPending+1);
if (updatedData.autoMail) {
- sendConfirmFicheInscription(data.eleve.id, updatedData.eleveNom, updatedData.elevePrenom);
+ sendConfirmRegisterForm(data.student.id, updatedData.studentLastName, updatedData.studentFirstName);
}
})
.catch((error) => {
@@ -429,42 +340,26 @@ export default function Page({ params: { locale } }) {
closeModal();
}
- const validateAndAssociate = (updatedData) => {
- fetch(`${BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL}/${eleve.id}`, {
- method: 'PUT',
- headers: {
- 'Content-Type': 'application/json',
- 'X-CSRFToken': csrfToken
- },
- body: JSON.stringify(updatedData),
- credentials: 'include'
- })
- .then(response => response.json())
- .then(data => {
- console.log('Succès :', data);
- })
- .catch(error => {
- console.error('Erreur :', error);
- });
- }
+
const columns = [
- { name: t('studentName'), transform: (row) => row.eleve.nom },
- { name: t('studentFistName'), transform: (row) => row.eleve.prenom },
- { name: t('mainContactMail'), transform: (row) => row.eleve.responsables[0].mail },
- { name: t('phone'), transform: (row) => formatPhoneNumber(row.eleve.responsables[0].telephone) },
- { name: t('lastUpdateDate'), transform: (row) => row.dateMAJ_formattee},
+ { name: t('studentName'), transform: (row) => row.student.last_name },
+ { name: t('studentFistName'), transform: (row) => row.student.first_name },
+ { name: t('mainContactMail'), transform: (row) => row.student.guardians[0].email },
+ { name: t('phone'), transform: (row) => formatPhoneNumber(row.student.guardians[0].phone) },
+ { name: t('lastUpdateDate'), transform: (row) => row.formatted_last_update},
{ name: t('registrationFileStatus'), transform: (row) => (
- updateStatusAction(row.eleve.id, newStatus)} showDropdown={false} />
+ updateStatusAction(row.student.id, newStatus)} showDropdown={false} />
)
},
- { name: t('files'), transform: (row) => (
+ { name: t('files'), transform: (row) =>
+ (row.registerForms != null) &&(
) },
@@ -472,53 +367,53 @@ const columns = [
}
items={[
- ...(row.etat === 1 ? [{
+ ...(row.status === 1 ? [{
label: (
<>
Envoyer
>
),
- onClick: () => sendConfirmFicheInscription(row.eleve.id, row.eleve.nom, row.eleve.prenom),
+ onClick: () => sendConfirmRegisterForm(row.student.id, row.student.last_name, row.student.first_name),
}] : []),
- ...(row.etat === 1 ? [{
+ ...(row.status === 1 ? [{
label: (
<>
Modifier
>
),
- onClick: () => window.location.href = `${FR_ADMIN_SUBSCRIPTIONS_EDIT_URL}?idEleve=${row.eleve.id}&id=1`,
+ onClick: () => window.location.href = `${FE_ADMIN_SUBSCRIPTIONS_EDIT_URL}?studentId=${row.student.id}&id=1`,
}] : []),
- ...(row.etat === 2 ? [{
+ ...(row.status === 2 ? [{
label: (
<>
Modifier
>
),
- onClick: () => window.location.href = `${FR_ADMIN_SUBSCRIPTIONS_EDIT_URL}?idEleve=${row.eleve.id}&id=1`,
+ onClick: () => window.location.href = `${FE_ADMIN_SUBSCRIPTIONS_EDIT_URL}?studentId=${row.student.id}&id=1`,
}] : []),
- ...(row.etat === 3 ? [{
+ ...(row.status === 3 ? [{
label: (
<>
Valider
>
),
- onClick: () => openModalAssociationEleve(row.eleve),
+ onClick: () => openModalAssociationEleve(row.student),
}] : []),
- ...(row.etat === 5 ? [{
+ ...(row.status === 5 ? [{
label: (
<>
Rattacher
>
),
- onClick: () => openModalAssociationEleve(row.eleve),
+ onClick: () => openModalAssociationEleve(row.student),
}] : []),
- ...(row.etat !== 6 ? [{
+ ...(row.status !== 6 ? [{
label: (
<>
Archiver
>
),
- onClick: () => archiveFicheInscription(row.eleve.id, row.eleve.nom, row.eleve.prenom),
+ onClick: () => archiveFicheInscription(row.student.id, row.student.last_name, row.student.first_name),
}] : []),
]}
buttonClassName="text-gray-400 hover:text-gray-600"
@@ -529,22 +424,23 @@ const columns = [
];
const columnsSubscribed = [
- { name: t('studentName'), transform: (row) => row.eleve.nom },
- { name: t('studentFistName'), transform: (row) => row.eleve.prenom },
- { name: t('lastUpdateDate'), transform: (row) => row.dateMAJ_formattee},
- { name: t('class'), transform: (row) => row.eleve.classeAssocieeName},
- { name: t('registrationFileStatus'), transform: (row) => (
-
- updateStatusAction(row.eleve.id, newStatus)} showDropdown={false} />
-
- )
+ { name: t('studentName'), transform: (row) => row.student.last_name },
+ { name: t('studentFistName'), transform: (row) => row.student.first_name },
+ { name: t('lastUpdateDate'), transform: (row) => row.updated_date_formated},
+ { name: t('class'), transform: (row) => row.student.first_name},
+ { name: t('registrationFileStatus'), transform: (row) =>
+ (
+
+ updateStatusAction(row.student.id, newStatus)} showDropdown={false} />
+
+ )
},
{ name: t('files'), transform: (row) =>
- (
+ (row.registerForm != null) &&(
) },
@@ -557,14 +453,14 @@ const columnsSubscribed = [
Rattacher
>
),
- onClick: () => openModalAssociationEleve(row.eleve)
+ onClick: () => openModalAssociationEleve(row.student)
},
{ label: (
<>
Archiver
>
),
- onClick: () => archiveFicheInscription(row.eleve.id, row.eleve.nom, row.eleve.prenom),
+ onClick: () => archiveFicheInscription(row.student.id, row.student.last_name, row.student.first_name),
}
]}
buttonClassName="text-gray-400 hover:text-gray-600"
@@ -575,13 +471,7 @@ const columnsSubscribed = [
];
const handleFileDelete = (fileId) => {
- fetch(`${BK_GESTIONINSCRIPTION_FICHERSINSCRIPTION_URL}/${fileId}`, {
- method: 'DELETE',
- headers: {
- 'X-CSRFToken': csrfToken,
- },
- credentials: 'include',
- })
+ deleteRegisterFormFileTemplate(fileId,csrfToken)
.then(response => {
if (response.ok) {
setFichiers(fichiers.filter(fichier => fichier.id !== fileId));
@@ -598,12 +488,15 @@ const handleFileDelete = (fileId) => {
const columnsFiles = [
{ name: 'Nom du fichier', transform: (row) => row.name },
- { name: 'Date de création', transform: (row) => row.date_ajout },
+ { name: 'Date de création', transform: (row) => row.last_update },
{ name: 'Actions', transform: (row) => (
+ {
+ row.file && (
-
+ )
+ }
@@ -611,51 +504,19 @@ const columnsFiles = [
) },
];
-const [isUploadModalOpen, setIsUploadModalOpen] = useState(false);
-const [uploadFile, setUploadFile] = useState(null);
-const [uploadFileName, setUploadFileName] = useState('');
-const [fileName, setFileName] = useState('');
-
-const openUploadModal = () => {
- setIsUploadModalOpen(true);
-};
-
-const closeUploadModal = () => {
- setIsUploadModalOpen(false);
- setUploadFile(null);
- setUploadFileName('');
- setFileName('');
-};
-
-const handleFileChange = (event) => {
- const file = event.target.files[0];
- setUploadFile(file);
- setUploadFileName(file ? file.name : '');
-};
-
-const handleFileNameChange = (event) => {
- setFileName(event.target.value);
-};
-
const handleFileUpload = (file, fileName) => {
- if (!file || !fileName) {
- alert('Veuillez sélectionner un fichier et entrer un nom de fichier.');
+ if ( !fileName) {
+ alert('Veuillez entrer un nom de fichier.');
return;
}
- const formData = new FormData();
- formData.append('file', file);
- formData.append('name', fileName);
- fetch(`${BK_GESTIONINSCRIPTION_FICHERSINSCRIPTION_URL}`, {
- method: 'POST',
- body: formData,
- headers: {
- 'X-CSRFToken': csrfToken,
- },
- credentials: 'include',
- })
- .then(response => response.json())
+ const formData = new FormData();
+ if(file){
+ formData.append('fichier', file);
+ }
+ formData.append('nom', fileName);
+ createRegisterFormFileTemplate(formData,csrfToken)
.then(data => {
console.log('Success:', data);
setFichiers([...fichiers, data]);
@@ -808,8 +669,8 @@ const handleFileUpload = (file, fileName) => {
title={"Création d'un nouveau dossier d'inscription"}
size='sm:w-1/4'
ContentComponent={() => (
-
)}
/>
@@ -821,24 +682,13 @@ const handleFileUpload = (file, fileName) => {
title="Affectation à une classe"
ContentComponent={() => (
)}
/>
)}
- {isUploadModalOpen && (
-
(
-
- )}
- />
- )}
);
}
diff --git a/Front-End/src/app/[locale]/parents/editInscription/page.js b/Front-End/src/app/[locale]/parents/editInscription/page.js
index f817e7b..08b2d4a 100644
--- a/Front-End/src/app/[locale]/parents/editInscription/page.js
+++ b/Front-End/src/app/[locale]/parents/editInscription/page.js
@@ -3,10 +3,10 @@ import React, { useState, useEffect } from 'react';
import InscriptionFormShared from '@/components/Inscription/InscriptionFormShared';
import { useSearchParams, redirect, useRouter } from 'next/navigation';
import useCsrfToken from '@/hooks/useCsrfToken';
-import { FR_PARENTS_HOME_URL,
- BK_GESTIONINSCRIPTION_ELEVE_URL,
- BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL,
- BK_GESTIONINSCRIPTION_RECUPEREDERNIER_RESPONSABLE_URL } from '@/utils/Url';
+import { FE_PARENTS_HOME_URL,
+ BE_SUBSCRIPTION_STUDENT_URL,
+ BE_SUBSCRIPTION_REGISTERFORM_URL,
+ BE_SUBSCRIPTION_LAST_GUARDIAN_URL } from '@/utils/Url';
import { mockStudent } from '@/data/mockStudent';
const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
@@ -14,7 +14,7 @@ const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
export default function Page() {
const searchParams = useSearchParams();
const idProfil = searchParams.get('id');
- const idEleve = searchParams.get('idEleve');
+ const studentId = searchParams.get('studentId');
const router = useRouter();
const [initialData, setInitialData] = useState(null);
@@ -24,8 +24,8 @@ export default function Page() {
const [lastIdResponsable, setLastIdResponsable] = useState(1);
useEffect(() => {
- if (!idEleve || !idProfil) {
- console.error('Missing idEleve or idProfil');
+ if (!studentId || !idProfil) {
+ console.error('Missing studentId or idProfil');
return;
}
@@ -36,9 +36,9 @@ export default function Page() {
} else {
Promise.all([
// Fetch eleve data
- fetch(`${BK_GESTIONINSCRIPTION_ELEVE_URL}/${idEleve}`),
+ fetch(`${BE_SUBSCRIPTION_STUDENT_URL}/${studentId}`),
// Fetch last responsable ID
- fetch(BK_GESTIONINSCRIPTION_RECUPEREDERNIER_RESPONSABLE_URL)
+ fetch(BE_SUBSCRIPTION_LAST_GUARDIAN_URL)
])
.then(async ([eleveResponse, responsableResponse]) => {
const eleveData = await eleveResponse.json();
@@ -74,7 +74,7 @@ export default function Page() {
setIsLoading(false);
});
}
- }, [idEleve, idProfil]);
+ }, [studentId, idProfil]);
const handleSubmit = async (data) => {
if (useFakeData) {
@@ -83,7 +83,7 @@ export default function Page() {
}
try {
- const response = await fetch(`${BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL}/${idEleve}`, {
+ const response = await fetch(`${BE_SUBSCRIPTION_REGISTERFORM_URL}/${studentId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
@@ -95,7 +95,7 @@ export default function Page() {
const result = await response.json();
console.log('Success:', result);
- router.push(FR_PARENTS_HOME_URL);
+ router.push(FE_PARENTS_HOME_URL);
} catch (error) {
console.error('Error:', error);
}
@@ -106,7 +106,7 @@ export default function Page() {
initialData={initialData}
csrfToken={csrfToken}
onSubmit={handleSubmit}
- cancelUrl={FR_PARENTS_HOME_URL}
+ cancelUrl={FE_PARENTS_HOME_URL}
isLoading={isLoading}
/>
);
diff --git a/Front-End/src/app/[locale]/parents/layout.js b/Front-End/src/app/[locale]/parents/layout.js
index a78766d..29bdc94 100644
--- a/Front-End/src/app/[locale]/parents/layout.js
+++ b/Front-End/src/app/[locale]/parents/layout.js
@@ -5,7 +5,7 @@ import DropdownMenu from '@/components/DropdownMenu';
import { useRouter } from 'next/navigation'; // Ajout de l'importation
import { Bell, User, MessageSquare, LogOut, Settings, Home } from 'lucide-react'; // Ajout de l'importation de l'icône Home
import Logo from '@/components/Logo'; // Ajout de l'importation du composant Logo
-import { FR_PARENTS_HOME_URL,FR_PARENTS_MESSAGERIE_URL,FR_PARENTS_SETTINGS_URL, BK_GESTIONINSCRIPTION_MESSAGES_URL } from '@/utils/Url'; // Ajout de l'importation de l'URL de la page d'accueil parent
+import { FE_PARENTS_HOME_URL,FE_PARENTS_MESSAGERIE_URL,FE_PARENTS_SETTINGS_URL, BE_GESTIONINSCRIPTION_MESSAGES_URL } from '@/utils/Url'; // Ajout de l'importation de l'URL de la page d'accueil parent
import useLocalStorage from '@/hooks/useLocalStorage';
export default function Layout({
@@ -19,7 +19,7 @@ export default function Layout({
useEffect(() => {
setUserId(userId);
- fetch(`${BK_GESTIONINSCRIPTION_MESSAGES_URL}/${userId}`, {
+ fetch(`${BE_GESTIONINSCRIPTION_MESSAGES_URL}/${userId}`, {
headers: {
'Content-Type': 'application/json',
},
@@ -33,7 +33,7 @@ export default function Layout({
.catch(error => {
console.error('Error fetching data:', error);
});
-
+
}, []);
return (
@@ -49,7 +49,7 @@ export default function Layout({
@@ -58,7 +58,7 @@ export default function Layout({
{
setPopupVisible(false);
- router.push(`${FR_USERS_LOGIN_URL}`);
+ router.push(`${FE_USERS_LOGIN_URL}`);
}}
onCancel={() => setPopupVisible(false)}
/>
@@ -136,7 +136,7 @@ export default function Page() {
-
+
>
diff --git a/Front-End/src/app/[locale]/users/subscribe/page.js b/Front-End/src/app/[locale]/users/subscribe/page.js
index f5b3634..b724a0b 100644
--- a/Front-End/src/app/[locale]/users/subscribe/page.js
+++ b/Front-End/src/app/[locale]/users/subscribe/page.js
@@ -10,7 +10,7 @@ import Loader from '@/components/Loader'; // Importez le composant Loader
import Button from '@/components/Button'; // Importez le composant Button
import Popup from '@/components/Popup'; // Importez le composant Popup
import { User, KeySquare } from 'lucide-react'; // Importez directement les icônes nécessaires
-import { BK_REGISTER_URL, FR_USERS_LOGIN_URL } from '@/utils/Url';
+import { BE_AUTH_REGISTER_URL, FE_USERS_LOGIN_URL } from '@/utils/Url';
import useCsrfToken from '@/hooks/useCsrfToken';
const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
@@ -41,7 +41,7 @@ export default function Page() {
setErrorMessage("")
setIsLoading(false);
} else {
- const url= `${BK_REGISTER_URL}`;
+ const url= `${BE_AUTH_REGISTER_URL}`;
fetch(url, {
headers: {
'Content-Type': 'application/json',
@@ -100,11 +100,11 @@ export default function Page() {
}
} else {
const request = new Request(
- `${BK_REGISTER_URL}`,
+ `${BE_AUTH_REGISTER_URL}`,
{
method:'POST',
headers: {
- 'Content-Type':'application/json',
+ 'Content-Type':'application/json',
'X-CSRFToken': csrfToken
},
credentials: 'include',
@@ -164,14 +164,14 @@ export default function Page() {
- {router.push(`${FR_USERS_LOGIN_URL}`)}} />
+ {router.push(`${FE_USERS_LOGIN_URL}`)}} />
{
setPopupVisible(false);
- router.push(`${FR_USERS_LOGIN_URL}`);
+ router.push(`${FE_USERS_LOGIN_URL}`);
}}
onCancel={() => setPopupVisible(false)}
/>
diff --git a/Front-End/src/app/lib/actions.js b/Front-End/src/app/lib/actions.js
deleted file mode 100644
index 5ee83b0..0000000
--- a/Front-End/src/app/lib/actions.js
+++ /dev/null
@@ -1,39 +0,0 @@
-
-import {
- BK_LOGIN_URL,
- FR_USERS_LOGIN_URL ,
- FR_ADMIN_HOME_URL,
- FR_ADMIN_SUBSCRIPTIONS_URL,
- FR_ADMIN_CLASSES_URL,
- FR_ADMIN_GRADES_URL,
- FR_ADMIN_PLANNING_URL,
- FR_ADMIN_TEACHERS_URL,
- FR_ADMIN_SETTINGS_URL
-} from '@/utils/Url';
-
-import {mockUser} from "@/data/mockUsersData";
-
-const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
-
-
-/**
- * Disconnects the user after confirming the action.
- * If `NEXT_PUBLIC_USE_FAKE_DATA` environment variable is set to 'true', it will log a fake disconnect and redirect to the login URL.
- * Otherwise, it will send a PUT request to the backend to update the user profile and then redirect to the login URL.
- *
- * @function
- * @name disconnect
- * @returns {void}
- */
-export function disconnect () {
- if (confirm("\nÊtes-vous sûr(e) de vouloir vous déconnecter ?")) {
-
- if (useFakeData) {
- console.log('Fake disconnect:', mockUser);
- router.push(`${FR_USERS_LOGIN_URL}`);
- } else {
- console.log('Fake disconnect:', mockUser);
- router.push(`${FR_USERS_LOGIN_URL}`);
- }
- }
- };
diff --git a/Front-End/src/app/lib/authAction.js b/Front-End/src/app/lib/authAction.js
new file mode 100644
index 0000000..bce3624
--- /dev/null
+++ b/Front-End/src/app/lib/authAction.js
@@ -0,0 +1,67 @@
+
+import {
+ BE_AUTH_LOGIN_URL,
+ BE_AUTH_PROFILE_URL,
+ FE_USERS_LOGIN_URL ,
+} from '@/utils/Url';
+
+import {mockUser} from "@/data/mockUsersData";
+
+const useFakeData = process.env.NEXT_PUBLIC_USE_FAKE_DATA === 'true';
+
+
+/**
+ * Disconnects the user after confirming the action.
+ * If `NEXT_PUBLIC_USE_FAKE_DATA` environment variable is set to 'true', it will log a fake disconnect and redirect to the login URL.
+ * Otherwise, it will send a PUT request to the backend to update the user profile and then redirect to the login URL.
+ *
+ * @function
+ * @name disconnect
+ * @returns {void}
+ */
+export const disconnect = () => {
+ if (confirm("\nÊtes-vous sûr(e) de vouloir vous déconnecter ?")) {
+
+ if (useFakeData) {
+ console.log('Fake disconnect:', mockUser);
+ router.push(`${FE_USERS_LOGIN_URL}`);
+ } else {
+ console.log('Fake disconnect:', mockUser);
+ router.push(`${FE_USERS_LOGIN_URL}`);
+ }
+ }
+ };
+
+
+export const createProfile = (data,csrfToken) => {
+const request = new Request(
+ `${BE_AUTH_PROFILE_URL}`,
+ {
+ method:'POST',
+ headers: {
+ 'Content-Type':'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ credentials: 'include',
+ body: JSON.stringify(data),
+ }
+ );
+ return fetch(request).then(response => response.json())
+}
+
+
+export const updateProfile = (id, data, csrfToken) => {
+ const request = new Request(
+ `${BE_AUTH_PROFILE_URL}/${id}`,
+ {
+ method:'PUT',
+ headers: {
+ 'Content-Type':'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ credentials: 'include',
+ body: JSON.stringify(data),
+ }
+ );
+ return fetch(request).then(response => response.json())
+}
\ No newline at end of file
diff --git a/Front-End/src/app/lib/schoolAction.js b/Front-End/src/app/lib/schoolAction.js
new file mode 100644
index 0000000..fceb666
--- /dev/null
+++ b/Front-End/src/app/lib/schoolAction.js
@@ -0,0 +1,9 @@
+import {
+ BE_SCHOOL_SCHOOLCLASSES_URL
+} from '@/utils/Url';
+
+ export const fetchClasses = () => {
+ return fetch(`${BE_SCHOOL_SCHOOLCLASSES_URL}`)
+ .then(response => response.json())
+
+ };
\ No newline at end of file
diff --git a/Front-End/src/app/lib/subscriptionAction.js b/Front-End/src/app/lib/subscriptionAction.js
new file mode 100644
index 0000000..b6fc8bb
--- /dev/null
+++ b/Front-End/src/app/lib/subscriptionAction.js
@@ -0,0 +1,123 @@
+import {
+ BE_SUBSCRIPTION_STUDENTS_URL,
+ BE_SUBSCRIPTION_ARCHIVE_URL,
+ BE_SUBSCRIPTION_SEND_URL,
+ BE_SUBSCRIPTION_REGISTERFORM_URL,
+ BE_SUBSCRIPTION_REGISTERFORMS_URL,
+ BE_SUBSCRIPTION_REGISTERFORMFILE_TEMPLATE_URL
+} from '@/utils/Url';
+
+export const PENDING = 'pending';
+export const SUBSCRIBED = 'subscribed';
+export const ARCHIVED = 'archived';
+
+
+export const fetchRegisterForm = (type=PENDING, page='', pageSize='', search = '') => {
+ let url = `${BE_SUBSCRIPTION_REGISTERFORMS_URL}/${type}`;
+ if (page !== '' && pageSize !== '') {
+ url = `${BE_SUBSCRIPTION_REGISTERFORMS_URL}/${type}?page=${page}&search=${search}`;
+ }
+ return fetch(url, {
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ }).then(response => response.json())
+ };
+
+export const editRegisterForm=(id, data, csrfToken)=>{
+
+ return fetch(`${BE_SUBSCRIPTION_REGISTERFORM_URL}/${id}`, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ body: JSON.stringify(data),
+ credentials: 'include'
+ })
+ .then(response => response.json())
+
+};
+
+export const createRegisterForm=(data, csrfToken)=>{
+ const url = `${BE_SUBSCRIPTION_REGISTERFORM_URL}`;
+ return fetch(url, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ body: JSON.stringify(data),
+ credentials: 'include'
+ })
+ .then(response => response.json())
+}
+
+export const archiveRegisterForm = (id) => {
+ const url = `${BE_SUBSCRIPTION_ARCHIVE_URL}/${id}`;
+ return fetch(url, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ }).then(response => response.json())
+}
+
+export const sendRegisterForm = (id) => {
+ const url = `${BE_SUBSCRIPTION_SEND_URL}/${id}`;
+ return fetch(url, {
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ }).then(response => response.json())
+
+}
+
+export const fetchRegisterFormFileTemplate = () => {
+ const request = new Request(
+ `${BE_SUBSCRIPTION_REGISTERFORMFILE_TEMPLATE_URL}`,
+ {
+ method:'GET',
+ headers: {
+ 'Content-Type':'application/json'
+ },
+ }
+ );
+ return fetch(request).then(response => response.json())
+};
+
+export const createRegisterFormFileTemplate = (data,csrfToken) => {
+
+ fetch(`${BE_SUBSCRIPTION_REGISTERFORMFILE_TEMPLATE_URL}`, {
+ method: 'POST',
+ body: data,
+ headers: {
+ 'X-CSRFToken': csrfToken,
+ },
+ credentials: 'include',
+ })
+ .then(response => response.json())
+}
+
+export const deleteRegisterFormFileTemplate = (fileId,csrfToken) => {
+ return fetch(`${BE_SUBSCRIPTION_REGISTERFORMFILE_TEMPLATE_URL}/${fileId}`, {
+ method: 'DELETE',
+ headers: {
+ 'X-CSRFToken': csrfToken,
+ },
+ credentials: 'include',
+ })
+}
+export const fetchStudents = () => {
+ const request = new Request(
+ `${BE_SUBSCRIPTION_STUDENTS_URL}`,
+ {
+ method:'GET',
+ headers: {
+ 'Content-Type':'application/json'
+ },
+ }
+ );
+ return fetch(request).then(response => response.json())
+
+};
diff --git a/Front-End/src/components/Inscription/InscriptionForm.js b/Front-End/src/components/Inscription/InscriptionForm.js
index 79d8edb..9414a19 100644
--- a/Front-End/src/components/Inscription/InscriptionForm.js
+++ b/Front-End/src/components/Inscription/InscriptionForm.js
@@ -4,20 +4,20 @@ import InputTextIcon from '@/components/InputTextIcon';
import ToggleSwitch from '@/components/ToggleSwitch';
import Button from '@/components/Button';
-const InscriptionForm = ( { eleves, onSubmit }) => {
+const InscriptionForm = ( { students, onSubmit }) => {
const [formData, setFormData] = useState({
- eleveNom: '',
- elevePrenom: '',
- responsableEmail: '',
- responsableTel: '',
- selectedResponsables: [],
+ studentLastName: '',
+ studentFirstName: '',
+ guardianEmail: '',
+ guardianPhone: '',
+ selectedGuardians: [],
responsableType: 'new',
autoMail: false
});
const [step, setStep] = useState(1);
- const [selectedEleve, setSelectedEleve] = useState('');
- const [existingResponsables, setExistingResponsables] = useState([]);
+ const [selectedStudent, setSelectedEleve] = useState('');
+ const [existingGuardians, setExistingGuardians] = useState([]);
const maxStep = 4
const handleToggleChange = () => {
@@ -44,21 +44,21 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
}
};
- const handleEleveSelection = (eleve) => {
- setSelectedEleve(eleve);
+ const handleEleveSelection = (student) => {
+ setSelectedEleve(student);
setFormData((prevData) => ({
...prevData,
- selectedResponsables: []
+ selectedGuardians: []
}));
- setExistingResponsables(eleve.responsables);
+ setExistingGuardians(student.guardians);
};
- const handleResponsableSelection = (responsableId) => {
+ const handleResponsableSelection = (guardianId) => {
setFormData((prevData) => {
- const selectedResponsables = prevData.selectedResponsables.includes(responsableId)
- ? prevData.selectedResponsables.filter(id => id !== responsableId)
- : [...prevData.selectedResponsables, responsableId];
- return { ...prevData, selectedResponsables };
+ const selectedGuardians = prevData.selectedGuardians.includes(guardianId)
+ ? prevData.selectedGuardians.filter(id => id !== guardianId)
+ : [...prevData.selectedGuardians, guardianId];
+ return { ...prevData, selectedGuardians };
});
};
@@ -72,20 +72,20 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
Nouvel élève
@@ -121,11 +121,11 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
{formData.responsableType === 'new' && (
@@ -142,33 +142,33 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
- {eleves.map((eleve, index) => (
+ {students.map((student, index) => (
handleEleveSelection(eleve)}
+ key={student.id}
+ className={`cursor-pointer ${selectedStudent && selectedStudent.id === student.id ? 'bg-emerald-600 text-white' : index % 2 === 0 ? 'bg-emerald-100' : ''}`}
+ onClick={() => handleEleveSelection(student)}
>
- | {eleve.nom} |
- {eleve.prenom} |
+ {student.last_name} |
+ {student.first_name} |
))}
- {selectedEleve && (
+ {selectedStudent && (
-
Responsables associés à {selectedEleve.nom} {selectedEleve.prenom} :
- {existingResponsables.map((responsable) => (
-
+
Responsables associés à {selectedStudent.last_name} {selectedStudent.first_name} :
+ {existingGuardians.map((guardian) => (
+
@@ -184,11 +184,11 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
Téléphone (optionnel)
@@ -210,8 +210,8 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
- | {formData.eleveNom} |
- {formData.elevePrenom} |
+ {formData.studentLastName} |
+ {formData.studentFirstName} |
@@ -228,15 +228,15 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
- | {formData.responsableEmail} |
- {formData.responsableTel} |
+ {formData.guardianEmail} |
+ {formData.guardianPhone} |
)}
- {formData.responsableType === 'existing' && selectedEleve && (
+ {formData.responsableType === 'existing' && selectedStudent && (
-
Associé(s) à : {selectedEleve.nom} {selectedEleve.prenom}
+
Associé(s) à : {selectedStudent.nom} {selectedStudent.prenom}
@@ -246,11 +246,11 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
- {existingResponsables.filter(responsable => formData.selectedResponsables.includes(responsable.id)).map((responsable) => (
-
- | {responsable.nom} |
- {responsable.prenom} |
- {responsable.mail} |
+ {existingGuardians.filter(guardian => formData.selectedGuardians.includes(guardian.id)).map((guardian) => (
+
+ | {guardian.last_name} |
+ {guardian.first_name} |
+ {guardian.email} |
))}
@@ -281,15 +281,15 @@ const InscriptionForm = ( { eleves, onSubmit }) => {
diff --git a/Front-End/src/components/Inscription/InscriptionFormShared.js b/Front-End/src/components/Inscription/InscriptionFormShared.js
index f524263..0fb4416 100644
--- a/Front-End/src/components/Inscription/InscriptionFormShared.js
+++ b/Front-End/src/components/Inscription/InscriptionFormShared.js
@@ -5,7 +5,8 @@ import ResponsableInputFields from '@/components/Inscription/ResponsableInputFie
import Loader from '@/components/Loader';
import Button from '@/components/Button';
import DjangoCSRFToken from '@/components/DjangoCSRFToken';
-
+import FileUpload from '@/app/[locale]/admin/subscriptions/components/FileUpload';
+import Table from '@/components/Table';
const niveaux = [
{ value:'1', label: 'TPS - Très Petite Section'},
@@ -39,6 +40,8 @@ export default function InscriptionFormShared({
initialData?.responsables || []
);
+ const [uploadedFiles, setUploadedFiles] = useState([]);
+
// Mettre à jour les données quand initialData change
useEffect(() => {
if (initialData) {
@@ -62,6 +65,10 @@ export default function InscriptionFormShared({
setFormData(prev => ({...prev, [field]: value}));
};
+ const handleFileUpload = (file, fileName) => {
+ setUploadedFiles([...uploadedFiles, { file, fileName }]);
+ };
+
const handleSubmit = (e) => {
e.preventDefault();
onSubmit({
@@ -72,6 +79,15 @@ export default function InscriptionFormShared({
});
};
+ const columns = [
+ { name: 'Nom du fichier', transform: (row) => row.nom },
+ { name: 'Actions', transform: (row) => (
+
+ Télécharger
+
+ ) },
+ ];
+
if (isLoading) return ;
return (
@@ -170,6 +186,20 @@ export default function InscriptionFormShared({
/>
+ {/* Section Fichiers d'inscription */}
+
+
Fichiers à remplir
+
{}}
+ />
+
+
+
{/* Boutons de contrôle */}
diff --git a/Front-End/src/components/Structure/Configuration/StructureManagement.js b/Front-End/src/components/Structure/Configuration/StructureManagement.js
index c1822d6..56d56ce 100644
--- a/Front-End/src/components/Structure/Configuration/StructureManagement.js
+++ b/Front-End/src/components/Structure/Configuration/StructureManagement.js
@@ -4,41 +4,41 @@ import TeachersSection from '@/components/Structure/Configuration/TeachersSectio
import ClassesSection from '@/components/Structure/Configuration/ClassesSection';
import { ClassesProvider } from '@/context/ClassesContext';
-import { BK_GESTIONENSEIGNANTS_SPECIALITE_URL,
- BK_GESTIONENSEIGNANTS_TEACHER_URL,
- BK_GESTIONENSEIGNANTS_CLASSE_URL } from '@/utils/Url';
+import { BE_SCHOOL_SPECIALITY_URL,
+ BE_SCHOOL_TEACHER_URL,
+ BE_SCHOOL_SCHOOLCLASS_URL } from '@/utils/Url';
const StructureManagement = ({ specialities, setSpecialities, teachers, setTeachers, classes, setClasses, handleCreate, handleEdit, handleDelete }) => {
return (
-
+
- handleCreate(`${BK_GESTIONENSEIGNANTS_SPECIALITE_URL}`, newData, setSpecialities)}
- handleEdit={(id, updatedData) => handleEdit(`${BK_GESTIONENSEIGNANTS_SPECIALITE_URL}`, id, updatedData, setSpecialities)}
- handleDelete={(id) => handleDelete(`${BK_GESTIONENSEIGNANTS_SPECIALITE_URL}`, id, setSpecialities)}
+ handleCreate={(newData) => handleCreate(`${BE_SCHOOL_SPECIALITY_URL}`, newData, setSpecialities)}
+ handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_SPECIALITY_URL}`, id, updatedData, setSpecialities)}
+ handleDelete={(id) => handleDelete(`${BE_SCHOOL_SPECIALITY_URL}`, id, setSpecialities)}
/>
handleCreate(`${BK_GESTIONENSEIGNANTS_TEACHER_URL}`, newData, setTeachers)}
- handleEdit={(id, updatedData) => handleEdit(`${BK_GESTIONENSEIGNANTS_TEACHER_URL}`, id, updatedData, setTeachers)}
- handleDelete={(id) => handleDelete(`${BK_GESTIONENSEIGNANTS_TEACHER_URL}`, id, setTeachers)}
+ handleCreate={(newData) => handleCreate(`${BE_SCHOOL_TEACHER_URL}`, newData, setTeachers)}
+ handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_TEACHER_URL}`, id, updatedData, setTeachers)}
+ handleDelete={(id) => handleDelete(`${BE_SCHOOL_TEACHER_URL}`, id, setTeachers)}
/>
- handleCreate(`${BK_GESTIONENSEIGNANTS_CLASSE_URL}`, newData, setClasses)}
- handleEdit={(id, updatedData) => handleEdit(`${BK_GESTIONENSEIGNANTS_CLASSE_URL}`, id, updatedData, setClasses)}
- handleDelete={(id) => handleDelete(`${BK_GESTIONENSEIGNANTS_CLASSE_URL}`, id, setClasses)}
+ handleCreate={(newData) => handleCreate(`${BE_SCHOOL_SCHOOLCLASS_URL}`, newData, setClasses)}
+ handleEdit={(id, updatedData) => handleEdit(`${BE_SCHOOL_SCHOOLCLASS_URL}`, id, updatedData, setClasses)}
+ handleDelete={(id) => handleDelete(`${BE_SCHOOL_SCHOOLCLASS_URL}`, id, setClasses)}
/>
-
+
);
};
diff --git a/Front-End/src/components/Structure/Configuration/TeachersSection.js b/Front-End/src/components/Structure/Configuration/TeachersSection.js
index bfd9184..e38194a 100644
--- a/Front-End/src/components/Structure/Configuration/TeachersSection.js
+++ b/Front-End/src/components/Structure/Configuration/TeachersSection.js
@@ -4,9 +4,10 @@ import Table from '@/components/Table';
import DropdownMenu from '@/components/DropdownMenu';
import Modal from '@/components/Modal';
import TeacherForm from '@/components/Structure/Configuration/TeacherForm';
-import {BK_PROFILE_URL} from '@/utils/Url';
+
import useCsrfToken from '@/hooks/useCsrfToken';
import { TeacherFormProvider } from '@/context/TeacherFormContext';
+import { createProfile, updateProfile } from '@/app/lib/authAction';
const TeachersSection = ({ teachers, handleCreate, handleEdit, handleDelete, specialities }) => {
@@ -20,31 +21,21 @@ const TeachersSection = ({ teachers, handleCreate, handleEdit, handleDelete, spe
setEditingTeacher(teacher);
}
- const closeEditModal = () => {
- setIsOpen(false);
- setEditingTeacher(null);
+ const closeEditModal = () => {
+ setIsOpen(false);
+ setEditingTeacher(null);
};
const handleModalSubmit = (updatedData) => {
if (editingTeacher) {
// Modification du profil
- const request = new Request(
- `${BK_PROFILE_URL}/${updatedData.profilAssocie_id}`,
- {
- method:'PUT',
- headers: {
- 'Content-Type':'application/json',
- 'X-CSRFToken': csrfToken
- },
- credentials: 'include',
- body: JSON.stringify( {
- email: updatedData.mail,
- username: updatedData.mail,
- droit:updatedData.droit
- }),
- }
- );
- fetch(request).then(response => response.json())
+ const data = {
+ email: updatedData.mail,
+ username: updatedData.mail,
+ droit:updatedData.droit
+ }
+
+ updateProfile(updatedData.profilAssocie_id,data,csrfToken)
.then(response => {
console.log('Success:', response);
console.log('UpdateData:', updatedData);
@@ -58,25 +49,14 @@ const TeachersSection = ({ teachers, handleCreate, handleEdit, handleDelete, spe
} else {
// Création d'un profil associé à l'adresse mail du responsable saisie
// Le profil est inactif
- const request = new Request(
- `${BK_PROFILE_URL}`,
- {
- method:'POST',
- headers: {
- 'Content-Type':'application/json',
- 'X-CSRFToken': csrfToken
- },
- credentials: 'include',
- body: JSON.stringify( {
- email: updatedData.mail,
- password: 'Provisoire01!',
- username: updatedData.mail,
- is_active: 1, // On rend le profil actif : on considère qu'au moment de la configuration de l'école un abonnement a été souscrit
- droit:updatedData.droit
- }),
- }
- );
- fetch(request).then(response => response.json())
+ const data = {
+ email: updatedData.mail,
+ password: 'Provisoire01!',
+ username: updatedData.mail,
+ is_active: 1, // On rend le profil actif : on considère qu'au moment de la configuration de l'école un abonnement a été souscrit
+ droit:updatedData.droit
+ }
+ createProfile(data,csrfToken)
.then(response => {
console.log('Success:', response);
console.log('UpdateData:', updatedData);
@@ -133,7 +113,7 @@ const TeachersSection = ({ teachers, handleCreate, handleEdit, handleDelete, spe
)
},
{
- name: 'TYPE PROFIL',
+ name: 'TYPE PROFIL',
transform: (row) => {
if (row.profilAssocie) {
const badgeClass = row.DroitLabel === 'ECOLE' ? 'bg-blue-100 text-blue-600' : 'bg-red-100 text-red-600';
@@ -168,9 +148,9 @@ const TeachersSection = ({ teachers, handleCreate, handleEdit, handleDelete, spe
{isOpen && (
- (
diff --git a/Front-End/src/components/Structure/Planning/ScheduleManagement.js b/Front-End/src/components/Structure/Planning/ScheduleManagement.js
index 1c98914..eafeb45 100644
--- a/Front-End/src/components/Structure/Planning/ScheduleManagement.js
+++ b/Front-End/src/components/Structure/Planning/ScheduleManagement.js
@@ -6,7 +6,7 @@ import { DndProvider } from 'react-dnd';
import { AnimatePresence, motion } from 'framer-motion';
import PlanningClassView from '@/components/Structure/Planning/PlanningClassView';
import SpecialitiesList from '@/components/Structure/Planning/SpecialitiesList';
-import { BK_GESTIONENSEIGNANTS_PLANNING_URL } from '@/utils/Url';
+import { BE_SCHOOL_PLANNING_URL } from '@/utils/Url';
import { useClasses } from '@/context/ClassesContext';
import { ClasseFormProvider } from '@/context/ClasseFormContext';
import TabsStructure from '@/components/Structure/Configuration/TabsStructure';
@@ -60,14 +60,14 @@ const ScheduleManagement = ({ handleUpdatePlanning, classes }) => {
const onDrop = (item, hour, day) => {
const { id, name, color, teachers } = item;
const newSchedule = { ...schedule, emploiDuTemps: schedule.emploiDuTemps || {} };
-
+
if (!newSchedule.emploiDuTemps[day]) {
newSchedule.emploiDuTemps[day] = [];
}
const courseTime = `${hour.toString().padStart(2, '0')}:00`;
-
+
const existingCourseIndex = newSchedule.emploiDuTemps[day].findIndex(course => course.heure === courseTime);
-
+
const newCourse = {
duree: '1',
heure: courseTime,
@@ -75,21 +75,21 @@ const ScheduleManagement = ({ handleUpdatePlanning, classes }) => {
teachers: teachers,
color: color,
};
-
+
if (existingCourseIndex !== -1) {
newSchedule.emploiDuTemps[day][existingCourseIndex] = newCourse;
} else {
newSchedule.emploiDuTemps[day].push(newCourse);
}
-
+
// Mettre à jour scheduleRef
setSchedule(newSchedule)
-
+
// Utiliser `handleUpdatePlanning` pour mettre à jour le planning du niveau de la classe
const planningId = selectedClass.plannings_read.find(planning => planning.niveau === selectedLevel)?.planning.id;
if (planningId) {
console.log('newSchedule : ', newSchedule)
- handleUpdatePlanning(BK_GESTIONENSEIGNANTS_PLANNING_URL, planningId, newSchedule);
+ handleUpdatePlanning(BE_SCHOOL_PLANNING_URL, planningId, newSchedule);
}
};
@@ -110,7 +110,7 @@ const ScheduleManagement = ({ handleUpdatePlanning, classes }) => {
-
+
{/* Colonne Classes */}
@@ -131,7 +131,7 @@ const ScheduleManagement = ({ handleUpdatePlanning, classes }) => {
/>
}
-
+
{/* Colonne Niveaux */}
@@ -144,7 +144,7 @@ const ScheduleManagement = ({ handleUpdatePlanning, classes }) => {
}
-
+
{/* Colonne Spécialités */}
@@ -155,10 +155,10 @@ const ScheduleManagement = ({ handleUpdatePlanning, classes }) => {
-
+
-
+
);
-
+
};
export default ScheduleManagement;
diff --git a/Front-End/src/components/Structure/Planning/SpecialityEventModal.js b/Front-End/src/components/Structure/Planning/SpecialityEventModal.js
index 5d6a482..913d622 100644
--- a/Front-End/src/components/Structure/Planning/SpecialityEventModal.js
+++ b/Front-End/src/components/Structure/Planning/SpecialityEventModal.js
@@ -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;
diff --git a/Front-End/src/hooks/useCsrfToken.js b/Front-End/src/hooks/useCsrfToken.js
index ebe8fb6..284dc8b 100644
--- a/Front-End/src/hooks/useCsrfToken.js
+++ b/Front-End/src/hooks/useCsrfToken.js
@@ -1,11 +1,11 @@
import { useEffect, useState } from 'react';
-import { BK_GET_CSRF } from '@/utils/Url';
+import { BE_AUTH_CSRF_URL } from '@/utils/Url';
const useCsrfToken = () => {
- const [token, setToken] = useState('');
+ const [token, setToken] = useState('');
useEffect(() => {
- fetch(`${BK_GET_CSRF}`, {
+ fetch(`${BE_AUTH_CSRF_URL}`, {
method: 'GET',
credentials: 'include' // Inclut les cookies dans la requête
})
diff --git a/Front-End/src/utils/Url.js b/Front-End/src/utils/Url.js
index e366544..9704114 100644
--- a/Front-End/src/utils/Url.js
+++ b/Front-End/src/utils/Url.js
@@ -6,76 +6,75 @@ export const BASE_URL = process.env.NEXT_PUBLIC_API_URL;
// GESTION LOGIN
-export const BK_NEW_PASSWORD_URL = `${BASE_URL}/GestionLogin/newPassword`
-export const BK_REGISTER_URL = `${BASE_URL}/GestionLogin/subscribe`
-export const BK_RESET_PASSWORD_URL = `${BASE_URL}/GestionLogin/resetPassword`
-export const BK_LOGIN_URL = `${BASE_URL}/GestionLogin/login`
-export const BK_LOGOUT_URL = `${BASE_URL}/GestionLogin/logout`
-export const BK_PROFILE_URL = `${BASE_URL}/GestionLogin/profil`
-export const BK_GET_CSRF = `${BASE_URL}/GestionLogin/csrf`
+export const BE_AUTH_NEW_PASSWORD_URL = `${BASE_URL}/Auth/newPassword`
+export const BE_AUTH_REGISTER_URL = `${BASE_URL}/Auth/subscribe`
+export const BE_AUTH_RESET_PASSWORD_URL = `${BASE_URL}/Auth/resetPassword`
+export const BE_AUTH_LOGIN_URL = `${BASE_URL}/Auth/login`
+export const BE_AUTH_LOGOUT_URL = `${BASE_URL}/Auth/logout`
+export const BE_AUTH_PROFILE_URL = `${BASE_URL}/Auth/profile`
+export const BE_AUTH_CSRF_URL = `${BASE_URL}/Auth/csrf`
// GESTION INSCRIPTION
-export const BK_GESTIONINSCRIPTION_ELEVE_URL = `${BASE_URL}/GestionInscriptions/eleve`
-export const BK_GESTIONINSCRIPTION_ENFANTS_URL = `${BASE_URL}/GestionInscriptions/enfants` // Récupère la liste des élèves d'un profil
-export const BK_GESTIONINSCRIPTION_ELEVES_URL = `${BASE_URL}/GestionInscriptions/eleves` // Récupère la liste des élèves inscrits ou en cours d'inscriptions
-export const BK_GESTIONINSCRIPTION_SEND_URL = `${BASE_URL}/GestionInscriptions/send`
-export const BK_GESTIONINSCRIPTION_ARCHIVE_URL = `${BASE_URL}/GestionInscriptions/archive`
-export const BK_GESTIONINSCRIPTION_FICHESINSCRIPTION_URL = `${BASE_URL}/GestionInscriptions/fichesInscription`
-export const BK_GESTIONINSCRIPTION_FICHEINSCRIPTION_URL = `${BASE_URL}/GestionInscriptions/ficheInscription`
-export const BK_GESTIONINSCRIPTION_FICHERSINSCRIPTION_URL = `${BASE_URL}/GestionInscriptions/fichiersInscription`
-export const BK_GESTIONINSCRIPTION_RECUPEREDERNIER_RESPONSABLE_URL = `${BASE_URL}/GestionInscriptions/recupereDernierResponsable`
-export const BK_GESTIONINSCRIPTION_MESSAGES_URL = `${BASE_URL}/GestionMessagerie/messagerie`
+export const BE_SUBSCRIPTION_STUDENT_URL = `${BASE_URL}/Subscriptions/student`
+export const BE_SUBSCRIPTION_STUDENTS_URL = `${BASE_URL}/Subscriptions/students` // Récupère la liste des élèves inscrits ou en cours d'inscriptions
+export const BE_SUBSCRIPTION_CHILDRENS_URL = `${BASE_URL}/Subscriptions/childrens` // Récupère la liste des élèves d'un profil
+export const BE_SUBSCRIPTION_SEND_URL = `${BASE_URL}/Subscriptions/send`
+export const BE_SUBSCRIPTION_ARCHIVE_URL = `${BASE_URL}/Subscriptions/archive`
+export const BE_SUBSCRIPTION_REGISTERFORM_URL = `${BASE_URL}/Subscriptions/registerForm`
+export const BE_SUBSCRIPTION_REGISTERFORMS_URL = `${BASE_URL}/Subscriptions/registerForms`
+export const BE_SUBSCRIPTION_REGISTERFORMFILE_TEMPLATE_URL = `${BASE_URL}/Subscriptions/registerFormFileTemplate`
+export const BE_SUBSCRIPTION_LAST_GUARDIAN_URL = `${BASE_URL}/Subscriptions/lastGuardian`
//GESTION ENSEIGNANT
-export const BK_GESTIONENSEIGNANTS_SPECIALITES_URL = `${BASE_URL}/GestionEnseignants/specialites`
-export const BK_GESTIONENSEIGNANTS_SPECIALITE_URL = `${BASE_URL}//GestionEnseignants/specialite`
-export const BK_GESTIONENSEIGNANTS_CLASSES_URL = `${BASE_URL}/GestionEnseignants/classes`
-export const BK_GESTIONENSEIGNANTS_CLASSE_URL = `${BASE_URL}/GestionEnseignants/classe`
-export const BK_GESTIONENSEIGNANTS_TEACHERS_URL = `${BASE_URL}/GestionEnseignants/enseignants`
-export const BK_GESTIONENSEIGNANTS_TEACHER_URL = `${BASE_URL}/GestionEnseignants/enseignant`
-export const BK_GESTIONENSEIGNANTS_PLANNINGS_URL = `${BASE_URL}/GestionEnseignants/plannings`
-export const BK_GESTIONENSEIGNANTS_PLANNING_URL = `${BASE_URL}/GestionEnseignants/planning`
-
+export const BE_SCHOOL_SPECIALITY_URL = `${BASE_URL}/School/speciality`
+export const BE_SCHOOL_SPECIALITIES_URL = `${BASE_URL}/School/specialities`
+export const BE_SCHOOL_SCHOOLCLASS_URL = `${BASE_URL}/School/schoolClass`
+export const BE_SCHOOL_SCHOOLCLASSES_URL = `${BASE_URL}/School/schoolClasses`
+export const BE_SCHOOL_TEACHER_URL = `${BASE_URL}/School/teacher`
+export const BE_SCHOOL_TEACHERS_URL = `${BASE_URL}/School/teachers`
+export const BE_SCHOOL_PLANNING_URL = `${BASE_URL}/School/planning`
+export const BE_SCHOOL_PLANNINGS_URL = `${BASE_URL}/School/plannings`
+// GESTION MESSAGERIE
+export const BE_GESTIONINSCRIPTION_MESSAGES_URL = `${BASE_URL}/GestionMessagerie/messagerie`
// URL FRONT-END
-
-export const FR_HOME_URL = `/`
+export const FE_HOME_URL = `/`
// USERS
-export const FR_USERS_LOGIN_URL = `/users/login`
-export const FR_USERS_SUBSCRIBE_URL = `/users/subscribe`
-export const FR_USERS_RESET_PASSWORD_URL = `/users/password/reset`
-export const FR_USERS_NEW_PASSWORD_URL = `/users/password/new`
+export const FE_USERS_LOGIN_URL = `/users/login`
+export const FE_USERS_SUBSCRIBE_URL = `/users/subscribe`
+export const FE_USERS_RESET_PASSWORD_URL = `/users/password/reset`
+export const FE_USERS_NEW_PASSWORD_URL = `/users/password/new`
//ADMIN
-export const FR_ADMIN_HOME_URL = `/admin`
+export const FE_ADMIN_HOME_URL = `/admin`
// ADMIN/SUBSCRIPTIONS URL
-export const FR_ADMIN_SUBSCRIPTIONS_URL = `/admin/subscriptions`
-export const FR_ADMIN_SUBSCRIPTIONS_EDIT_URL = `/admin/subscriptions/editInscription`
+export const FE_ADMIN_SUBSCRIPTIONS_URL = `/admin/subscriptions`
+export const FE_ADMIN_SUBSCRIPTIONS_EDIT_URL = `/admin/subscriptions/editInscription`
//ADMIN/CLASSES URL
-export const FR_ADMIN_CLASSES_URL = `/admin/classes`
+export const FE_ADMIN_CLASSES_URL = `/admin/classes`
//ADMIN/STRUCTURE URL
-export const FR_ADMIN_STRUCTURE_URL = `/admin/structure`
+export const FE_ADMIN_STRUCTURE_URL = `/admin/structure`
//ADMIN/GRADES URL
-export const FR_ADMIN_GRADES_URL = `/admin/grades`
+export const FE_ADMIN_GRADES_URL = `/admin/grades`
//ADMIN/TEACHERS URL
-export const FR_ADMIN_TEACHERS_URL = `/admin/teachers`
+export const FE_ADMIN_TEACHERS_URL = `/admin/teachers`
//ADMIN/PLANNING URL
-export const FR_ADMIN_PLANNING_URL = `/admin/planning`
+export const FE_ADMIN_PLANNING_URL = `/admin/planning`
//ADMIN/SETTINGS URL
-export const FR_ADMIN_SETTINGS_URL = `/admin/settings`
+export const FE_ADMIN_SETTINGS_URL = `/admin/settings`
// PARENT HOME
-export const FR_PARENTS_HOME_URL = `/parents`
-export const FR_PARENTS_MESSAGERIE_URL = `/parents/messagerie`
-export const FR_PARENTS_SETTINGS_URL = `/parents/settings`
-export const FR_PARENTS_EDIT_INSCRIPTION_URL = `/parents/editInscription`
\ No newline at end of file
+export const FE_PARENTS_HOME_URL = `/parents`
+export const FE_PARENTS_MESSAGERIE_URL = `/parents/messagerie`
+export const FE_PARENTS_SETTINGS_URL = `/parents/settings`
+export const FE_PARENTS_EDIT_INSCRIPTION_URL = `/parents/editInscription`
\ No newline at end of file