Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +236 -205
templates/menu.html
CHANGED
@@ -1,281 +1,312 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
-
|
4 |
<head>
|
5 |
<meta charset="UTF-8">
|
6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
-
<title>
|
8 |
-
|
9 |
-
<!-- Bootstrap CSS -->
|
10 |
-
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
11 |
-
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
|
12 |
-
|
13 |
<style>
|
14 |
-
/*
|
15 |
body {
|
16 |
font-family: Arial, sans-serif;
|
17 |
-
background-color: #
|
18 |
margin: 0;
|
19 |
padding: 0;
|
20 |
-
display: flex;
|
21 |
-
flex-direction: column;
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
}
|
28 |
|
29 |
-
.menu-
|
30 |
-
|
31 |
-
border-radius: 15px;
|
32 |
-
overflow: hidden;
|
33 |
-
background-color: #fff;
|
34 |
-
margin: auto;
|
35 |
-
display: flex;
|
36 |
-
flex-direction: column;
|
37 |
-
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
38 |
}
|
39 |
|
40 |
-
.menu-
|
41 |
-
|
42 |
-
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
43 |
}
|
44 |
|
45 |
-
.menu-
|
46 |
-
|
47 |
-
|
48 |
-
object-fit: cover;
|
49 |
-
border-radius: 15px 15px 0 0;
|
50 |
-
cursor: pointer;
|
51 |
}
|
52 |
|
53 |
-
.menu-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
57 |
-
.
|
58 |
-
|
59 |
-
font-
|
60 |
-
margin: 10px 0;
|
61 |
}
|
62 |
|
63 |
-
.
|
64 |
-
|
65 |
-
|
|
|
66 |
}
|
67 |
|
68 |
-
.
|
69 |
-
|
70 |
-
|
|
|
|
|
71 |
border-radius: 5px;
|
72 |
-
|
73 |
-
background-color: #0FAA39;
|
74 |
-
border-color: #0FAA39;
|
75 |
}
|
76 |
|
77 |
-
.
|
78 |
-
background-color: #
|
79 |
-
border-color: #0FAA39;
|
80 |
}
|
81 |
|
82 |
-
.
|
83 |
-
|
84 |
-
background-color: #
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
94 |
}
|
95 |
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
97 |
width: 100%;
|
98 |
-
|
99 |
}
|
100 |
|
101 |
-
.
|
102 |
-
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
-
.
|
106 |
-
font-size:
|
107 |
-
|
108 |
}
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
bottom: 20px;
|
114 |
-
right: 20px;
|
115 |
-
z-index: 999;
|
116 |
}
|
117 |
|
118 |
-
.
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
121 |
padding: 10px 20px;
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
display: flex;
|
128 |
-
|
129 |
-
|
130 |
}
|
131 |
|
132 |
-
.
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
|
|
|
|
|
|
|
137 |
</style>
|
138 |
</head>
|
139 |
-
|
140 |
<body>
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
<
|
157 |
-
<p class="card-text">$15.99</p>
|
158 |
-
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
|
159 |
-
onclick="showItemDetails('Chicken Biryani', 15.99, 'chicken-biryani.jpg', 'Delicious spicy chicken biryani.', 'Biryani', 'Non-Veg')">
|
160 |
-
Add to Cart
|
161 |
-
</button>
|
162 |
</div>
|
|
|
163 |
</div>
|
164 |
-
|
165 |
</div>
|
166 |
-
</div>
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
<h5 class="modal-title" id="videoModalLabel">Chicken Biryani Video</h5>
|
181 |
-
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
182 |
-
</div>
|
183 |
-
<div class="modal-body">
|
184 |
-
<!-- Video Player -->
|
185 |
-
<video id="modal-video" class="embed-responsive-item" controls>
|
186 |
-
<source id="video-source" src="" type="video/mp4">
|
187 |
-
Your browser does not support the video tag.
|
188 |
-
</video>
|
189 |
-
</div>
|
190 |
-
</div>
|
191 |
</div>
|
192 |
</div>
|
193 |
|
194 |
-
<!--
|
195 |
-
<div
|
196 |
-
<
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
<!-- Item Image -->
|
204 |
-
<img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image"
|
205 |
-
style="max-height: 200px; object-fit: cover;">
|
206 |
-
<!-- Item Name -->
|
207 |
-
<h5 id="modal-name" class="fw-bold text-center"></h5>
|
208 |
-
<!-- Item Price -->
|
209 |
-
<p id="modal-price" class="text-muted text-center"></p>
|
210 |
-
<!-- Item Description -->
|
211 |
-
<p id="modal-description" class="text-secondary"></p>
|
212 |
-
<!-- Add-ons -->
|
213 |
-
<div id="modal-addons" class="modal-addons mt-4">
|
214 |
-
<h6>Customization Options</h6>
|
215 |
-
<div id="addons-list" class="addons-container">Loading customization options...</div>
|
216 |
-
</div>
|
217 |
-
<div class="mt-4">
|
218 |
-
<h6>Custom Request</h6>
|
219 |
-
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
220 |
-
</div>
|
221 |
-
<span id="modal-section" data-section="" data-category="" style="display: none;"></span>
|
222 |
-
</div>
|
223 |
-
<!-- Quantity Controls and Add to Cart Button -->
|
224 |
-
<div class="modal-footer d-flex align-items-center justify-content-between">
|
225 |
-
<!-- Quantity Controls -->
|
226 |
-
<div class="d-flex align-items-center gap-2">
|
227 |
-
<button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
|
228 |
-
<input type="text" class="form-control text-center" id="quantityInput" value="1" readonly
|
229 |
-
style="width: 50px;" />
|
230 |
-
<button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
|
231 |
-
</div>
|
232 |
-
<!-- Add to Cart Button -->
|
233 |
-
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
|
234 |
-
</div>
|
235 |
-
</div>
|
236 |
</div>
|
237 |
</div>
|
238 |
|
239 |
-
<!--
|
|
|
|
|
|
|
|
|
|
|
240 |
<script>
|
241 |
-
|
242 |
-
const videoElement = document.getElementById('modal-video');
|
243 |
-
const videoSource = document.getElementById('video-source');
|
244 |
-
videoSource.src = videoUrl;
|
245 |
-
videoElement.load(); // Reload the video element to apply the new source
|
246 |
-
const videoModal = new bootstrap.Modal(document.getElementById('videoModal'));
|
247 |
-
videoModal.show();
|
248 |
-
}
|
249 |
|
250 |
-
//
|
251 |
-
function
|
252 |
-
|
253 |
-
|
254 |
-
document.getElementById('modal-img').src = image || '/static/placeholder.jpg';
|
255 |
-
document.getElementById('modal-description').innerText = description || 'No description available.';
|
256 |
-
document.getElementById('addons-list').innerHTML = 'Loading customization options...';
|
257 |
}
|
258 |
|
259 |
-
//
|
260 |
-
function
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
|
|
265 |
|
266 |
-
|
267 |
-
console.log(`Adding ${itemName} to cart with quantity ${quantity} and price $${itemPrice}`);
|
268 |
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
}
|
274 |
-
</script>
|
275 |
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
|
279 |
</body>
|
280 |
-
|
281 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Menu Page</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
|
|
|
|
|
|
|
|
8 |
<style>
|
9 |
+
/* Basic Styles */
|
10 |
body {
|
11 |
font-family: Arial, sans-serif;
|
12 |
+
background-color: #f4f4f4;
|
13 |
margin: 0;
|
14 |
padding: 0;
|
|
|
|
|
15 |
}
|
16 |
|
17 |
+
header {
|
18 |
+
background-color: #333;
|
19 |
+
color: white;
|
20 |
+
padding: 15px;
|
21 |
+
text-align: center;
|
22 |
}
|
23 |
|
24 |
+
.menu-container {
|
25 |
+
margin: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
+
.menu-category {
|
29 |
+
margin-bottom: 20px;
|
|
|
30 |
}
|
31 |
|
32 |
+
.menu-category h2 {
|
33 |
+
text-align: center;
|
34 |
+
font-size: 24px;
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
+
.menu-item {
|
38 |
+
background-color: white;
|
39 |
+
padding: 10px;
|
40 |
+
margin-bottom: 10px;
|
41 |
+
border-radius: 5px;
|
42 |
+
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
|
43 |
+
display: flex;
|
44 |
+
justify-content: space-between;
|
45 |
+
align-items: center;
|
46 |
}
|
47 |
|
48 |
+
.menu-item h3 {
|
49 |
+
margin: 0;
|
50 |
+
font-size: 20px;
|
|
|
51 |
}
|
52 |
|
53 |
+
.menu-item p {
|
54 |
+
margin: 0;
|
55 |
+
font-size: 16px;
|
56 |
+
color: #888;
|
57 |
}
|
58 |
|
59 |
+
.menu-item button {
|
60 |
+
padding: 8px 12px;
|
61 |
+
background-color: #28a745;
|
62 |
+
color: white;
|
63 |
+
border: none;
|
64 |
border-radius: 5px;
|
65 |
+
cursor: pointer;
|
|
|
|
|
66 |
}
|
67 |
|
68 |
+
.menu-item button:hover {
|
69 |
+
background-color: #218838;
|
|
|
70 |
}
|
71 |
|
72 |
+
.cart-button {
|
73 |
+
padding: 12px 20px;
|
74 |
+
background-color: #007bff;
|
75 |
+
color: white;
|
76 |
+
border: none;
|
77 |
+
border-radius: 5px;
|
78 |
+
text-align: center;
|
79 |
+
font-size: 18px;
|
80 |
+
cursor: pointer;
|
81 |
+
width: 100%;
|
82 |
}
|
83 |
|
84 |
+
.cart-button:hover {
|
85 |
+
background-color: #0056b3;
|
86 |
+
}
|
87 |
+
|
88 |
+
.cart-icon {
|
89 |
+
margin-right: 8px;
|
90 |
}
|
91 |
|
92 |
+
footer {
|
93 |
+
text-align: center;
|
94 |
+
padding: 10px;
|
95 |
+
background-color: #333;
|
96 |
+
color: white;
|
97 |
+
position: fixed;
|
98 |
width: 100%;
|
99 |
+
bottom: 0;
|
100 |
}
|
101 |
|
102 |
+
.order-summary {
|
103 |
+
margin: 20px;
|
104 |
+
padding: 20px;
|
105 |
+
background-color: white;
|
106 |
+
border-radius: 5px;
|
107 |
+
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
|
108 |
}
|
109 |
|
110 |
+
.order-summary h3 {
|
111 |
+
font-size: 24px;
|
112 |
+
text-align: center;
|
113 |
}
|
114 |
|
115 |
+
.order-summary ul {
|
116 |
+
list-style-type: none;
|
117 |
+
padding: 0;
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
+
.order-summary li {
|
121 |
+
padding: 10px;
|
122 |
+
border-bottom: 1px solid #ddd;
|
123 |
+
display: flex;
|
124 |
+
justify-content: space-between;
|
125 |
+
}
|
126 |
+
|
127 |
+
.order-summary button {
|
128 |
padding: 10px 20px;
|
129 |
+
background-color: #007bff;
|
130 |
+
color: white;
|
131 |
+
border: none;
|
132 |
+
border-radius: 5px;
|
133 |
+
font-size: 18px;
|
134 |
+
cursor: pointer;
|
135 |
+
}
|
136 |
+
|
137 |
+
.order-summary button:hover {
|
138 |
+
background-color: #0056b3;
|
139 |
+
}
|
140 |
+
|
141 |
+
.cart-summary {
|
142 |
display: flex;
|
143 |
+
justify-content: space-between;
|
144 |
+
margin-top: 20px;
|
145 |
}
|
146 |
|
147 |
+
.cart-summary span {
|
148 |
+
font-size: 18px;
|
149 |
+
font-weight: bold;
|
150 |
+
}
|
151 |
+
|
152 |
+
.cart-summary button {
|
153 |
+
background-color: #28a745;
|
154 |
+
}
|
155 |
+
|
156 |
+
.logout-button {
|
157 |
+
padding: 12px 20px;
|
158 |
+
background-color: #dc3545;
|
159 |
+
color: white;
|
160 |
+
border: none;
|
161 |
+
border-radius: 5px;
|
162 |
+
font-size: 18px;
|
163 |
+
cursor: pointer;
|
164 |
+
width: 100%;
|
165 |
+
margin-top: 20px;
|
166 |
}
|
167 |
|
168 |
+
.logout-button:hover {
|
169 |
+
background-color: #c82333;
|
170 |
+
}
|
171 |
</style>
|
172 |
</head>
|
|
|
173 |
<body>
|
174 |
|
175 |
+
<!-- Header -->
|
176 |
+
<header>
|
177 |
+
<h1>Welcome to Our Restaurant</h1>
|
178 |
+
</header>
|
179 |
+
|
180 |
+
<!-- Menu Content -->
|
181 |
+
<div class="menu-container">
|
182 |
+
<!-- Main Course Category -->
|
183 |
+
<div class="menu-category">
|
184 |
+
<h2>Main Course</h2>
|
185 |
+
{% for item in menu_items %}
|
186 |
+
<div class="menu-item">
|
187 |
+
<div>
|
188 |
+
<h3>{{ item.name }}</h3>
|
189 |
+
<p>Price: ₹{{ item.price }}</p>
|
|
|
|
|
|
|
|
|
|
|
190 |
</div>
|
191 |
+
<button onclick="addToCart('{{ item.name }}', {{ item.price }}, '{{ item.category }}')">Add to Cart</button>
|
192 |
</div>
|
193 |
+
{% endfor %}
|
194 |
</div>
|
|
|
195 |
|
196 |
+
<!-- Cart Button -->
|
197 |
+
<div class="menu-category">
|
198 |
+
<button class="cart-button" onclick="showCart()">
|
199 |
+
<i class="fas fa-shopping-cart cart-icon"></i> View Cart
|
200 |
+
</button>
|
201 |
+
</div>
|
202 |
|
203 |
+
<!-- Logout Button -->
|
204 |
+
<div class="menu-category">
|
205 |
+
<button class="logout-button" onclick="logout()">
|
206 |
+
<i class="fas fa-sign-out-alt cart-icon"></i> Logout
|
207 |
+
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
</div>
|
209 |
</div>
|
210 |
|
211 |
+
<!-- Cart Summary (hidden initially) -->
|
212 |
+
<div id="cart-summary" class="order-summary" style="display:none;">
|
213 |
+
<h3>Your Cart</h3>
|
214 |
+
<ul id="cart-items-list">
|
215 |
+
<!-- Cart items will be dynamically listed here -->
|
216 |
+
</ul>
|
217 |
+
<div class="cart-summary">
|
218 |
+
<span>Total: ₹<span id="total-price">0</span></span>
|
219 |
+
<button onclick="placeOrder()">Place Order</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
</div>
|
221 |
</div>
|
222 |
|
223 |
+
<!-- Footer -->
|
224 |
+
<footer>
|
225 |
+
<p>Restaurant © 2025</p>
|
226 |
+
</footer>
|
227 |
+
|
228 |
+
<!-- JavaScript -->
|
229 |
<script>
|
230 |
+
let cart = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
// Add item to cart
|
233 |
+
function addToCart(itemName, itemPrice, itemCategory) {
|
234 |
+
cart.push({ name: itemName, price: itemPrice, category: itemCategory });
|
235 |
+
alert(`${itemName} added to cart!`);
|
|
|
|
|
|
|
236 |
}
|
237 |
|
238 |
+
// Show cart and order summary
|
239 |
+
function showCart() {
|
240 |
+
if (cart.length === 0) {
|
241 |
+
alert("Your cart is empty!");
|
242 |
+
return;
|
243 |
+
}
|
244 |
+
|
245 |
+
// Update cart items list
|
246 |
+
const cartItemsList = document.getElementById('cart-items-list');
|
247 |
+
cartItemsList.innerHTML = '';
|
248 |
|
249 |
+
let totalPrice = 0;
|
|
|
250 |
|
251 |
+
cart.forEach(item => {
|
252 |
+
const li = document.createElement('li');
|
253 |
+
li.innerHTML = `${item.name} - ₹${item.price}`;
|
254 |
+
cartItemsList.appendChild(li);
|
255 |
+
totalPrice += item.price;
|
256 |
+
});
|
257 |
+
|
258 |
+
// Update total price
|
259 |
+
document.getElementById('total-price').textContent = totalPrice;
|
260 |
+
|
261 |
+
// Show cart summary
|
262 |
+
document.getElementById('cart-summary').style.display = 'block';
|
263 |
+
}
|
264 |
+
|
265 |
+
// Place the order
|
266 |
+
function placeOrder() {
|
267 |
+
if (cart.length === 0) {
|
268 |
+
alert("Your cart is empty, cannot place the order.");
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
|
272 |
+
// Send the order to the backend (POST request)
|
273 |
+
fetch('/order', {
|
274 |
+
method: 'POST',
|
275 |
+
headers: {
|
276 |
+
'Content-Type': 'application/json',
|
277 |
+
},
|
278 |
+
body: JSON.stringify({
|
279 |
+
customer_id: "user-id-placeholder", // Replace with actual user ID if necessary
|
280 |
+
items: cart.map(item => ({
|
281 |
+
item_id: item.name,
|
282 |
+
quantity: 1, // Assuming quantity is 1 for now
|
283 |
+
}))
|
284 |
+
})
|
285 |
+
})
|
286 |
+
.then(response => response.json())
|
287 |
+
.then(data => {
|
288 |
+
alert(data.message);
|
289 |
+
cart = []; // Clear cart after placing the order
|
290 |
+
document.getElementById('cart-summary').style.display = 'none'; // Hide cart summary
|
291 |
+
})
|
292 |
+
.catch(error => {
|
293 |
+
console.error('Error:', error);
|
294 |
+
alert('Error placing order');
|
295 |
+
});
|
296 |
}
|
|
|
297 |
|
298 |
+
// Logout
|
299 |
+
function logout() {
|
300 |
+
fetch('/logout')
|
301 |
+
.then(response => {
|
302 |
+
window.location.href = "/"; // Redirect to home page after logout
|
303 |
+
})
|
304 |
+
.catch(error => {
|
305 |
+
console.error('Error:', error);
|
306 |
+
alert('Error logging out');
|
307 |
+
});
|
308 |
+
}
|
309 |
+
</script>
|
310 |
|
311 |
</body>
|
|
|
312 |
</html>
|