diff --git a/src/App.jsx b/src/App.jsx index c92a8a0..fac40eb 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -44,6 +44,10 @@ import Login from './pages/Login'; import Profile from './pages/Profile'; import DosageCalculator from './pages/DosageCalculator'; import HealthMetrics from './pages/HealthMetrics'; +import HospitalFinder from './pages/HospitalFinder'; +import CommunityForums from './pages/CommunityForums'; +import CorporateWellness from './pages/CorporateWellness'; +import PharmacyStore from './pages/PharmacyStore'; import Footer from './components/Footer'; import NotFound from './pages/NotFound'; @@ -346,6 +350,10 @@ function App() { } /> } /> } /> + } /> + } /> + } /> + } /> } /> } /> } /> diff --git a/src/pages/PharmacyStore.jsx b/src/pages/PharmacyStore.jsx new file mode 100644 index 0000000..45e3b0e --- /dev/null +++ b/src/pages/PharmacyStore.jsx @@ -0,0 +1,146 @@ +import React, { useState } from 'react'; +import { + Box, + Typography, + Container, + Grid, + Card, + CardContent, + CardMedia, + Button, + IconButton, + Badge, + Drawer, + List, + ListItem, + ListItemText, + Divider +} from '@mui/material'; +import { + ShoppingCart as CartIcon, + AddShoppingCart as AddCartIcon, + Delete as DeleteIcon +} from '@mui/icons-material'; + +const INVENTORY = [ + { id: '1', name: 'Paracetamol 500mg', price: 5.99, image: 'https://via.placeholder.com/150/e3f2fd/1976d2?text=Medicine' }, + { id: '2', name: 'Ibuprofen 400mg', price: 8.50, image: 'https://via.placeholder.com/150/e3f2fd/1976d2?text=Medicine' }, + { id: '3', name: 'Vitamin C 1000mg', price: 12.00, image: 'https://via.placeholder.com/150/e3f2fd/1976d2?text=Vitamins' }, + { id: '4', name: 'First Aid Kit', price: 24.99, image: 'https://via.placeholder.com/150/e3f2fd/1976d2?text=First+Aid' } +]; + +function PharmacyStore() { + const [cart, setCart] = useState([]); + const [cartOpen, setCartOpen] = useState(false); + + const addToCart = (item) => { + setCart((prev) => { + const existing = prev.find((p) => p.id === item.id); + if (existing) { + return prev.map((p) => (p.id === item.id ? { ...p, qty: p.qty + 1 } : p)); + } + return [...prev, { ...item, qty: 1 }]; + }); + }; + + const removeFromCart = (id) => { + setCart((prev) => prev.filter((p) => p.id !== id)); + }; + + const cartTotal = cart.reduce((sum, item) => sum + item.price * item.qty, 0).toFixed(2); + const cartCount = cart.reduce((sum, item) => sum + item.qty, 0); + + return ( + + + + CareSync Pharmacy + + setCartOpen(true)}> + + + + + + + + {INVENTORY.map((item) => ( + + + + + + {item.name} + + + ${item.price.toFixed(2)} + + + + + + ))} + + + setCartOpen(false)}> + + + Your Cart + + + + {cart.length === 0 ? ( + + Your cart is empty. + + ) : ( + + {cart.map((item) => ( + removeFromCart(item.id)}> + + + } + sx={{ px: 0 }} + > + + + ${(item.qty * item.price).toFixed(2)} + + + ))} + + )} + + {cart.length > 0 && ( + + + + Total: + ${cartTotal} + + + + )} + + + + ); +} + +export default PharmacyStore;