-
+
+
+ setDescription(e.target.value)}
+ required
+ />
+
-
+
+
+ setType(e.target.value)}
+ required
+ />
+
-
+
+
+ setLocalisation(e.target.value)}
+ required
+ />
+
-
-
Status :
-
+
+
+
+
+
+
);
}
+
export default ModifObject;
diff --git a/Front-end/src/pages/Gestion/AddObject.jsx b/Front-end/src/pages/Gestion/AddObject.jsx
new file mode 100644
index 0000000..0fcf593
--- /dev/null
+++ b/Front-end/src/pages/Gestion/AddObject.jsx
@@ -0,0 +1,206 @@
+import React, { useState } from "react";
+import { BadgePlus } from "lucide-react";
+import axios from "axios";
+import { API_BASE_URL } from "../../config";
+
+function AddObject() {
+ const [description, setDescription] = useState("");
+ const [type, setType] = useState("");
+ const [location, setLocalisation] = useState("");
+ const [status, setStatus] = useState("active");
+ const [nom, setNom] = useState("");
+ const [Response, setResponse] = useState(null);
+ const [isActive, setActive] = useState(true);
+ const [verif, setVerif] = useState(false);
+
+ function handleSubmit(event) {
+ event.preventDefault();
+
+ if (verif) {
+ console.log("Envoi requete");
+ axios
+ .post(`${API_BASE_URL}/addObject`, {
+ nom,
+ description,
+ type,
+ location,
+ status,
+ })
+ .then((response) => {
+ console.log("Modification réussie :", response.data);
+ })
+ .catch((error) => {
+ console.error("Erreur lors de la modification :", error);
+ });
+ }else{
+ setVerif(true);
+ }
+ }
+ function handleCancel() {
+ if(verif){
+ setVerif(false);
+ }else{
+ setNom("");
+ setStatus("");
+ setDescription("");
+ setType("");
+ setLocalisation("");
+ setActive(true);
+ }
+ }
+
+ function handleStatusChange() {
+ setActive((prevIsActive) => {
+ const newIsActive = !prevIsActive;
+ setStatus(newIsActive ? "active" : "inactive");
+ return newIsActive;
+ });
+ }
+
+ return (
+
+
+
+
+ Nouvel objet
+
+
+
+
+
+ );
+}
+
+export default AddObject;
diff --git a/Front-end/src/pages/Gestion/Gestion.jsx b/Front-end/src/pages/Gestion/Gestion.jsx
index 01a9282..54d76ab 100644
--- a/Front-end/src/pages/Gestion/Gestion.jsx
+++ b/Front-end/src/pages/Gestion/Gestion.jsx
@@ -10,7 +10,7 @@ import {
RadioTower,
Binoculars,
Settings,
- ChartArea,
+ BadgePlus,
} from "lucide-react";
function Gestion() {
@@ -26,8 +26,7 @@ function Gestion() {
- {/* Features Grid */}
-
+
@@ -47,7 +46,7 @@ function Gestion() {
-
+
Ajouter un nouvel objet connecté
@@ -56,29 +55,13 @@ function Gestion() {
Intégrez facilement un nouvel objet connecté en renseignant ses informations et en configurant ses paramètres pour une gestion optimale.
Ajouter un objet
-
-
-
-
-
- Optimisation et surveillance des ressources
-
-
- Suivez les performances des dispositifs connectés et optimisez leur utilisation pour une gestion efficace des ressources.
-
-
- En savoir plus
-
-
+
diff --git a/Front-end/src/pages/Gestion/Objet.jsx b/Front-end/src/pages/Gestion/Objet.jsx
index b357e6d..f2cc28d 100644
--- a/Front-end/src/pages/Gestion/Objet.jsx
+++ b/Front-end/src/pages/Gestion/Objet.jsx
@@ -3,6 +3,8 @@ import { Thermometer, CircleGauge, Droplet } from "lucide-react";
import { useEffect, useState } from "react";
import axios from "axios";
+import { API_BASE_URL } from "../../config";
+
import InfoObjet from "../../components/InfoObject";
import ModifObject from "../../components/ModifObject";
import WindGraph from "../../components/WindGraph";
@@ -22,7 +24,7 @@ function Objet() {
useEffect(() => {
axios
- .get(`http://localhost:8888/objet?id=${identifiant}`)
+ .get(`${API_BASE_URL}/objet?id=${identifiant}`)
.then((response) => {
setObject(response.data[0]);
});