Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -196,26 +196,35 @@ modal_and_cart_js = """
|
|
196 |
updateCartDisplay();
|
197 |
}
|
198 |
function submitCart() {
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
</script>
|
220 |
"""
|
221 |
|
|
|
196 |
updateCartDisplay();
|
197 |
}
|
198 |
function submitCart() {
|
199 |
+
let finalOrderHTML = "<h3>Final Order:</h3><ul>";
|
200 |
+
let totalBill = 0;
|
201 |
+
|
202 |
+
// Generate final order summary
|
203 |
+
cart.forEach(item => {
|
204 |
+
totalBill += item.itemTotal;
|
205 |
+
const extras = item.extras.map((extra, i) => {
|
206 |
+
const extraQuantity = item.extrasQuantities ? item.extrasQuantities[i] || 1 : 1;
|
207 |
+
const extraTotal = extrasPrices[extra] * extraQuantity;
|
208 |
+
totalBill += extraTotal;
|
209 |
+
return `${extra} (x${extraQuantity}) - $${extraTotal.toFixed(2)}`;
|
210 |
+
}).join(', ');
|
211 |
+
|
212 |
+
finalOrderHTML += `<li>
|
213 |
+
${item.name} (x${item.quantity}) - $${item.itemTotal.toFixed(2)}
|
214 |
+
<br>Extras: ${extras}
|
215 |
+
<br>Instructions: ${item.instructions || "None"}
|
216 |
+
</li>`;
|
217 |
+
});
|
218 |
+
|
219 |
+
finalOrderHTML += `</ul><p><strong>Total Bill: $${totalBill.toFixed(2)}</strong></p>`;
|
220 |
+
|
221 |
+
// Store order summary in session storage for next page
|
222 |
+
sessionStorage.setItem('finalOrderSummary', finalOrderHTML);
|
223 |
+
|
224 |
+
// Redirect to the final order page
|
225 |
+
window.location.href = "/final_order.html"; // Ensure this page exists
|
226 |
+
}
|
227 |
+
|
228 |
</script>
|
229 |
"""
|
230 |
|