Swathi6 commited on
Commit
5169f7c
·
verified ·
1 Parent(s): 3a87e27

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. 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>Biryani Hub Menu</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
- /* General Styles */
15
  body {
16
  font-family: Arial, sans-serif;
17
- background-color: #fdf4e3;
18
  margin: 0;
19
  padding: 0;
20
- display: flex;
21
- flex-direction: column;
22
  }
23
 
24
- .container {
25
- max-width: 900px;
26
- margin-top: 50px;
 
 
27
  }
28
 
29
- .menu-card {
30
- max-width: 350px;
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-card:hover {
41
- transform: scale(1.05);
42
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
43
  }
44
 
45
- .menu-image {
46
- height: 200px;
47
- width: 100%;
48
- object-fit: cover;
49
- border-radius: 15px 15px 0 0;
50
- cursor: pointer;
51
  }
52
 
53
- .menu-image:hover {
54
- transform: scale(1.05);
 
 
 
 
 
 
 
55
  }
56
 
57
- .card-title {
58
- font-size: 1.2rem;
59
- font-weight: bold;
60
- margin: 10px 0;
61
  }
62
 
63
- .card-text {
64
- font-size: 1rem;
65
- color: #6c757d;
 
66
  }
67
 
68
- .btn-primary {
69
- font-size: 13px;
70
- font-weight: bold;
 
 
71
  border-radius: 5px;
72
- width: 100px;
73
- background-color: #0FAA39;
74
- border-color: #0FAA39;
75
  }
76
 
77
- .btn-primary:hover {
78
- background-color: #0FAA39;
79
- border-color: #0FAA39;
80
  }
81
 
82
- .btn-primary:active,
83
- .btn-primary:focus {
84
- background-color: #0FAA39;
85
- border-color: #ffffff;
86
- box-shadow: none;
 
 
 
 
 
87
  }
88
 
89
- /* Modal Video Styles */
90
- .modal-content {
91
- background-color: #fff;
92
- border-radius: 10px;
93
- padding: 20px;
 
94
  }
95
 
96
- #modal-video {
 
 
 
 
 
97
  width: 100%;
98
- height: auto;
99
  }
100
 
101
- .modal-header {
102
- border-bottom: none;
 
 
 
 
103
  }
104
 
105
- .modal-title {
106
- font-size: 1.5rem;
107
- font-weight: bold;
108
  }
109
 
110
- /* Fixed View Cart Button */
111
- .view-cart-container {
112
- position: fixed;
113
- bottom: 20px;
114
- right: 20px;
115
- z-index: 999;
116
  }
117
 
118
- .view-cart-button {
119
- background-color: #0FAA39;
120
- color: #fff;
 
 
 
 
 
121
  padding: 10px 20px;
122
- border-radius: 30px;
123
- font-size: 1rem;
124
- font-weight: bold;
125
- text-decoration: none;
126
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
 
 
 
 
 
 
 
 
127
  display: flex;
128
- align-items: center;
129
- justify-content: center;
130
  }
131
 
132
- .view-cart-button:hover {
133
- background-color: #109835;
134
- text-decoration: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
 
 
 
 
137
  </style>
138
  </head>
139
-
140
  <body>
141
 
142
- <div class="container">
143
- <h1 class="text-center">Biryani Hub Menu</h1>
144
-
145
- <!-- Menu Item: Chicken Biryani -->
146
- <h3 class="mt-4">Our Special Menu</h3>
147
- <div class="row">
148
- <!-- Item 1: Chicken Biryani -->
149
- <div class="col-md-4 mb-4">
150
- <div class="card menu-card">
151
- <!-- Image for Chicken Biryani, clicking triggers video modal -->
152
- <img src="chicken-biryani.jpg" class="card-img-top menu-image" alt="Chicken Biryani"
153
- data-video-url="https://www.w3schools.com/html/movie.mp4" <!-- Replace with actual video URL -->
154
- onclick="showVideo('https://www.w3schools.com/html/movie.mp4')">
155
- <div class="card-body">
156
- <h5 class="card-title">Chicken Biryani</h5>
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
- </div>
165
  </div>
166
- </div>
167
 
168
- <!-- View Cart Button -->
169
- <div class="view-cart-container">
170
- <a href="/cart" class="view-cart-button">
171
- View Cart
172
- </a>
173
- </div>
174
 
175
- <!-- Video Modal for Chicken Biryani -->
176
- <div class="modal fade" id="videoModal" tabindex="-1" aria-labelledby="videoModalLabel" aria-hidden="true">
177
- <div class="modal-dialog modal-dialog-centered">
178
- <div class="modal-content">
179
- <div class="modal-header">
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
- <!-- Modal for Item Details -->
195
- <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
196
- <div class="modal-dialog modal-dialog-centered">
197
- <div class="modal-content">
198
- <div class="modal-header">
199
- <h5 class="modal-title" id="itemModalLabel">Item Details</h5>
200
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
201
- </div>
202
- <div class="modal-body">
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
- <!-- JavaScript for Handling Video Display on Image Click -->
 
 
 
 
 
240
  <script>
241
- function showVideo(videoUrl) {
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
- // Show item details in the modal
251
- function showItemDetails(name, price, image, description, section, selectedCategory) {
252
- document.getElementById('modal-name').innerText = name;
253
- document.getElementById('modal-price').innerText = `$${price}`;
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
- // Handle adding item to cart from the modal
260
- function addToCartFromModal() {
261
- const itemName = document.getElementById('modal-name').innerText;
262
- const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
263
- const itemImage = document.getElementById('modal-img').src;
264
- const quantity = parseInt(document.getElementById('quantityInput').value);
 
 
 
 
265
 
266
- // Add to cart logic here
267
- console.log(`Adding ${itemName} to cart with quantity ${quantity} and price $${itemPrice}`);
268
 
269
- // Close the modal after adding to cart
270
- const modal = document.getElementById('itemModal');
271
- const modalInstance = bootstrap.Modal.getInstance(modal);
272
- modalInstance.hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  }
274
- </script>
275
 
276
- <!-- Bootstrap JS -->
277
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
 
 
 
 
 
 
 
 
 
 
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 &copy; 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>