lokesh341 commited on
Commit
a64ad00
·
verified ·
1 Parent(s): 13b2891

Update templates/menu_page.html

Browse files
Files changed (1) hide show
  1. templates/menu_page.html +200 -171
templates/menu_page.html CHANGED
@@ -1,180 +1,209 @@
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>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
- .menu-container {
15
- max-width: 1200px;
16
- margin: 0 auto;
17
- padding: 20px;
18
- background-color: #4169E1;
19
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
20
- border-radius: 8px;
21
- margin-top: 50px;
22
- }
23
- h1 {
24
- text-align: center;
25
- font-size: 2.5rem;
26
- color: #87cefa;
27
- margin-bottom: 30px;
28
- }
29
- .menu-item {
30
- border-bottom: 1px solid #eee;
31
- padding: 15px 0;
32
- display: flex;
33
- justify-content: space-between;
34
- align-items: center;
35
- }
36
- .order-btn {
37
- padding: 10px 20px;
38
- background-color: #4caf50;
39
- color: white;
40
- border: none;
41
- border-radius: 5px;
42
- cursor: pointer;
43
- }
44
- .order-btn:hover {
45
- background-color: #45a049;
46
- }
47
- #main-course-btn,
48
- #appetizer-btn {
49
- padding: 10px 20px;
50
- background-color: orange;
51
- color: white;
52
- border: none;
53
- border-radius: 5px;
54
- cursor: pointer;
55
- font-size: 2.2rem;
56
- margin: 10px 0;
57
- }
58
- #main-course-btn:hover,
59
- #appetizer-btn:hover {
60
- background-color: #ff7f00;
61
- }
62
- /* Additional styling for pages */
63
- input, textarea {
64
- width: 100%;
65
- padding: 8px;
66
- margin: 5px 0 15px;
67
- border-radius: 4px;
68
- border: 1px solid #ccc;
69
- }
70
- /* Login styling */
71
- .login-container {
72
- text-align: center;
73
- margin-top: 50px;
74
- }
75
- .login-container input {
76
- width: 300px;
77
- margin-bottom: 20px;
78
- }
79
- </style>
80
  </head>
81
  <body>
82
 
83
- <!-- Login Page -->
84
- <div id="login-page" class="login-container">
85
- <h1>Biryani Hub - Login</h1>
86
- <form id="login-form">
87
- <input type="email" id="login-email" placeholder="Enter your email" required />
88
- <input type="tel" id="login-phone" placeholder="Enter your phone number" required />
89
- <button type="submit" class="order-btn">Login</button>
90
- </form>
91
- </div>
92
-
93
- <!-- Menu Page -->
94
- <div id="menu-page" class="menu-container" style="display: none;">
95
- <h1>Welcome to Biryani Hub Menu</h1>
96
- <h3>Please select a category:</h3>
97
- <button id="main-course-btn">Main Course</button>
98
- <button id="appetizer-btn">Appetizers</button>
99
- </div>
100
-
101
- <script>
102
- // Sample menu data
103
- const menuData = {
104
- 'Main Course': [
105
- { name: "Chicken Biryani", price: 250 },
106
- { name: "Veg Biryani", price: 200 },
107
- { name: "Mutton Biryani", price: 300 }
108
- ],
109
- 'Appetizers': [
110
- { name: "Paneer Tikka", price: 180 },
111
- { name: "Chicken Wings", price: 220 }
112
- ]
113
- };
114
-
115
- // User info storage
116
- let userEmail = "";
117
- let userPhone = "";
118
-
119
- // Select page elements
120
- const loginPage = document.getElementById('login-page');
121
- const menuPage = document.getElementById('menu-page');
122
-
123
- // Login form submission
124
- document.getElementById('login-form').addEventListener('submit', function(e) {
125
- e.preventDefault();
126
-
127
- // Get login input values
128
- userEmail = document.getElementById('login-email').value;
129
- userPhone = document.getElementById('login-phone').value;
130
-
131
- // Simple validation (you can expand this)
132
- if (userEmail && userPhone) {
133
- console.log(`Login successful! Email: ${userEmail}, Phone: ${userPhone}`);
134
-
135
- // Show menu page after successful login
136
- loginPage.style.display = 'none';
137
- menuPage.style.display = 'block';
138
- } else {
139
- alert("Please provide both email and phone number.");
140
- }
141
- });
142
-
143
- // Menu page logic
144
- document.getElementById("main-course-btn").addEventListener("click", () => {
145
- displayMenuItems('Main Course');
146
- });
147
-
148
- document.getElementById("appetizer-btn").addEventListener("click", () => {
149
- displayMenuItems('Appetizers');
150
- });
151
-
152
- // Function to display menu items based on category
153
- function displayMenuItems(category) {
154
- const menuContainer = document.createElement('div');
155
- menuContainer.classList.add('menu-items');
156
- const selectedCategoryData = menuData[category];
157
- selectedCategoryData.forEach(item => {
158
- const itemElement = document.createElement('div');
159
- itemElement.classList.add('menu-item');
160
- itemElement.innerHTML = `
161
- <div class="details">
162
- <h3>${item.name}</h3>
163
- <p class="price">Price: ₹${item.price}</p>
164
- </div>
165
- <button class="order-btn" onclick="addToCart('${item.name}', ${item.price}, 1)">Add to Cart</button>
166
- `;
167
- menuContainer.appendChild(itemElement);
168
- });
169
- menuPage.appendChild(menuContainer);
170
- }
171
-
172
- // Function to add an item to the cart
173
- function addToCart(name, price, quantity) {
174
- alert(`${name} added to cart!`);
175
- // Logic to add item to cart
176
- }
177
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
  </body>
