diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 41556de6..ac0e61ca 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,8 +14,10 @@ "@fortawesome/free-regular-svg-icons": "^6.6.0", "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", + "@google/generative-ai": "^0.21.0", "@headlessui/react": "^2.1.10", "@heroicons/react": "^2.1.5", + "@mui/icons-material": "^6.1.6", "@mui/material": "^6.1.3", "@radix-ui/react-hover-card": "^1.1.2", "@radix-ui/react-icons": "^1.3.0", @@ -317,9 +319,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.25.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", - "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -1059,6 +1061,14 @@ "react": ">=16.3" } }, + "node_modules/@google/generative-ai": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@google/generative-ai/-/generative-ai-0.21.0.tgz", + "integrity": "sha512-7XhUbtnlkSEZK15kN3t+tzIMxsbKm/dSkKBFalj+20NvPKe1kBY7mR2P7vuijEn+f06z5+A8bVGKO0v39cr6Wg==", + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@headlessui/react": { "version": "2.1.10", "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-2.1.10.tgz", @@ -1254,24 +1264,49 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.1.3.tgz", - "integrity": "sha512-ajMUgdfhTb++rwqj134Cq9f4SRN8oXUqMRnY72YBnXiXai3olJLLqETheRlq3MM8wCKrbq7g6j7iWL1VvP44VQ==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-6.1.6.tgz", + "integrity": "sha512-nz1SlR9TdBYYPz4qKoNasMPRiGb4PaIHFkzLzhju0YVYS5QSuFF2+n7CsiHMIDcHv3piPu/xDWI53ruhOqvZwQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mui-org" + } + }, + "node_modules/@mui/icons-material": { + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-6.1.6.tgz", + "integrity": "sha512-5r9urIL2lxXb/sPN3LFfFYEibsXJUb986HhhIeu1gOcte460pwdSiEhBSxkAuyT8Dj7jvu9MjqSBmSumQELo8A==", + "dependencies": { + "@babel/runtime": "^7.26.0" + }, + "engines": { + "node": ">=14.0.0" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/mui-org" + }, + "peerDependencies": { + "@mui/material": "^6.1.6", + "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", + "react": "^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, "node_modules/@mui/material": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.1.3.tgz", - "integrity": "sha512-loV5MBoMKLrK80JeWINmQ1A4eWoLv51O2dBPLJ260IAhupkB3Wol8lEQTEvvR2vO3o6xRHuXe1WaQEP6N3riqg==", - "dependencies": { - "@babel/runtime": "^7.25.6", - "@mui/core-downloads-tracker": "^6.1.3", - "@mui/system": "^6.1.3", - "@mui/types": "^7.2.18", - "@mui/utils": "^6.1.3", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-6.1.6.tgz", + "integrity": "sha512-1yvejiQ/601l5AK3uIdUlAVElyCxoqKnl7QA+2oFB/2qYPWfRwDgavW/MoywS5Y2gZEslcJKhe0s2F3IthgFgw==", + "dependencies": { + "@babel/runtime": "^7.26.0", + "@mui/core-downloads-tracker": "^6.1.6", + "@mui/system": "^6.1.6", + "@mui/types": "^7.2.19", + "@mui/utils": "^6.1.6", "@popperjs/core": "^2.11.8", "@types/react-transition-group": "^4.4.11", "clsx": "^2.1.1", @@ -1290,7 +1325,7 @@ "peerDependencies": { "@emotion/react": "^11.5.0", "@emotion/styled": "^11.3.0", - "@mui/material-pigment-css": "^6.1.3", + "@mui/material-pigment-css": "^6.1.6", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0" @@ -1316,12 +1351,12 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==" }, "node_modules/@mui/private-theming": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.1.3.tgz", - "integrity": "sha512-XK5OYCM0x7gxWb/WBEySstBmn+dE3YKX7U7jeBRLm6vHU5fGUd7GiJWRirpivHjOK9mRH6E1MPIVd+ze5vguKQ==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-6.1.6.tgz", + "integrity": "sha512-ioAiFckaD/fJSnTrUMWgjl9HYBWt7ixCh7zZw7gDZ+Tae7NuprNV6QJK95EidDT7K0GetR2rU3kAeIR61Myttw==", "dependencies": { - "@babel/runtime": "^7.25.6", - "@mui/utils": "^6.1.3", + "@babel/runtime": "^7.26.0", + "@mui/utils": "^6.1.6", "prop-types": "^15.8.1" }, "engines": { @@ -1342,11 +1377,11 @@ } }, "node_modules/@mui/styled-engine": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.1.3.tgz", - "integrity": "sha512-i4yh9m+eMZE3cNERpDhVr6Wn73Yz6C7MH0eE2zZvw8d7EFkIJlCQNZd1xxGZqarD2DDq2qWHcjIOucWGhxACtA==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-6.1.6.tgz", + "integrity": "sha512-I+yS1cSuSvHnZDBO7e7VHxTWpj+R7XlSZvTC4lS/OIbUNJOMMSd3UDP6V2sfwzAdmdDNBi7NGCRv2SZ6O9hGDA==", "dependencies": { - "@babel/runtime": "^7.25.6", + "@babel/runtime": "^7.26.0", "@emotion/cache": "^11.13.1", "@emotion/serialize": "^1.3.2", "@emotion/sheet": "^1.4.0", @@ -1375,15 +1410,15 @@ } }, "node_modules/@mui/system": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-6.1.3.tgz", - "integrity": "sha512-ILaD9UsLTBLjMcep3OumJMXh1PYr7aqnkHm/L47bH46+YmSL1zWAX6tWG8swEQROzW2GvYluEMp5FreoxOOC6w==", - "dependencies": { - "@babel/runtime": "^7.25.6", - "@mui/private-theming": "^6.1.3", - "@mui/styled-engine": "^6.1.3", - "@mui/types": "^7.2.18", - "@mui/utils": "^6.1.3", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-6.1.6.tgz", + "integrity": "sha512-qOf1VUE9wK8syiB0BBCp82oNBAVPYdj4Trh+G1s+L+ImYiKlubWhhqlnvWt3xqMevR+D2h1CXzA1vhX2FvA+VQ==", + "dependencies": { + "@babel/runtime": "^7.26.0", + "@mui/private-theming": "^6.1.6", + "@mui/styled-engine": "^6.1.6", + "@mui/types": "^7.2.19", + "@mui/utils": "^6.1.6", "clsx": "^2.1.1", "csstype": "^3.1.3", "prop-types": "^15.8.1" @@ -1414,9 +1449,9 @@ } }, "node_modules/@mui/types": { - "version": "7.2.18", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.18.tgz", - "integrity": "sha512-uvK9dWeyCJl/3ocVnTOS6nlji/Knj8/tVqVX03UVTpdmTJYu/s4jtDd9Kvv0nRGE0CUSNW1UYAci7PYypjealg==", + "version": "7.2.19", + "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.19.tgz", + "integrity": "sha512-6XpZEM/Q3epK9RN8ENoXuygnqUQxE+siN/6rGRi2iwJPgBUR25mphYQ9ZI87plGh58YoZ5pp40bFvKYOCDJ3tA==", "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0" }, @@ -1427,12 +1462,12 @@ } }, "node_modules/@mui/utils": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.1.3.tgz", - "integrity": "sha512-4JBpLkjprlKjN10DGb1aiy/ii9TKbQ601uSHtAmYFAS879QZgAD7vRnv/YBE4iBbc7NXzFgbQMCOFrupXWekIA==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-6.1.6.tgz", + "integrity": "sha512-sBS6D9mJECtELASLM+18WUcXF6RH3zNxBRFeyCRg8wad6NbyNrdxLuwK+Ikvc38sTZwBzAz691HmSofLqHd9sQ==", "dependencies": { - "@babel/runtime": "^7.25.6", - "@mui/types": "^7.2.18", + "@babel/runtime": "^7.26.0", + "@mui/types": "^7.2.19", "@types/prop-types": "^15.7.13", "clsx": "^2.1.1", "prop-types": "^15.8.1", diff --git a/frontend/src/AgroRentAI/RentAdminDashboard.jsx b/frontend/src/AgroRentAI/RentAdminDashboard.jsx new file mode 100644 index 00000000..bb789441 --- /dev/null +++ b/frontend/src/AgroRentAI/RentAdminDashboard.jsx @@ -0,0 +1,173 @@ +import React, { useState, useEffect } from 'react'; +import { Plus, Edit, Trash, BarChart, Bell } from 'lucide-react'; + +const RentAdminDashboard = () => { + const [products, setProducts] = useState([]); + const [orders, setOrders] = useState([]); + const [users, setUsers] = useState([]); + const [analytics, setAnalytics] = useState({ + popularProducts: [], + revenue: '$0', + rentalFrequency: [], + userBehavior: [], + }); + + // Fetch data + useEffect(() => { + const fetchData = async () => { + const productData = await fetchProducts(); + const orderData = await fetchOrders(); + const userData = await fetchUsers(); + const analyticsData = await fetchAnalytics(); + + setProducts(productData); + setOrders(orderData); + setUsers(userData); + setAnalytics(analyticsData); + }; + + fetchData(); + }, []); + + // Mock API calls + const fetchProducts = async () => { + return [ + { id: 1, name: 'Tractor', price: '$300', category: 'Heavy Machinery', availability: 'In Stock' }, + { id: 2, name: 'Lawn Mower', price: '$100', category: 'Gardening', availability: 'In Stock' }, + ]; + }; + + const fetchOrders = async () => { + return [ + { id: 1, item: 'Tractor', user: 'John Doe', status: 'Pending Approval', returnDate: '2024-12-01' }, + { id: 2, item: 'Lawn Mower', user: 'Jane Smith', status: 'Active', returnDate: '2024-11-15' }, + ]; + }; + + const fetchUsers = async () => { + return [ + { id: 1, name: 'John Doe', email: 'john@example.com', feedback: 'Excellent service!' }, + { id: 2, name: 'Jane Smith', email: 'jane@example.com', feedback: 'Very helpful!' }, + ]; + }; + + const fetchAnalytics = async () => { + return { + popularProducts: ['Tractor', 'Lawn Mower'], + revenue: '$1200', + rentalFrequency: ['Daily', 'Weekly'], + userBehavior: ['Frequently rented Tractor and Plow'], + }; + }; + + const handleAddProduct = () => { + // Add product logic + }; + + const handleUpdateProduct = (id) => { + // Update product logic + }; + + const handleDeleteProduct = (id) => { + setProducts(products.filter((product) => product.id !== id)); + }; + + const handleOrderApproval = (id) => { + setOrders(orders.map((order) => (order.id === id ? { ...order, status: 'Approved' } : order))); + }; + + const handleSendNotification = () => { + // Send notification logic + }; + + return ( +
+

Admin Dashboard

+ + {/* Product Management Section */} +
+

Product Management

+ +
+ {products.map((product) => ( +
+
+

{product.name}

+

{product.price} - {product.category} - {product.availability}

+
+
+ + +
+
+ ))} +
+
+ + {/* Order Management Section */} +
+

Order Management

+
+ {orders.map((order) => ( +
+
+

{order.item}

+

User: {order.user} - Status: {order.status} - Return Date: {order.returnDate}

+
+ +
+ ))} +
+
+ + {/* User Management Section */} +
+

User Management

+
+ {users.map((user) => ( +
+
+

{user.name}

+

Email: {user.email}

+

Feedback: {user.feedback}

+
+
+ ))} +
+
+ + {/* Analytics & Reporting Section */} +
+

Analytics & Reporting

+
+

Revenue: {analytics.revenue}

+

Popular Products: {analytics.popularProducts.join(', ')}

+

Rental Frequency: {analytics.rentalFrequency.join(', ')}

+

User Behavior: {analytics.userBehavior.join(', ')}

+ +
+
+ + {/* Notifications Section */} +
+

Notifications

+

Send reminders and alerts to users.

+ +
+
+ ); +}; + +export default RentAdminDashboard; diff --git a/frontend/src/MainContent.jsx b/frontend/src/MainContent.jsx index 0fbf2ca7..98b15f19 100644 --- a/frontend/src/MainContent.jsx +++ b/frontend/src/MainContent.jsx @@ -46,6 +46,7 @@ import ElectricalElectronicsShops from './components/ElectricalElectronicsShops' import HeroSectionRent from './AgroRentAI/HeroSectionRent'; import NavigateProducts from './AgroRentAI/NavigateProducts'; import RentUserDashboard from './AgroRentAI/RentUserDashboard'; +import RentAdminDashboard from './AgroRentAI/RentAdminDashboard'; //AgroShopAI import HomeShop from './AgroShopAI/pages/HomeShop'; import ShopFooter from './AgroShopAI/components/ShopFooter'; @@ -142,6 +143,7 @@ const MainContent = () => { } /> } /> } /> + } /> } /> {/* AgroShopAI Routes */} } /> @@ -152,7 +154,7 @@ const MainContent = () => { } /> } /> {/* Footer Links */} - } /> + } />~ } /> {checkShop ? :