Spaces:
Running
Running
Update templates/menu_page.html
Browse files- templates/menu_page.html +82 -52
templates/menu_page.html
CHANGED
@@ -4,19 +4,69 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Biryani Hub Menu</title>
|
7 |
-
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
8 |
<style>
|
9 |
-
body {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
.
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
.view-cart-button {
|
21 |
background-color: #007bff;
|
22 |
color: #fff;
|
@@ -37,39 +87,36 @@
|
|
37 |
</head>
|
38 |
<body>
|
39 |
|
40 |
-
<div class="
|
41 |
-
<h1>Welcome to the Menu</h1>
|
42 |
-
<!-- Buttons to select vegetarian or non-vegetarian menu -->
|
43 |
<div class="menu-option">
|
44 |
<button onclick="showMenu('veg')">Vegetarian Menu</button>
|
45 |
<button onclick="showMenu('nonVeg')">Non-Vegetarian Menu</button>
|
46 |
</div>
|
47 |
-
<div id="menu-items"></div>
|
48 |
-
<button onclick="viewCart()">View Cart</button>
|
49 |
</div>
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
<
|
54 |
-
|
55 |
-
<!-- Order history details will be dynamically loaded here -->
|
56 |
</div>
|
|
|
57 |
</div>
|
58 |
|
59 |
-
|
60 |
-
<div class="cart-container" id="cart-container" style="display:none;">
|
61 |
<h2>Your Cart</h2>
|
62 |
<div id="cart-items"></div>
|
63 |
<button onclick="placeOrder()">Place Final Order</button>
|
64 |
</div>
|
65 |
|
66 |
-
<div class="view-cart-
|
67 |
-
<a href="javascript:void(0);" onclick="viewCart()">
|
68 |
View Cart
|
69 |
</a>
|
70 |
</div>
|
71 |
|
72 |
<script>
|
|
|
73 |
const menuItems = {
|
74 |
veg: [
|
75 |
{ name: 'Samosa', price: 9, ingredients: 'Potatoes, Peas, Flour, Spices', description: 'Crispy fried pastry filled with spiced potatoes and peas.', imageUrl: 'https://via.placeholder.com/100' },
|
@@ -85,9 +132,15 @@
|
|
85 |
|
86 |
const cart = [];
|
87 |
|
|
|
88 |
function showMenu(type) {
|
|
|
|
|
|
|
|
|
89 |
const menuContainer = document.getElementById('menu-items');
|
90 |
menuContainer.innerHTML = ''; // Clear previous menu items
|
|
|
91 |
menuItems[type].forEach(item => {
|
92 |
const div = document.createElement('div');
|
93 |
div.classList.add('menu-item');
|
@@ -105,6 +158,7 @@
|
|
105 |
});
|
106 |
}
|
107 |
|
|
|
108 |
function addToCart(itemName) {
|
109 |
const quantity = prompt(`How many ${itemName} would you like to add?`, 1);
|
110 |
if (quantity && !isNaN(quantity) && quantity > 0) {
|
@@ -117,6 +171,7 @@
|
|
117 |
}
|
118 |
}
|
119 |
|
|
|
120 |
function viewCart() {
|
121 |
const cartContainer = document.getElementById('cart-container');
|
122 |
const cartItemsContainer = document.getElementById('cart-items');
|
@@ -130,6 +185,7 @@
|
|
130 |
cartContainer.style.display = 'block';
|
131 |
}
|
132 |
|
|
|
133 |
function placeOrder() {
|
134 |
if (cart.length > 0) {
|
135 |
alert("Your order has been placed successfully!");
|
@@ -139,32 +195,6 @@
|
|
139 |
alert("Your cart is empty. Please add items before placing the order.");
|
140 |
}
|
141 |
}
|
142 |
-
|
143 |
-
// Example Order History (You can fetch this dynamically from the backend)
|
144 |
-
const orders = [
|
145 |
-
{ date: '2023-02-20', orderDetails: 'Chicken Biryani, Butter Chicken', totalAmount: 45, status: 'Completed' },
|
146 |
-
{ date: '2023-02-19', orderDetails: 'Paneer Butter Masala, Vegetable Biryani', totalAmount: 35, status: 'Pending' },
|
147 |
-
{ date: '2023-02-18', orderDetails: 'Mutton Biryani, Chicken Shawarma', totalAmount: 60, status: 'Cancelled' }
|
148 |
-
];
|
149 |
-
|
150 |
-
// Render Order History
|
151 |
-
const orderHistoryContainer = document.getElementById('order-history');
|
152 |
-
if (orders.length > 0) {
|
153 |
-
orders.forEach(order => {
|
154 |
-
const orderCard = document.createElement('div');
|
155 |
-
orderCard.classList.add('order-card');
|
156 |
-
orderCard.innerHTML = `
|
157 |
-
<p><strong>Date:</strong> ${order.date}</p>
|
158 |
-
<p><strong>Order:</strong> ${order.orderDetails}</p>
|
159 |
-
<p><strong>Total Amount:</strong> $${order.totalAmount}</p>
|
160 |
-
<p><span class="order-status ${order.status === 'Completed' ? 'status-completed' : order.status === 'Pending' ? 'status-pending' : 'status-cancelled'}">${order.status}</span></p>
|
161 |
-
`;
|
162 |
-
orderHistoryContainer.appendChild(orderCard);
|
163 |
-
});
|
164 |
-
} else {
|
165 |
-
orderHistoryContainer.innerHTML = '<p>No past orders found.</p>';
|
166 |
-
}
|
167 |
-
|
168 |
</script>
|
169 |
|
170 |
</body>
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Biryani Hub Menu</title>
|
|
|
7 |
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
background-color: #f8f8f8;
|
11 |
+
margin: 0;
|
12 |
+
padding: 0;
|
13 |
+
}
|
14 |
+
.container {
|
15 |
+
max-width: 1200px;
|
16 |
+
margin: 50px auto;
|
17 |
+
text-align: center;
|
18 |
+
}
|
19 |
+
h1 {
|
20 |
+
font-size: 2.5rem;
|
21 |
+
color: #333;
|
22 |
+
}
|
23 |
+
.menu-option button {
|
24 |
+
font-size: 1.2rem;
|
25 |
+
padding: 10px 20px;
|
26 |
+
margin: 20px;
|
27 |
+
cursor: pointer;
|
28 |
+
border: none;
|
29 |
+
border-radius: 5px;
|
30 |
+
background-color: #007bff;
|
31 |
+
color: white;
|
32 |
+
}
|
33 |
+
.menu-option button:hover {
|
34 |
+
background-color: #0056b3;
|
35 |
+
}
|
36 |
+
.menu-item {
|
37 |
+
display: inline-block;
|
38 |
+
width: 30%;
|
39 |
+
margin: 10px;
|
40 |
+
padding: 10px;
|
41 |
+
border: 1px solid #ddd;
|
42 |
+
border-radius: 5px;
|
43 |
+
background-color: #fff;
|
44 |
+
}
|
45 |
+
.menu-item img {
|
46 |
+
width: 100px;
|
47 |
+
height: 100px;
|
48 |
+
border-radius: 8px;
|
49 |
+
margin-bottom: 10px;
|
50 |
+
}
|
51 |
+
.cart-container {
|
52 |
+
margin-top: 30px;
|
53 |
+
padding: 10px;
|
54 |
+
border: 1px solid #ddd;
|
55 |
+
border-radius: 5px;
|
56 |
+
background-color: #eaf3e1;
|
57 |
+
display: none;
|
58 |
+
}
|
59 |
+
.cart-item {
|
60 |
+
display: flex;
|
61 |
+
justify-content: space-between;
|
62 |
+
margin-bottom: 10px;
|
63 |
+
}
|
64 |
+
.view-cart-container {
|
65 |
+
position: fixed;
|
66 |
+
bottom: 20px;
|
67 |
+
right: 20px;
|
68 |
+
z-index: 999;
|
69 |
+
}
|
70 |
.view-cart-button {
|
71 |
background-color: #007bff;
|
72 |
color: #fff;
|
|
|
87 |
</head>
|
88 |
<body>
|
89 |
|
90 |
+
<div class="container" id="welcome-container">
|
91 |
+
<h1>Welcome to the Biryani Hub Menu</h1>
|
|
|
92 |
<div class="menu-option">
|
93 |
<button onclick="showMenu('veg')">Vegetarian Menu</button>
|
94 |
<button onclick="showMenu('nonVeg')">Non-Vegetarian Menu</button>
|
95 |
</div>
|
|
|
|
|
96 |
</div>
|
97 |
|
98 |
+
<div class="container" id="menu-container" style="display: none;">
|
99 |
+
<h1>Menu</h1>
|
100 |
+
<div id="menu-items" class="row">
|
101 |
+
<!-- Dynamically populated menu items will appear here -->
|
|
|
102 |
</div>
|
103 |
+
<button onclick="viewCart()">View Cart</button>
|
104 |
</div>
|
105 |
|
106 |
+
<div class="cart-container" id="cart-container">
|
|
|
107 |
<h2>Your Cart</h2>
|
108 |
<div id="cart-items"></div>
|
109 |
<button onclick="placeOrder()">Place Final Order</button>
|
110 |
</div>
|
111 |
|
112 |
+
<div class="view-cart-container">
|
113 |
+
<a href="javascript:void(0);" class="view-cart-button" onclick="viewCart()">
|
114 |
View Cart
|
115 |
</a>
|
116 |
</div>
|
117 |
|
118 |
<script>
|
119 |
+
// Menu data
|
120 |
const menuItems = {
|
121 |
veg: [
|
122 |
{ name: 'Samosa', price: 9, ingredients: 'Potatoes, Peas, Flour, Spices', description: 'Crispy fried pastry filled with spiced potatoes and peas.', imageUrl: 'https://via.placeholder.com/100' },
|
|
|
132 |
|
133 |
const cart = [];
|
134 |
|
135 |
+
// Function to show the menu based on selected type
|
136 |
function showMenu(type) {
|
137 |
+
// Hide the welcome screen and show the menu
|
138 |
+
document.getElementById('welcome-container').style.display = 'none';
|
139 |
+
document.getElementById('menu-container').style.display = 'block';
|
140 |
+
|
141 |
const menuContainer = document.getElementById('menu-items');
|
142 |
menuContainer.innerHTML = ''; // Clear previous menu items
|
143 |
+
|
144 |
menuItems[type].forEach(item => {
|
145 |
const div = document.createElement('div');
|
146 |
div.classList.add('menu-item');
|
|
|
158 |
});
|
159 |
}
|
160 |
|
161 |
+
// Function to add items to the cart
|
162 |
function addToCart(itemName) {
|
163 |
const quantity = prompt(`How many ${itemName} would you like to add?`, 1);
|
164 |
if (quantity && !isNaN(quantity) && quantity > 0) {
|
|
|
171 |
}
|
172 |
}
|
173 |
|
174 |
+
// Function to view the cart
|
175 |
function viewCart() {
|
176 |
const cartContainer = document.getElementById('cart-container');
|
177 |
const cartItemsContainer = document.getElementById('cart-items');
|
|
|
185 |
cartContainer.style.display = 'block';
|
186 |
}
|
187 |
|
188 |
+
// Function to place the final order
|
189 |
function placeOrder() {
|
190 |
if (cart.length > 0) {
|
191 |
alert("Your order has been placed successfully!");
|
|
|
195 |
alert("Your cart is empty. Please add items before placing the order.");
|
196 |
}
|
197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
</script>
|
199 |
|
200 |
</body>
|