Spaces:
Running
Running
Update templates/menu_page.html
Browse files- templates/menu_page.html +301 -157
templates/menu_page.html
CHANGED
@@ -1,209 +1,353 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
body {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
}
|
14 |
.menu-container {
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
h1 {
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
}
|
29 |
.menu-item {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
}
|
36 |
.order-btn {
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
.order-btn:hover {
|
45 |
-
|
46 |
}
|
47 |
-
#main-course-btn,
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
56 |
}
|
57 |
-
#main-course-btn:hover,
|
58 |
-
|
|
|
59 |
}
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
-
</style>
|
64 |
</head>
|
65 |
<body>
|
66 |
|
67 |
-
<!-- Page 1:
|
68 |
-
<div id="page1" class="menu-container">
|
69 |
-
<h1>Welcome to Biryani Hub
|
70 |
<h3 id="category-title">Please select a category:</h3>
|
71 |
<button id="main-course-btn">Main Course</button>
|
72 |
<button id="appetizer-btn">Appetizers</button>
|
73 |
-
</div>
|
74 |
|
75 |
-
<!-- Page 2: Main Course Menu -->
|
76 |
-
<div id="main-course-page" class="menu-container" style="display: none;">
|
77 |
<h1>Main Course Menu</h1>
|
78 |
<div id="main-course-items"></div>
|
79 |
-
<button id="back-to-category-btn">Back to Category Selection</button>
|
80 |
-
</
|
|
|
81 |
|
82 |
-
<!-- Page 3: Appetizers Menu -->
|
83 |
-
<div id="appetizer-page" class="menu-container" style="display: none;">
|
84 |
<h1>Appetizers Menu</h1>
|
85 |
<div id="appetizer-items"></div>
|
86 |
-
<button id="back-to-category-btn2">Back to Category Selection</button>
|
87 |
-
</
|
|
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
{ name: "Chicken Biryani", price: 250 },
|
94 |
{ name: "Veg Biryani", price: 200 },
|
95 |
{ name: "Mutton Biryani", price: 300 }
|
96 |
-
|
97 |
-
|
98 |
{ name: "Paneer Tikka", price: 180 },
|
99 |
{ name: "Chicken Wings", price: 220 }
|
100 |
-
|
101 |
-
};
|
102 |
-
|
103 |
-
//
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
const
|
108 |
-
|
109 |
-
|
110 |
-
document.getElementById(
|
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 |
menuData[category].forEach(item => {
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
-
}
|
149 |
-
|
150 |
-
// Function to add an item to the cart
|
151 |
-
let cart = [];
|
152 |
-
function addToCart(itemName, quantity) {
|
153 |
-
const item = findItem(itemName);
|
154 |
-
cart.push({ name: item.name, price: item.price, quantity: quantity });
|
155 |
-
}
|
156 |
-
|
157 |
-
// Function to find item in the menu
|
158 |
-
function findItem(itemName) {
|
159 |
-
const menu = menuData['Main Course']; // Default category to check first
|
160 |
-
return menu.find(item => item.name.toLowerCase() === itemName.toLowerCase());
|
161 |
-
}
|
162 |
-
|
163 |
-
// Voice greeting for menu categories
|
164 |
-
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
165 |
-
recognition.lang = "en-US";
|
166 |
-
recognition.interimResults = false;
|
167 |
-
function speak(text) {
|
168 |
-
const msg = new SpeechSynthesisUtterance(text);
|
169 |
-
window.speechSynthesis.speak(msg);
|
170 |
-
}
|
171 |
-
|
172 |
-
window.onload = function() {
|
173 |
-
// Sample menu data for Main Course and Appetizers
|
174 |
-
menuData = {
|
175 |
-
'Main Course': [
|
176 |
-
{ name: "Chicken Biryani", price: 250 },
|
177 |
-
{ name: "Veg Biryani", price: 200 },
|
178 |
-
{ name: "Mutton Biryani", price: 300 }
|
179 |
-
],
|
180 |
-
'Appetizers': [
|
181 |
-
{ name: "Paneer Tikka", price: 180 },
|
182 |
-
{ name: "Chicken Wings", price: 220 }
|
183 |
-
]
|
184 |
-
};
|
185 |
|
186 |
-
//
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
-
//
|
190 |
-
recognition.
|
191 |
-
recognition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
const categoryCommand = event.results[0][0].transcript.toLowerCase();
|
193 |
if (categoryCommand.includes("main course")) {
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
} else if (categoryCommand.includes("appetizers")) {
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
} else {
|
202 |
-
|
203 |
}
|
|
|
204 |
};
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
</body>
|
209 |
</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 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 |
+
</style>
|
71 |
</head>
|
72 |
<body>
|
73 |
|
74 |
+
<!-- Page 1: Category Selection -->
|
75 |
+
<div id="page1" class="menu-container">
|
76 |
+
<h1>Welcome to Biryani Hub Menu</h1>
|
77 |
<h3 id="category-title">Please select a category:</h3>
|
78 |
<button id="main-course-btn">Main Course</button>
|
79 |
<button id="appetizer-btn">Appetizers</button>
|
80 |
+
</div>
|
81 |
|
82 |
+
<!-- Page 2: Main Course Menu -->
|
83 |
+
<div id="main-course-page" class="menu-container" style="display: none;">
|
84 |
<h1>Main Course Menu</h1>
|
85 |
<div id="main-course-items"></div>
|
86 |
+
<button id="back-to-category-btn" class="order-btn">Back to Category Selection</button>
|
87 |
+
<button id="view-cart-btn1" class="order-btn">View Cart</button>
|
88 |
+
</div>
|
89 |
|
90 |
+
<!-- Page 3: Appetizers Menu -->
|
91 |
+
<div id="appetizer-page" class="menu-container" style="display: none;">
|
92 |
<h1>Appetizers Menu</h1>
|
93 |
<div id="appetizer-items"></div>
|
94 |
+
<button id="back-to-category-btn2" class="order-btn">Back to Category Selection</button>
|
95 |
+
<button id="view-cart-btn2" class="order-btn">View Cart</button>
|
96 |
+
</div>
|
97 |
|
98 |
+
<!-- Page 4: Cart Summary -->
|
99 |
+
<div id="cart-page" class="menu-container" style="display: none;">
|
100 |
+
<h1>Your Cart</h1>
|
101 |
+
<div id="cart-items"></div>
|
102 |
+
<h3 id="cart-total"></h3>
|
103 |
+
<button id="back-to-menu-btn" class="order-btn">Back to Menu</button>
|
104 |
+
<button id="proceed-order-btn" class="order-btn">Place Order</button>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<!-- Page 5: Place Order -->
|
108 |
+
<div id="order-page" class="menu-container" style="display: none;">
|
109 |
+
<h1>Place Your Order</h1>
|
110 |
+
<form id="order-form">
|
111 |
+
<label for="customer-name">Name:</label>
|
112 |
+
<input type="text" id="customer-name" required />
|
113 |
+
|
114 |
+
<label for="customer-email">Email:</label>
|
115 |
+
<input type="email" id="customer-email" required />
|
116 |
+
|
117 |
+
<label for="customer-phone">Phone:</label>
|
118 |
+
<input type="tel" id="customer-phone" required />
|
119 |
+
|
120 |
+
<label for="customer-address">Address:</label>
|
121 |
+
<textarea id="customer-address" required></textarea>
|
122 |
+
|
123 |
+
<button type="submit" class="order-btn">Submit Order</button>
|
124 |
+
</form>
|
125 |
+
<button id="back-to-cart-btn" class="order-btn">Back to Cart</button>
|
126 |
+
</div>
|
127 |
+
|
128 |
+
<script>
|
129 |
+
// Sample menu data
|
130 |
+
const menuData = {
|
131 |
+
'Main Course': [
|
132 |
{ name: "Chicken Biryani", price: 250 },
|
133 |
{ name: "Veg Biryani", price: 200 },
|
134 |
{ name: "Mutton Biryani", price: 300 }
|
135 |
+
],
|
136 |
+
'Appetizers': [
|
137 |
{ name: "Paneer Tikka", price: 180 },
|
138 |
{ name: "Chicken Wings", price: 220 }
|
139 |
+
]
|
140 |
+
};
|
141 |
+
|
142 |
+
// Initialize cart as an empty array
|
143 |
+
let cart = [];
|
144 |
+
|
145 |
+
// Select page elements
|
146 |
+
const categoryPage = document.getElementById('page1');
|
147 |
+
const mainCoursePage = document.getElementById('main-course-page');
|
148 |
+
const appetizerPage = document.getElementById('appetizer-page');
|
149 |
+
const cartPage = document.getElementById('cart-page');
|
150 |
+
const orderPage = document.getElementById('order-page');
|
151 |
+
|
152 |
+
// Category selection event listeners
|
153 |
+
document.getElementById("main-course-btn").addEventListener("click", () => {
|
154 |
+
categoryPage.style.display = "none";
|
155 |
+
mainCoursePage.style.display = "block";
|
156 |
+
displayMenuItems('Main Course');
|
157 |
+
});
|
158 |
+
|
159 |
+
document.getElementById("appetizer-btn").addEventListener("click", () => {
|
160 |
+
categoryPage.style.display = "none";
|
161 |
+
appetizerPage.style.display = "block";
|
162 |
+
displayMenuItems('Appetizers');
|
163 |
+
});
|
164 |
+
|
165 |
+
// Back to category selection buttons
|
166 |
+
document.getElementById("back-to-category-btn").addEventListener("click", () => {
|
167 |
+
mainCoursePage.style.display = "none";
|
168 |
+
categoryPage.style.display = "block";
|
169 |
+
});
|
170 |
+
document.getElementById("back-to-category-btn2").addEventListener("click", () => {
|
171 |
+
appetizerPage.style.display = "none";
|
172 |
+
categoryPage.style.display = "block";
|
173 |
+
});
|
174 |
+
|
175 |
+
// View Cart buttons
|
176 |
+
document.getElementById("view-cart-btn1").addEventListener("click", () => {
|
177 |
+
mainCoursePage.style.display = "none";
|
178 |
+
cartPage.style.display = "block";
|
179 |
+
displayCartItems();
|
180 |
+
});
|
181 |
+
document.getElementById("view-cart-btn2").addEventListener("click", () => {
|
182 |
+
appetizerPage.style.display = "none";
|
183 |
+
cartPage.style.display = "block";
|
184 |
+
displayCartItems();
|
185 |
+
});
|
186 |
+
|
187 |
+
// Navigation from Cart page
|
188 |
+
document.getElementById("back-to-menu-btn").addEventListener("click", () => {
|
189 |
+
cartPage.style.display = "none";
|
190 |
+
categoryPage.style.display = "block";
|
191 |
+
});
|
192 |
+
|
193 |
+
document.getElementById("proceed-order-btn").addEventListener("click", () => {
|
194 |
+
cartPage.style.display = "none";
|
195 |
+
orderPage.style.display = "block";
|
196 |
});
|
|
|
197 |
|
198 |
+
// Navigation from Order page back to Cart
|
199 |
+
document.getElementById("back-to-cart-btn").addEventListener("click", () => {
|
200 |
+
orderPage.style.display = "none";
|
201 |
+
cartPage.style.display = "block";
|
202 |
+
displayCartItems();
|
203 |
+
});
|
204 |
+
|
205 |
+
// Function to populate menu items based on category
|
206 |
+
function displayMenuItems(category) {
|
207 |
+
const menuContainer = category === 'Main Course' ? document.getElementById('main-course-items') : document.getElementById('appetizer-items');
|
208 |
+
menuContainer.innerHTML = '';
|
209 |
+
if (menuData[category]) {
|
210 |
menuData[category].forEach(item => {
|
211 |
+
const itemElement = document.createElement('div');
|
212 |
+
itemElement.classList.add('menu-item');
|
213 |
+
itemElement.innerHTML = `
|
214 |
+
<div class="details">
|
215 |
+
<h3>${item.name}</h3>
|
216 |
+
<p class="price">Price: ₹${item.price}</p>
|
217 |
+
</div>
|
218 |
+
<button class="order-btn" onclick="addToCart('${item.name}', 1)">Order</button>
|
219 |
+
`;
|
220 |
+
menuContainer.appendChild(itemElement);
|
221 |
});
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
// Function to add an item to the cart
|
226 |
+
function addToCart(itemName, quantity) {
|
227 |
+
const item = findItem(itemName);
|
228 |
+
if (item) {
|
229 |
+
// Check if item already exists in the cart and update quantity
|
230 |
+
const cartItem = cart.find(ci => ci.name.toLowerCase() === itemName.toLowerCase());
|
231 |
+
if (cartItem) {
|
232 |
+
cartItem.quantity += quantity;
|
233 |
+
} else {
|
234 |
+
cart.push({ name: item.name, price: item.price, quantity: quantity });
|
235 |
+
}
|
236 |
+
alert(item.name + " added to cart!");
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
// Function to find item in the menu (checks both categories)
|
241 |
+
function findItem(itemName) {
|
242 |
+
let item = menuData['Main Course'].find(item => item.name.toLowerCase() === itemName.toLowerCase());
|
243 |
+
if (!item) {
|
244 |
+
item = menuData['Appetizers'].find(item => item.name.toLowerCase() === itemName.toLowerCase());
|
245 |
+
}
|
246 |
+
return item;
|
247 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
|
249 |
+
// Function to display cart items
|
250 |
+
function displayCartItems() {
|
251 |
+
const cartItemsContainer = document.getElementById('cart-items');
|
252 |
+
cartItemsContainer.innerHTML = '';
|
253 |
+
let total = 0;
|
254 |
+
if (cart.length === 0) {
|
255 |
+
cartItemsContainer.innerHTML = "<p>Your cart is empty.</p>";
|
256 |
+
} else {
|
257 |
+
cart.forEach(item => {
|
258 |
+
const itemDiv = document.createElement('div');
|
259 |
+
itemDiv.classList.add('menu-item');
|
260 |
+
itemDiv.innerHTML = `
|
261 |
+
<div class="details">
|
262 |
+
<h3>${item.name}</h3>
|
263 |
+
<p>Price: ₹${item.price} x ${item.quantity}</p>
|
264 |
+
</div>
|
265 |
+
`;
|
266 |
+
cartItemsContainer.appendChild(itemDiv);
|
267 |
+
total += item.price * item.quantity;
|
268 |
+
});
|
269 |
+
}
|
270 |
+
document.getElementById('cart-total').innerText = "Total: ₹" + total;
|
271 |
+
}
|
272 |
|
273 |
+
// Voice greeting for menu categories
|
274 |
+
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
|
275 |
+
recognition.lang = "en-US";
|
276 |
+
recognition.interimResults = false;
|
277 |
+
function speak(text) {
|
278 |
+
const msg = new SpeechSynthesisUtterance(text);
|
279 |
+
window.speechSynthesis.speak(msg);
|
280 |
+
}
|
281 |
+
|
282 |
+
window.onload = function() {
|
283 |
+
speak("Welcome to Biryani Hub! We have the following categories: Main Course and Appetizers. Please say 'Main Course' or 'Appetizers' to select a category.");
|
284 |
+
recognition.start();
|
285 |
+
recognition.onresult = (event) => {
|
286 |
const categoryCommand = event.results[0][0].transcript.toLowerCase();
|
287 |
if (categoryCommand.includes("main course")) {
|
288 |
+
displayMenuItems('Main Course');
|
289 |
+
mainCoursePage.style.display = "block";
|
290 |
+
categoryPage.style.display = "none";
|
291 |
} else if (categoryCommand.includes("appetizers")) {
|
292 |
+
displayMenuItems('Appetizers');
|
293 |
+
appetizerPage.style.display = "block";
|
294 |
+
categoryPage.style.display = "none";
|
295 |
} else {
|
296 |
+
speak("Sorry, I couldn't understand that. Please say 'Main Course' or 'Appetizers'.");
|
297 |
}
|
298 |
+
};
|
299 |
};
|
300 |
+
|
301 |
+
// Handle Order Form Submission and Salesforce integration
|
302 |
+
document.getElementById("order-form").addEventListener("submit", function(e) {
|
303 |
+
e.preventDefault();
|
304 |
+
// Gather customer details from form inputs
|
305 |
+
const customerName = document.getElementById("customer-name").value;
|
306 |
+
const customerEmail = document.getElementById("customer-email").value;
|
307 |
+
const customerPhone = document.getElementById("customer-phone").value;
|
308 |
+
const customerAddress = document.getElementById("customer-address").value;
|
309 |
+
|
310 |
+
// Calculate total amount
|
311 |
+
let total = 0;
|
312 |
+
cart.forEach(item => {
|
313 |
+
total += item.price * item.quantity;
|
314 |
+
});
|
315 |
+
|
316 |
+
// Prepare the order details
|
317 |
+
const orderDetails = {
|
318 |
+
customerName,
|
319 |
+
customerEmail,
|
320 |
+
customerPhone,
|
321 |
+
customerAddress,
|
322 |
+
items: cart,
|
323 |
+
totalAmount: total
|
324 |
+
};
|
325 |
+
|
326 |
+
// Example Salesforce integration
|
327 |
+
// Replace the URL below with your actual Salesforce endpoint and configure authentication as needed.
|
328 |
+
fetch('https://your-salesforce-endpoint.com/api/orders', {
|
329 |
+
method: 'POST',
|
330 |
+
headers: {
|
331 |
+
'Content-Type': 'application/json'
|
332 |
+
// Add any required authentication headers here.
|
333 |
+
},
|
334 |
+
body: JSON.stringify(orderDetails)
|
335 |
+
})
|
336 |
+
.then(response => response.json())
|
337 |
+
.then(data => {
|
338 |
+
alert("Order placed successfully! Order ID: " + data.orderId);
|
339 |
+
// Clear the cart after successful order placement
|
340 |
+
cart = [];
|
341 |
+
// Navigate back to the category selection page
|
342 |
+
orderPage.style.display = "none";
|
343 |
+
categoryPage.style.display = "block";
|
344 |
+
})
|
345 |
+
.catch(error => {
|
346 |
+
console.error("Error placing order:", error);
|
347 |
+
alert("There was an error placing your order. Please try again.");
|
348 |
+
});
|
349 |
+
});
|
350 |
+
</script>
|
351 |
|
352 |
</body>
|
353 |
</html>
|