Spaces:
Sleeping
Sleeping
Update templates/menu_page.html
Browse files- 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 |
-
|
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 |
-
/* 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 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
//
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|