180
  </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>Biryani Hub</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #f8f8f8;
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+ .menu-container, .cart-container {
15
+ max-width: 1200px;
16
+ margin: 0 auto;
17
+ padding: 20px;
18
+ background-color: #4169E1;
19
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
20
+ border-radius: 8px;
21
+ margin-top: 50px;
22
+ }
23
+ h1 {
24
+ text-align: center;
25
+ font-size: 2.5rem;
26
+ color: #87CEFA;
27
+ margin-bottom: 30px;
28
+ }
29
+ button {
30
+ padding: 10px 20px;
31
+ background-color: orange;
32
+ color: white;
33
+ border: none;
34
+ border-radius: 5px;
35
+ cursor: pointer;
36
+ font-size: 2.2rem;
37
+ margin: 10px 0;
38
+ }
39
+ button:hover {
40
+ background-color: #FF7F00;
41
+ }
42
+ .menu-item, .cart-item {
43
+ border-bottom: 1px solid #eee;
44
+ padding: 15px 0;
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: center;
48
+ }
49
+ .order-btn {
50
+ padding: 10px 20px;
51
+ background-color: #4CAF50;
52
+ color: white;
53
+ border: none;
54
+ border-radius: 5px;
55
+ cursor: pointer;
56
+ }
57
+ .order-btn:hover {
58
+ background-color: #45a049;
59
+ }
60
+ </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </head>
62
  <body>
63
 
