forked from anshxika/chammuch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
order_history.html
71 lines (60 loc) · 2.74 KB
/
order_history.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Order History</title>
<link rel="stylesheet" href="css files/order_history.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=DynaPuff:[email protected]&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Afacad+Flux:[email protected]&family=DynaPuff:[email protected]&display=swap" rel="stylesheet">
</head>
<body>
<nav class="navbar">
<div class="brand">
<i class="fas fa-utensils"></i> चमmuch
</div>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About us</a></li>
<li><a href="Login.html">Login</a>/<a href="signup.html">signup</a></li>
</ul>
</nav>
<div class="order-history-container">
<h2 class="order-history-header">Order History</h2>
<div class="order-history-grid" id="order-history-grid">
<!-- Order items will be dynamically populated here -->
</div>
<div class="cart-redirect">
<p>Want to order again? <a href="menu.html">Go to Menu</a></p>
</div>
</div>
<script>
// Function to load order history from localStorage
function loadOrderHistory() {
const orderHistory = JSON.parse(localStorage.getItem('orderHistory')) || [];
const orderHistoryGrid = document.getElementById('order-history-grid');
if (orderHistory.length === 0) {
orderHistoryGrid.innerHTML = '<p>No orders found.</p>';
return;
}
orderHistory.forEach(order => {
const orderItem = document.createElement('div');
orderItem.classList.add('menu-item');
orderItem.innerHTML = `
<div class="menu-img-container">
<img src="${order.image}" alt="${order.name}" class="menu-img">
</div>
<div class="menu-details">
<h3>${order.name}</h3>
<p>Price: ₹ ${order.price} | Quantity: ${order.quantity}</p>
</div>
`;
orderHistoryGrid.appendChild(orderItem);
});
}
// Call the function to load order history on page load
document.addEventListener('DOMContentLoaded', loadOrderHistory);
</script>
</body>
</html>