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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
.remove-icon {
|
238 |
border: none;
|
239 |
background: none;
|
@@ -330,6 +630,24 @@
|
|
330 |
|
331 |
|
332 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
</div>
|
334 |
|
335 |
<div class="dotted-line"></div>
|
@@ -435,13 +753,13 @@
|
|
435 |
let total = subtotal - discount;
|
436 |
|
437 |
// Update UI
|
438 |
-
document.getElementById("discountText").innerText =
|
439 |
-
document.getElementById("totalBillText").innerText =
|
440 |
|
441 |
} else {
|
442 |
// If checkbox is not selected, reset discount
|
443 |
-
document.getElementById("discountText").innerText =
|
444 |
-
document.getElementById("totalBillText").innerText =
|
445 |
}
|
446 |
}
|
447 |
|
|
|
234 |
|
235 |
|
236 |
|
237 |
+
.remove-icon {
|
238 |
+
border: none;
|
239 |
+
background: none;
|
240 |
+
color: red;
|
241 |
+
font-size: 1.2rem;
|
242 |
+
cursor: pointer;
|
243 |
+
}
|
244 |
+
</style>
|
245 |
+
</head>
|
246 |
+
<body>
|
247 |
+
<div class="container">
|
248 |
+
<div class="cart-container">
|
249 |
+
<div style="text-align: right;">
|
250 |
+
<a href="/menu" style="text-decoration: none; font-size: 1.5rem; color: #007bff;">×</a>
|
251 |
+
</div>
|
252 |
+
|
253 |
+
<h4 class="mb-4 fw-bold">Your Cart</h4>
|
254 |
+
|
255 |
+
<!-- Cart Items -->
|
256 |
+
{% for item in cart_items %}
|
257 |
+
<div class="cart-item">
|
258 |
+
<div class="image-wrapper">
|
259 |
+
<img src="{{ item.Image1__c }}" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
|
260 |
+
</div>
|
261 |
+
<div class="cart-item-details">
|
262 |
+
<div class="cart-item-title">
|
263 |
+
{{ item.Name }}
|
264 |
+
</div>
|
265 |
+
<div class="cart-item-addons">
|
266 |
+
<small class="text-muted">Add-ons: {{ item.Add_Ons__c }}</small>
|
267 |
+
</div>
|
268 |
+
<div class="cart-item-instructions">
|
269 |
+
<small class="text-muted">Instructions: {{ item.Instructions__c or "None" }}</small>
|
270 |
+
</div>
|
271 |
+
<div class="cart-item-quantity mt-2">
|
272 |
+
<button onclick="updateQuantity('decrease', '{{ item.Name }}', '{{ customer_email }}')">-</button>
|
273 |
+
<input type="text" value="{{ item.Quantity__c|int }}" readonly data-item-name="{{ item.Name }}">
|
274 |
+
<button onclick="updateQuantity('increase', '{{ item.Name }}', '{{ customer_email }}')">+</button>
|
275 |
+
</div>
|
276 |
+
</div>
|
277 |
+
<div class="cart-item-actions">
|
278 |
+
<div>
|
279 |
+
<button class="remove-icon" onclick="removeItemFromCart('{{ item.Name }}')">🗑️</button>
|
280 |
+
</div>
|
281 |
+
<div class="text-primary">
|
282 |
+
$<span class="base-price">{{ item.Price__c }}</span>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
+
</div>
|
286 |
+
{% else %}
|
287 |
+
<p class="text-center">Your cart is empty.</p>
|
288 |
+
{% endfor %}
|
289 |
+
|
290 |
+
<!-- Suggestions Section -->
|
291 |
+
{% if suggestions %}
|
292 |
+
<div class="suggestion-section">
|
293 |
+
<h5>Complete Your Meal</h5>
|
294 |
+
{% for suggestion in suggestions %}
|
295 |
+
<div class="suggestion-item">
|
296 |
+
<img src="{{ suggestion.Image1__c }}" alt="{{ suggestion.Name }}" onerror="this.src='/static/placeholder.jpg';">
|
297 |
+
<div>
|
298 |
+
<div>{{ suggestion.Name }}</div>
|
299 |
+
<div class="text-muted">${{ suggestion.Price__c }}</div>
|
300 |
+
</div>
|
301 |
+
<button class="add-back-button" onclick="addToCartSuggestion('{{ suggestion.Name }}', '{{ suggestion.Price__c }}', '{{ suggestion.Image1__c }}', '{{ suggestion.Id }}')">Add</button>
|
302 |
+
</div>
|
303 |
+
{% endfor %}
|
304 |
+
</div>
|
305 |
+
{% endif %}
|
306 |
+
|
307 |
+
<!-- Subtotal -->
|
308 |
+
<div class="cart-summary">
|
309 |
+
|
310 |
+
{% if coupons %}
|
311 |
+
<div class="coupon-selection">
|
312 |
+
<label>
|
313 |
+
<input type="checkbox" id="couponCheckbox" onchange="toggleCouponDropdown()">
|
314 |
+
Apply Coupon Code
|
315 |
+
</label>
|
316 |
+
<select id="couponDropdown" class="form-select mt-2" disabled onchange="calculateDiscount()">
|
317 |
+
<option value="">Select a coupon</option>
|
318 |
+
{% for coupon in coupons %}
|
319 |
+
<option value="{{ coupon }}">{{ coupon }}</option>
|
320 |
+
{% endfor %}
|
321 |
+
</select>
|
322 |
+
</div>
|
323 |
+
{% endif %}
|
324 |
+
<div class="bill-details">
|
325 |
+
<div class="label">Cart Total</div>
|
326 |
+
<div class="amount">${{ subtotal }}</div>
|
327 |
+
<!DOCTYPE html>
|
328 |
+
<html lang="en">
|
329 |
+
<head>
|
330 |
+
<meta charset="UTF-8">
|
331 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
332 |
+
<title>Cart</title>
|
333 |
+
<!-- Bootstrap CSS -->
|
334 |
+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
335 |
+
<style>
|
336 |
+
body {
|
337 |
+
font-family: Arial, sans-serif;
|
338 |
+
background-color: #f3f4f6;
|
339 |
+
color: #333;
|
340 |
+
}
|
341 |
+
.cart-container {
|
342 |
+
max-width: 768px;
|
343 |
+
margin: 30px auto;
|
344 |
+
padding: 20px;
|
345 |
+
background-color: #fff;
|
346 |
+
border-radius: 12px;
|
347 |
+
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
|
348 |
+
transition: box-shadow 0.3s ease-in-out;
|
349 |
+
}
|
350 |
+
.cart-container:hover {
|
351 |
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
352 |
+
}
|
353 |
+
|
354 |
+
.cart-item {
|
355 |
+
display: flex; /* Flexbox layout for the cart item */
|
356 |
+
align-items: flex-start; /* Ensure the image and content align at the top */
|
357 |
+
justify-content: space-between; /* Spread image and content across the container */
|
358 |
+
border-bottom: 1px solid #e0e0e0;
|
359 |
+
padding: 15px 0;
|
360 |
+
}
|
361 |
+
.image-wrapper {
|
362 |
+
width: 80px; /* Width of the image container */
|
363 |
+
height: 140px !important; /* Height of the image container */
|
364 |
+
display: flex; /* Flex container for image */
|
365 |
+
align-items: flex-start; /* Align the image at the top */
|
366 |
+
justify-content: center; /* Center image horizontally if it has space */
|
367 |
+
}
|
368 |
+
.cart-item img {
|
369 |
+
width: 100%; /* Fill the image container */
|
370 |
+
height: auto !important; /* Maintain aspect ratio */
|
371 |
+
object-fit: contain; /* Ensure the full image is visible */
|
372 |
+
border-radius: 8px; /* Optional: rounded corners */
|
373 |
+
transition: transform 0.3s;
|
374 |
+
}
|
375 |
+
.cart-item img:hover {
|
376 |
+
transform: scale(1.05);
|
377 |
+
}
|
378 |
+
.cart-item-title {
|
379 |
+
font-size: 1.1rem;
|
380 |
+
font-weight: 600;
|
381 |
+
}
|
382 |
+
.checkout-button {
|
383 |
+
background-color: #0FAA39; /* Green background */
|
384 |
+
color: #fff; /* White text */
|
385 |
+
padding: 12px;
|
386 |
+
border-radius: 8px;
|
387 |
+
border: none;
|
388 |
+
width: 100%;
|
389 |
+
font-size: 1.2rem;
|
390 |
+
cursor: pointer;
|
391 |
+
transition: background-color 0.3s, color 0.3s;
|
392 |
+
}
|
393 |
+
.checkout-button:hover {
|
394 |
+
background-color: #0FAA39; /* Keep the background green on hover */
|
395 |
+
color: #fff; /* Keep the text white on hover */
|
396 |
+
}
|
397 |
+
.add-back-button {
|
398 |
+
padding: 6px 20px;
|
399 |
+
font-size: 0.9rem;
|
400 |
+
border-radius: 20px;
|
401 |
+
border: 1px solid #fff;
|
402 |
+
background-color: #fff;
|
403 |
+
color: #0FAA39;
|
404 |
+
cursor: pointer;
|
405 |
+
transition: background-color 0.3s, color 0.3s;
|
406 |
+
}
|
407 |
+
.add-back-button:hover {
|
408 |
+
background-color: #fff;
|
409 |
+
color: #0FAA39;
|
410 |
+
}
|
411 |
+
|
412 |
+
.cart-item-details {
|
413 |
+
flex: 1;
|
414 |
+
margin-left: 15px;
|
415 |
+
}
|
416 |
+
|
417 |
+
.cart-item-quantity {
|
418 |
+
display: flex;
|
419 |
+
align-items: center;
|
420 |
+
margin-top: 5px;
|
421 |
+
}
|
422 |
+
.cart-item-quantity button {
|
423 |
+
width: 30px;
|
424 |
+
height: 30px;
|
425 |
+
border: none;
|
426 |
+
background-color: #f0f0f0;
|
427 |
+
font-size: 1rem;
|
428 |
+
font-weight: bold;
|
429 |
+
cursor: pointer;
|
430 |
+
}
|
431 |
+
.cart-item-quantity input {
|
432 |
+
width: 40px;
|
433 |
+
text-align: center;
|
434 |
+
border: none;
|
435 |
+
background-color: #f8f9fa;
|
436 |
+
font-size: 1rem;
|
437 |
+
margin: 0 5px;
|
438 |
+
}
|
439 |
+
.cart-summary {
|
440 |
+
text-align: left;
|
441 |
+
margin-top: 15px;
|
442 |
+
padding: 20px;
|
443 |
+
background-color: #fff;
|
444 |
+
border-radius: 12px;
|
445 |
+
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
|
446 |
+
}
|
447 |
+
.bill-details {
|
448 |
+
display: grid;
|
449 |
+
grid-template-columns: 1fr 1fr; /* Two-column layout */
|
450 |
+
grid-gap: 10px;
|
451 |
+
margin-bottom: 10px;
|
452 |
+
}
|
453 |
+
.bill-details .label {
|
454 |
+
font-weight: 600;
|
455 |
+
font-size: 1rem;
|
456 |
+
}
|
457 |
+
.bill-details .amount {
|
458 |
+
text-align: right;
|
459 |
+
font-weight: 600;
|
460 |
+
font-size: 1rem;
|
461 |
+
}
|
462 |
+
.dotted-line {
|
463 |
+
border-bottom: 2px dotted #ccc;
|
464 |
+
margin: 15px 0;
|
465 |
+
}
|
466 |
+
.total-bill {
|
467 |
+
display: grid;
|
468 |
+
grid-template-columns: 1fr 1fr;
|
469 |
+
font-weight: 600;
|
470 |
+
font-size: 1.2rem;
|
471 |
+
margin-top: 10px;
|
472 |
+
}
|
473 |
+
.total-bill .label {
|
474 |
+
font-size: 1.1rem;
|
475 |
+
}
|
476 |
+
.total-bill .amount {
|
477 |
+
text-align: right;
|
478 |
+
font-size: 1.1rem;
|
479 |
+
color: #0FAA39; /* Green color for total */
|
480 |
+
}
|
481 |
+
.checkout-button {
|
482 |
+
background-color: #0FAA39;
|
483 |
+
color: #fff;
|
484 |
+
padding: 12px;
|
485 |
+
border-radius: 8px;
|
486 |
+
border: none;
|
487 |
+
width: 100%;
|
488 |
+
font-size: 1.2rem;
|
489 |
+
cursor: pointer;
|
490 |
+
transition: background-color 0.3s, color 0.3s;
|
491 |
+
}
|
492 |
+
|
493 |
+
.suggestion-section {
|
494 |
+
margin-top: 20px;
|
495 |
+
padding: 15px;
|
496 |
+
background-color: #f8f9fa;
|
497 |
+
border-radius: 10px;
|
498 |
+
}
|
499 |
+
.suggestion-item {
|
500 |
+
display: flex;
|
501 |
+
align-items: center; /* Vertically align image and text */
|
502 |
+
justify-content: space-between; /* Space between the image/text and the button */
|
503 |
+
padding: 10px 0;
|
504 |
+
}
|
505 |
+
.suggestion-item img {
|
506 |
+
width: 50px;
|
507 |
+
height: 50px;
|
508 |
+
object-fit: cover;
|
509 |
+
border-radius: 5px;
|
510 |
+
margin-right: 10px; /* Spacing between the image and the text */
|
511 |
+
}
|
512 |
+
.suggestion-item div {
|
513 |
+
display: flex;
|
514 |
+
flex-direction: column;
|
515 |
+
justify-content: center;
|
516 |
+
flex-grow: 1; /* Allow the text to take up the available space */
|
517 |
+
}
|
518 |
+
.suggestion-item button {
|
519 |
+
padding: 5px 15px;
|
520 |
+
font-size: 0.9rem;
|
521 |
+
border-radius: 5px;
|
522 |
+
border: 2px solid #0FAA39;
|
523 |
+
color: #0FAA39;
|
524 |
+
background-color: #fff;
|
525 |
+
font-weight: 600;
|
526 |
+
height: 44px;
|
527 |
+
cursor: pointer;
|
528 |
+
transition: background-color 0.3s, color 0.3s, border-color 0.3s;
|
529 |
+
margin-left: auto; /* Push button to the right */
|
530 |
+
}
|
531 |
+
.suggestion-item button:hover {
|
532 |
+
background-color: #0FAA39; /* Change background to green on hover */
|
533 |
+
color: #fff; /* Change text color to white on hover */
|
534 |
+
border-color: #0FAA39; /* Keep the border green */
|
535 |
+
}
|
536 |
+
|
537 |
.remove-icon {
|
538 |
border: none;
|
539 |
background: none;
|
|
|
630 |
|
631 |
|
632 |
|
633 |
+
</div>
|
634 |
+
|
635 |
+
<div class="dotted-line"></div>
|
636 |
+
|
637 |
+
<div class="total-bill">
|
638 |
+
<div class="label">To Pay</div>
|
639 |
+
<div class="amount" id="totalBillText">${{ subtotal }}</div>
|
640 |
+
</div>
|
641 |
+
<button class="checkout-button" onclick="proceedToOrder()">Proceed to Order</button>
|
642 |
+
</div>
|
643 |
+
</div>
|
644 |
+
</div>
|
645 |
+
|
646 |
+
<div class="amount" id="discountText">-${{ discount }}</div>
|
647 |
+
|
648 |
+
|
649 |
+
|
650 |
+
|
651 |
</div>
|
652 |
|
653 |
<div class="dotted-line"></div>
|
|
|
753 |
let total = subtotal - discount;
|
754 |
|
755 |
// Update UI
|
756 |
+
document.getElementById("discountText").innerText = `$${discount.toFixed(2)}`;
|
757 |
+
document.getElementById("totalBillText").innerText = `$${total.toFixed(2)}`;
|
758 |
|
759 |
} else {
|
760 |
// If checkbox is not selected, reset discount
|
761 |
+
document.getElementById("discountText").innerText = `$0`;
|
762 |
+
document.getElementById("totalBillText").innerText = `$${subtotal.toFixed(2)}`;
|
763 |
}
|
764 |
}
|
765 |
|