mini
mini
Input-
Main:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Plant Shop</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="container">
<span class="navbar-toggler-icon"></span>
</button>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
<a href="#" class="nav-link" id="cartButton" data-bs-toggle="modal" data-bs-
target="#cartModal">
</a>
</li>
</ul>
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</div>
</nav>
<div class="carousel-inner">
</div>
</div>
<div class="carousel-item">
<img src="https://fortheloveofgardeners.com/wp-content/uploads/2024/04/Easy-Indoor-Plants-Low-
Maintenance-Beauties-for-Any-Home-Featured.jpg" class="d-block w-100" alt="Second Slide">
</div>
</div>
<div class="carousel-item">
<img
src="https://cdn.shopify.com/s/files/1/0551/6489/files/PS_Gift_Guide_Image_2_1024x1024.png?v=16067416
37" class="d-block w-100" alt="Third Slide">
<p class="lead">Add some greenery to your space with our beautiful plants.</p>
</div>
</div>
</div>
<span class="visually-hidden">Previous</span>
</button>
<span class="visually-hidden">Next</span>
</button>
</header>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
<div id="cartSection">
</div>
<h4>Checkout</h4>
<form id="checkoutForm">
<div class="mb-3">
</div>
<div class="mb-3">
</div>
<div class="mb-3">
<label for="address" class="form-label">Shipping Address</label>
</div>
<div class="mb-3">
<option value="paypal">PayPal</option>
</select>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div id="cartButtons">
</div>
<!-- Checkout Buttons (initially hidden) -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="card-body">
<p class="card-text">Discover your perfect plant! Our smart recommendations match you with
plants based on your lifestyle, home environment, and care preferences.</p>
</div>
</div>
</div>
<div class="card-body">
<p class="card-text">We bring nature to you with fast, safe delivery and plants carefully
packaged for freshness, ensuring they arrive healthy and vibrant.</p>
</div>
</div>
</div>
<div class="card-body">
<p class="card-text">Access a personalized plant care guide with tips, reminders, and
troubleshooting advice, all tailored to your plants' needs, ensuring they flourish!</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="card">
<div class="card-body">
<p class="card-text">$12.00</p>
<a href="#" class="btn btn-primary btn-add-to-cart" data-product-name="Ficcus plant" data-
product-price="12.00">Add to Cart</a>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<p class="card-text">$18.00</p>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<p class="card-text">$14.00</p>
</div>
</div>
</div>
<div class="card">
<img src="ccc.jpg" class="card-img-top" alt="Plant 7">
<div class="card-body">
<h5 class="card-title">Cactus</h5>
<p class="card-text">$8.00</p>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<p class="card-text">$22.00</p>
</div>
</div>
</div>
<div class="card">
<img src="https://wallpapers.com/images/file/snake-plant-pictures-3489-x-3489-
bzlb3yvavgnxs0y6.jpg" class="card-img-top" alt="Plant 7">
<div class="card-body">
<p class="card-text">$20.00</p>
</div>
</div>
</div>
<div class="card">
<img src="https://assets.bloomsflora.com/uploads/product-pics/13248_74_13248.webp"
class="card-img-top" alt="Plant 7">
<div class="card-body">
<p class="card-text">$15.00</p>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<p class="card-text">$10.00</p>
</div>
</div>
</div>
</div>
</div>
</section>
<p>At Paudha, we believe in bringing nature into your home with a variety of plants to fit every need.
Whether you're a seasoned gardener or a beginner, we have the perfect plant for you!</p>
</div>
</section>
<p>If you have any questions or inquiries, feel free to reach out to us!</p>
</div>
</section>
</footer>
<script>
localStorage.setItem('cart', JSON.stringify(cart));
updateCartDisplay();
function updateCartDisplay() {
document.getElementById('cartCount').textContent = cart.length;
cartItems.innerHTML = '';
let total = 0;
total += parseFloat(item.price);
const li = document.createElement('li');
cartItems.appendChild(li);
});
document.getElementById('cartTotal').textContent = total.toFixed(2);
function removeFromCart(index) {
cart.splice(index, 1);
localStorage.setItem('cart', JSON.stringify(cart));
updateCartDisplay();
function clearCart() {
cart = [];
localStorage.removeItem('cart');
updateCartDisplay();
function proceedToCheckout() {
if (cart.length === 0) {
return;
document.getElementById('cartSection').classList.add('d-none');
document.getElementById('checkoutSection').classList.remove('d-none');
document.getElementById('cartButtons').classList.add('d-none');
document.getElementById('checkoutButtons').classList.remove('d-none');
orderSummary.innerHTML = '';
let total = 0;
cart.forEach(item => {
total += parseFloat(item.price);
const li = document.createElement('li');
li.innerHTML = `<span>${item.name}</span><span>$${item.price}</span>`;
orderSummary.appendChild(li);
});
totalLi.innerHTML = `<span>Total</span><span>$${total.toFixed(2)}</span>`;
orderSummary.appendChild(totalLi);
function backToCart() {
document.getElementById('cartSection').classList.remove('d-none');
document.getElementById('checkoutSection').classList.add('d-none');
document.getElementById('cartButtons').classList.remove('d-none');
document.getElementById('checkoutButtons').classList.add('d-none');
function placeOrder() {
// Basic validation
return;
// Process the order (in a real application, you would send this to a server)
const orderData = {
customer: {
name: name,
email: email,
address: address,
payment: payment
},
items: cart,
};
document.getElementById('checkoutSection').classList.add('d-none');
document.getElementById('confirmationSection').classList.remove('d-none');
document.getElementById('checkoutButtons').classList.add('d-none');
document.getElementById('confirmationButtons').classList.remove('d-none');
document.getElementById('orderNumber').textContent = generateOrderNumber();
// Clear cart after successful order
clearCart();
function generateOrderNumber() {
function continueShopping() {
document.getElementById('cartSection').classList.remove('d-none');
document.getElementById('checkoutSection').classList.add('d-none');
document.getElementById('confirmationSection').classList.add('d-none');
document.getElementById('cartButtons').classList.remove('d-none');
document.getElementById('checkoutButtons').classList.add('d-none');
document.getElementById('confirmationButtons').classList.add('d-none');
document.querySelectorAll('.btn-add-to-cart').forEach(button => {
addToCart(name, price);
});
});
document.getElementById('clearCart').addEventListener('click', clearCart);
document.getElementById('checkoutButton').addEventListener('click', proceedToCheckout);
document.getElementById('backToCart').addEventListener('click', backToCart);
document.getElementById('placeOrder').addEventListener('click', placeOrder);
document.getElementById('continueShopping').addEventListener('click', continueShopping);
window.onload = updateCartDisplay;
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]
alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
CSS:
body {
line-height: 1.6;
/* Navbar customizations */
.navbar {
background-color: #012014;
.navbar .navbar-brand,
.navbar .nav-link {
color: #ecf0f1;
.navbar .nav-link:hover {
color: #5eeda8;
.dropdown-menu {
list-style: none;
position: absolute;
top: 100%;
left: 0;
background-color: #7d8575;
border-radius: 5px;
display: none;
z-index: 5;
.dropdown-menu li {
margin: 0;
.dropdown-menu a {
display:block;
color: white;
#carouselExample .carousel-item {
#carouselExample img {
height: 100%;
.carousel-caption {
bottom: 20%;
.carousel-caption h1 {
font-size: 3rem;
font-weight: bold;
.carousel-caption p {
font-size: 1.25rem;
#products .card {
border: none;
#products .card:hover {
transform: scale(1.05);
/* About Section */
#about {
background-color: #f4f4f4;
color: #333;
#about p {
font-size: 1.1rem;
line-height: 1.8;
/* Contact Section */
#contact {
background-color: #2c3e50;
color: #ecf0f1;
#contact .btn-primary {
background-color: #3a769d;
border: none;
#contact .btn-primary:hover {
background-color: #a9dcff;
/* Footer */
footer {
background-color: #2c3e50;
footer p {
margin: 0;
font-size: 1rem;
/* Custom Button */
.btn-primary {
background-color: #27ae60;
border: none;
.btn-primary:hover {
background-color: #8adaac;
}
/* Card Styles */
.card {
border-radius: 10px;
overflow: hidden;
.card-img-top {
.carousel-caption h1 {
font-size: 2.5rem;
.carousel-caption p {
font-size: 1rem;
Json file:
// Middleware
app.use(cors());
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));
// MongoDB Connection
mongoose.connect('mongodb://localhost:27017/plantShop', {
useNewUrlParser: true,
useUnifiedTopology: true
})
// Define Schemas
address: String,
});
description: String,
imageUrl: String,
});
user: {
items: [{
name: String,
price: Number,
}],
totalAmount: Number,
paymentMethod: String,
});
// Create models
// API Routes
try {
res.json(products);
} catch (error) {
});
res.json(product);
} catch (error) {
});
try {
user: {
name: req.body.customer.name,
email: req.body.customer.email,
address: req.body.customer.address
},
name: item.name,
price: item.price,
quantity: item.quantity || 1
})),
totalAmount: req.body.total,
paymentMethod: req.body.customer.payment,
orderNumber: orderNumber
});
res.status(201).json({
message: 'Order created successfully',
orderNumber: savedOrder.orderNumber,
orderId: savedOrder._id
});
} catch (error) {
});
try {
res.json(orders);
} catch (error) {
});
try {
if (existingUser) {
name: req.body.name,
email: req.body.email,
address: req.body.address
});
const savedUser = await newUser.save();
res.status(201).json(savedUser);
} catch (error) {
});
try {
const sampleProducts = [
{ name: 'Ficcus plant', price: 12.00, description: 'Beautiful indoor plant', imageUrl: 'f.jpg' },
{ name: 'Peace Lily', price: 18.00, description: 'Elegant flowering plant', imageUrl: 'ppp.jpeg' },
{ name: 'Spider Plant', price: 14.00, description: 'Air-purifying plant', imageUrl: 'spider-plant.jpg' },
{ name: 'Cactus', price: 8.00, description: 'Low-maintenance desert plant', imageUrl: 'ccc.jpg' },
{ name: 'Bamboo Palm', price: 22.00, description: 'Tropical indoor palm', imageUrl: 'ct.jpeg' },
{ name: 'Snake plant', price: 20.00, description: 'Low-light tolerant succulent', imageUrl:
'https://wallpapers.com/images/file/snake-plant-pictures-3489-x-3489-bzlb3yvavgnxs0y6.jpg' },
{ name: 'Golden money plant', price: 15.00, description: 'Feng shui prosperity plant', imageUrl:
'https://assets.bloomsflora.com/uploads/product-pics/13248_74_13248.webp' },
{ name: 'Jade plant', price: 10.00, description: 'Succulent with round leaves', imageUrl: 'ja.jpg' }
];
await Product.deleteMany({});
res.status(201).json({
products
});
} catch (error) {
});
});
app.listen(PORT, () => {
});