diff --git a/src/App copy.jsx b/src/App copy.jsx
new file mode 100644
index 0000000..0a0016e
--- /dev/null
+++ b/src/App copy.jsx
@@ -0,0 +1,13 @@
+import React from "react";
+
+import { Authenticated } from "./components";
+
+import { Router } from "./router";
+
+const App = () => (
+
+
+
+);
+
+export default App;
diff --git a/src/components/form/formCreateItem.jsx b/src/components/form/formCreateItem.jsx
new file mode 100644
index 0000000..c9bd3f6
--- /dev/null
+++ b/src/components/form/formCreateItem.jsx
@@ -0,0 +1,78 @@
+import React, { useState, useEffect } from "react";
+import { Form, Input, InputNumber, Button, Select } from "antd";
+import axios from "axios";
+
+const { TextArea } = Input;
+const { Option } = Select;
+
+export const FormCreateItem = () => {
+ const [form] = Form.useForm();
+ const [rooms, setRooms] = useState([]);
+
+ useEffect(() => {
+ const fetchRooms = async () => {
+ try {
+ const response = await axios.get(
+ `${import.meta.env.VITE_API_URL}/room`,
+ );
+ setRooms(response.data);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ fetchRooms();
+ }, []);
+
+ const onFinish = async (values) => {
+ try {
+ const response = await axios.post(
+ `${import.meta.env.VITE_API_URL}/item`,
+ values,
+ );
+ console.log(response.data);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default FormCreateItem;
diff --git a/src/components/form/formCreateRoom.jsx b/src/components/form/formCreateRoom.jsx
new file mode 100644
index 0000000..a9b6c19
--- /dev/null
+++ b/src/components/form/formCreateRoom.jsx
@@ -0,0 +1,38 @@
+import React from "react";
+import { Form, Input, Button } from "antd";
+import axios from "axios";
+
+export const FormCreateRoom = () => {
+ const [form] = Form.useForm();
+
+ const onFinish = async (values) => {
+ try {
+ const response = await axios.post(
+ `${import.meta.env.VITE_API_URL}/room`,
+ values,
+ );
+ console.log(response.data);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ return (
+
+
+
+
+
+
+
+ );
+};
+
+export default FormCreateRoom;
diff --git a/src/components/item/ItemBox.jsx b/src/components/item/ItemBox.jsx
index b47e91d..ba9be14 100644
--- a/src/components/item/ItemBox.jsx
+++ b/src/components/item/ItemBox.jsx
@@ -25,13 +25,13 @@ const Characteristic = ({ label, value }) => {
};
// Composant Détails du Produit (combinaison atomique)
-export const ItemBox = ({ imageUrl, modelName, brandName, purchaseDate, price, onEdit }) => {
+export const ItemBox = ({ imageUrl, model, brand, purchaseDate, price, onEdit }) => {
return (
-
-
+
+
@@ -39,5 +39,3 @@ export const ItemBox = ({ imageUrl, modelName, brandName, purchaseDate, price, o
);
};
-
-
diff --git a/src/components/item/ItemPage.jsx b/src/components/item/ItemPage.jsx
index ab68f12..0c831fa 100644
--- a/src/components/item/ItemPage.jsx
+++ b/src/components/item/ItemPage.jsx
@@ -1,5 +1,6 @@
-import React, { useState } from 'react';
-import { ItemBox } from './ItemBox'; // Assurez-vous que le chemin d'importation soit correct
+import React, { useState, useEffect } from "react";
+import axios from 'axios'; // Assurez-vous que le chemin d'importation soit correct
+import { ItemBox } from './ItemBox';
const itemsPerPage = 4; // Nombre total d'items par page
const itemsPerRow = 2; // Nombre d'items par rangée
@@ -14,9 +15,25 @@ const chunkArray = (arr, size) => {
};
// Composant d'affichage de la page
-export const ItemPage = ({ items }) => {
+export const ItemPage = () => {
+ const [items, setItems] = useState([]);
const [currentPage, setCurrentPage] = useState(1);
+ useEffect(() => {
+ const fetchItems = async () => {
+ try {
+ const response = await axios.get(
+ `${import.meta.env.VITE_API_URL}/item`,
+ );
+ setItems(response.data);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+
+ fetchItems();
+ }, []);
+
const handleNextPage = () => {
setCurrentPage(prevPage => prevPage + 1);
};
@@ -38,7 +55,7 @@ export const ItemPage = ({ items }) => {
{rowsToDisplay.map((row, index) => (
{row.map(item => (
-
+
))}
))}
@@ -50,4 +67,3 @@ export const ItemPage = ({ items }) => {
);
};
-
diff --git a/src/main.jsx b/src/main.jsx
index d7643d9..2025bba 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -5,7 +5,7 @@ import "./assets/styles/index.css";
import { BrowserRouter } from "react-router-dom";
import { CookiesProvider } from "react-cookie";
import setupAxios from "./setupAxios";
-import "bootstrap";
+import { Layout } from "antd";
setupAxios();
@@ -13,7 +13,9 @@ ReactDOM.createRoot(document.getElementById("root")).render(
-
+
+
+
,
diff --git a/src/pages/home.jsx b/src/pages/home.jsx
index 7bb8d44..0cc06bf 100644
--- a/src/pages/home.jsx
+++ b/src/pages/home.jsx
@@ -1,9 +1,11 @@
import React from "react";
import { useAuth } from "../hooks";
+import { DatePicker } from "antd";
+import { FormCreateItem } from "../components/form/formCreateItem";
+import { FormCreateRoom } from "../components/form/formCreateRoom";
import { ItemPage } from "../components/item/ItemPage";
-
export const Home = () => {
const { user } = useAuth();
return (
@@ -11,23 +13,9 @@ export const Home = () => {
Home page
{user && Hello {user.user.username}
}
-
+
+
+
);
};
diff --git a/src/pages/test.jsx b/src/pages/test.jsx
index e6f31e7..83a12c0 100644
--- a/src/pages/test.jsx
+++ b/src/pages/test.jsx
@@ -1,13 +1,15 @@
import React from "react";
import { useAuth } from "../hooks";
+import { ItemPage } from "../components/item/ItemPage";
export const Test = () => {
const { user } = useAuth();
return (
-
Vive la macronie à bat montjoiuie saint dennis
+ Vive la macronie à bat montjoie saint dennis
+
);
};