64
+ <!-- Page 1: Welcome Page -->
65
+ <div class="menu-container" id="welcome-page">
66
+ <h1>Welcome to Biryani Hub Menu</h1>
67
+ <h3>Please choose a category:</h3>
68
+ <button id="main-course-btn">Main Course</button>
69
+ <button id="appetizer-btn">Appetizers</button>
70
+ </div>
71
+
72
+ <!-- Page 2: Menu Page -->
73
+ <div class="menu-container" id="menu-page" style="display: none;">
74
+ <h1 id="menu-title"></h1>
75
+ <div id="menu-items"></div>
76
+ <button class="order-btn" onclick="goToCart()">Go to Cart</button>
77
+ </div>
78
+
79
+ <!-- Page 3: Cart Page -->
80
+ <div class="cart-container" id="cart-page" style="display: none;">
81
+ <h1>Your Cart</h1>
82
+ <div id="cart-items"></div>
83
+ <button class="order-btn" onclick="placeOrder()">Place Order</button>
84
+ </div>
85
+
86
+ <script>
87
+ // Speech synthesis setup
88
+ const synth = window.speechSynthesis;
89
+ const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
90
+ recognition.lang = "en-US";
91
+ recognition.interimResults = false;
92
+
93
+ function speak(text) {
94
+ const msg = new SpeechSynthesisUtterance(text);
95
+ synth.speak(msg);
96
+ }
97
+
98
+ // Automatically speak out the options on page load
99
+ window.onload = function() {
100
+ speak("Welcome to Biryani Hub! We have the following categories: Main Course and Appetizers. Please say 'Main Course' or 'Appetizers' to select a category.");
101
+ recognition.start();
102
+ };
103
+
104
+ // Listen for voice commands
105
+ recognition.onresult = (event) => {
106
+ const categoryCommand = event.results[0][0].transcript.toLowerCase();
107
+ if (categoryCommand.includes("main course")) {
108
+ window.location.href = '/menu?category=Main%20Course';
109
+ } else if (categoryCommand.includes("appetizers")) {
110
+ window.location.href = '/menu?category=Appetizers';
111
+ } else {
112
+ speak("Sorry, I didn't understand that. Please say 'Main Course' or 'Appetizers'.");
113
+ }
114
+ };
115
+
116
+ // Sample menu data
117
+ const menuData = {
118
+ 'Main Course': [
119
+ { name: "Chicken Biryani", price: 250 },
120
+ { name: "Veg Biryani", price: 200 },
121
+ { name: "Mutton Biryani", price: 300 }
122
+ ],
123
+ 'Appetizers': [
124
+ { name: "Paneer Tikka", price: 180 },
125
+ { name: "Chicken Wings", price: 220 }
126
+ ]
127
+ };
128
+
129
+ let cart = [];
130
+
131
+ // Show the menu based on category selection
132
+ const urlParams = new URLSearchParams(window.location.search);
133
+ const category = urlParams.get('category') || 'Main Course';
134
+
135
+ document.getElementById("menu-title").textContent = category + " Menu";
136
+ const menuItemsContainer = document.getElementById("menu-items");
137
+
138
+ menuData[category].forEach(item => {
139
+ const itemDiv = document.createElement('div');
140
+ itemDiv.classList.add('menu-item');
141
+ itemDiv.innerHTML = `
142
+ <div>
143
+ <h3>${item.name}</h3>
144
+ <p>Price: ₹${item.price}</p>
145
+ </div>
146
+ <button class="order-btn" onclick="addToCart('${item.name}', ${item.price})">Add to Cart</button>
147
+ `;
148
+ menuItemsContainer.appendChild(itemDiv);
149
+ });
150
+
151
+ // Add items to the cart
152
+ function addToCart(name, price) {
153
+ cart.push({ name, price });
154
+ alert(`${name} added to cart!`);
155
+ }
156
+
157
+ // Navigate to the cart page
158
+ function goToCart() {
159
+ document.getElementById("welcome-page").style.display = "none";
160
+ document.getElementById("menu-page").style.display = "none";
161
+ document.getElementById("cart-page").style.display = "block";
162
+ populateCart();
163
+ }
164
+
165
+ // Populate the cart with items
166
+ function populateCart() {
167
+ const cartItemsContainer = document.getElementById("cart-items");
168
+ if (cart.length === 0) {
169
+ cartItemsContainer.innerHTML = "<p>Your cart is empty.</p>";
170
+ } else {
171
+ cart.forEach(item => {
172
+ const itemDiv = document.createElement("div");
173
+ itemDiv.classList.add("cart-item");
174
+ itemDiv.innerHTML = `
175
+ <div>
176
+ <h3>${item.name}</h3>
177
+ <p>Price: ₹${item.price}</p>
178
+ </div>
179
+ `;
180
+ cartItemsContainer.appendChild(itemDiv);
181
+ });
182
+ }
183
+ }
184
+
185
+ // Place the order (dummy function)
186
+ function placeOrder() {
187
+ const orderData = {
188
+ items: cart.map(item => ({
189
+ name: item.name,
190
+ price: item.price,
191
+ quantity: 1
192
+ }))
193
+ };
194
+
195
+ fetch("/order", {
196
+ method: "POST",
197
+ headers: {
198
+ "Content-Type": "application/json"
199
+ },
200
+ body: JSON.stringify(orderData)
201
+ })
202
+ .then(response => response.json())
203
+ .then(data => alert(data.message))
204
+ .catch(error => alert("There was an error placing your order"));
205
+ }
206
+ </script>
207
 
208
  </body>
209
  </html>