Spaces:
Runtime error
Runtime error
Update templates/combined_summary.html
Browse files- templates/combined_summary.html +83 -27
templates/combined_summary.html
CHANGED
|
@@ -398,7 +398,7 @@
|
|
| 398 |
border-color: #10B981;
|
| 399 |
}
|
| 400 |
/* Green border when section is visible */
|
| 401 |
-
.ingredients
|
| 402 |
border: 2px solid #10B981;
|
| 403 |
}
|
| 404 |
/* Ensure ingredient section is smooth */
|
|
@@ -435,7 +435,7 @@
|
|
| 435 |
.order-confirmed::before {
|
| 436 |
content: '✔';
|
| 437 |
position: absolute;
|
| 438 |
-
top: 50
|
| 439 |
left: 50%;
|
| 440 |
transform: translate(-50%, -50%);
|
| 441 |
font-size: 120px;
|
|
@@ -447,6 +447,20 @@
|
|
| 447 |
z-index: 1;
|
| 448 |
position: relative;
|
| 449 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
/* Tier details animation */
|
| 451 |
.tier-details {
|
| 452 |
overflow: hidden;
|
|
@@ -568,6 +582,9 @@
|
|
| 568 |
.grid {
|
| 569 |
grid-template-columns: repeat(2, 1fr);
|
| 570 |
}
|
|
|
|
|
|
|
|
|
|
| 571 |
}
|
| 572 |
@media (min-width: 768px) {
|
| 573 |
.grid {
|
|
@@ -588,7 +605,10 @@
|
|
| 588 |
<!-- Order Confirmation -->
|
| 589 |
<div class="section bg-white shadow-sm rounded-xl p-6 mb-6 order-confirmed" role="alert">
|
| 590 |
<h1 class="text-center text-2xl font-bold text-orange-500">Order Confirmed!</h1>
|
| 591 |
-
<p class="text-center text-gray-600 mt-2">
|
|
|
|
|
|
|
|
|
|
| 592 |
</div>
|
| 593 |
|
| 594 |
<!-- Reward Status Section -->
|
|
@@ -634,8 +654,6 @@
|
|
| 634 |
<span class="font-semibold text-orange-500" id="nextTier">{{ next_tier }}</span>
|
| 635 |
</p>
|
| 636 |
|
| 637 |
-
|
| 638 |
-
|
| 639 |
<!-- Tier Benefits -->
|
| 640 |
<div class="mt-6 bg-gray-50 rounded-xl p-4">
|
| 641 |
<h3 class="text-lg font-semibold mb-4 text-gray-800" id="benefitsTitle">
|
|
@@ -991,9 +1009,40 @@
|
|
| 991 |
}
|
| 992 |
}
|
| 993 |
|
| 994 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 995 |
document.addEventListener('DOMContentLoaded', () => {
|
| 996 |
try {
|
|
|
|
| 997 |
const progressBar = document.getElementById('progressBar');
|
| 998 |
const pointsDisplay = document.getElementById('pointsDisplay');
|
| 999 |
const points = parseInt(pointsDisplay.textContent, 10) || 0;
|
|
@@ -1005,29 +1054,36 @@
|
|
| 1005 |
} else {
|
| 1006 |
progressBar.classList.add('range-200-plus');
|
| 1007 |
}
|
| 1008 |
-
} catch (e) {
|
| 1009 |
-
console.error('Error setting progress bar color:', e);
|
| 1010 |
-
}
|
| 1011 |
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
|
| 1015 |
-
|
| 1016 |
-
|
| 1017 |
-
|
| 1018 |
-
|
| 1019 |
-
|
| 1020 |
-
|
| 1021 |
-
|
| 1022 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1023 |
});
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
| 1030 |
-
}
|
|
|
|
|
|
|
| 1031 |
}
|
| 1032 |
});
|
| 1033 |
|
|
|
|
| 398 |
border-color: #10B981;
|
| 399 |
}
|
| 400 |
/* Green border when section is visible */
|
| 401 |
+
.ingredients-section:not(.hidden) .ingredient-image {
|
| 402 |
border: 2px solid #10B981;
|
| 403 |
}
|
| 404 |
/* Ensure ingredient section is smooth */
|
|
|
|
| 435 |
.order-confirmed::before {
|
| 436 |
content: '✔';
|
| 437 |
position: absolute;
|
| 438 |
+
top: 50;
|
| 439 |
left: 50%;
|
| 440 |
transform: translate(-50%, -50%);
|
| 441 |
font-size: 120px;
|
|
|
|
| 447 |
z-index: 1;
|
| 448 |
position: relative;
|
| 449 |
}
|
| 450 |
+
/* Success message styling */
|
| 451 |
+
.success-message {
|
| 452 |
+
text-align: center;
|
| 453 |
+
color: #10B981;
|
| 454 |
+
font-size: 1.5rem;
|
| 455 |
+
font-weight: 600;
|
| 456 |
+
margin-top: 1rem;
|
| 457 |
+
animation: fadeIn 0.5s ease-in-out;
|
| 458 |
+
}
|
| 459 |
+
/* Timer styling */
|
| 460 |
+
.delivery-timer {
|
| 461 |
+
color: #F59E0B;
|
| 462 |
+
font-weight: 600;
|
| 463 |
+
}
|
| 464 |
/* Tier details animation */
|
| 465 |
.tier-details {
|
| 466 |
overflow: hidden;
|
|
|
|
| 582 |
.grid {
|
| 583 |
grid-template-columns: repeat(2, 1fr);
|
| 584 |
}
|
| 585 |
+
.success-message {
|
| 586 |
+
font-size: 1.25rem;
|
| 587 |
+
}
|
| 588 |
}
|
| 589 |
@media (min-width: 768px) {
|
| 590 |
.grid {
|
|
|
|
| 605 |
<!-- Order Confirmation -->
|
| 606 |
<div class="section bg-white shadow-sm rounded-xl p-6 mb-6 order-confirmed" role="alert">
|
| 607 |
<h1 class="text-center text-2xl font-bold text-orange-500">Order Confirmed!</h1>
|
| 608 |
+
<p class="text-center text-gray-600 mt-2">
|
| 609 |
+
Estimated delivery time: <span id="deliveryTimer" class="delivery-timer">{{ delivery_time }}:00</span>
|
| 610 |
+
</p>
|
| 611 |
+
<p id="successMessage" class="success-message hidden">Successfully Delivered!</p>
|
| 612 |
</div>
|
| 613 |
|
| 614 |
<!-- Reward Status Section -->
|
|
|
|
| 654 |
<span class="font-semibold text-orange-500" id="nextTier">{{ next_tier }}</span>
|
| 655 |
</p>
|
| 656 |
|
|
|
|
|
|
|
| 657 |
<!-- Tier Benefits -->
|
| 658 |
<div class="mt-6 bg-gray-50 rounded-xl p-4">
|
| 659 |
<h3 class="text-lg font-semibold mb-4 text-gray-800" id="benefitsTitle">
|
|
|
|
| 1009 |
}
|
| 1010 |
}
|
| 1011 |
|
| 1012 |
+
// Delivery timer function
|
| 1013 |
+
function startDeliveryTimer(minutes) {
|
| 1014 |
+
try {
|
| 1015 |
+
const timerElement = document.getElementById('deliveryTimer');
|
| 1016 |
+
const successMessage = document.getElementById('successMessage');
|
| 1017 |
+
const deliveryText = document.querySelector('.order-confirmed p.text-center.text-gray-600');
|
| 1018 |
+
|
| 1019 |
+
let totalSeconds = minutes * 60;
|
| 1020 |
+
|
| 1021 |
+
const updateTimer = () => {
|
| 1022 |
+
if (totalSeconds <= 0) {
|
| 1023 |
+
clearInterval(timerInterval);
|
| 1024 |
+
deliveryText.classList.add('hidden');
|
| 1025 |
+
successMessage.classList.remove('hidden');
|
| 1026 |
+
return;
|
| 1027 |
+
}
|
| 1028 |
+
|
| 1029 |
+
const mins = Math.floor(totalSeconds / 60);
|
| 1030 |
+
const secs = totalSeconds % 60;
|
| 1031 |
+
timerElement.textContent = `${mins}:${secs < 10 ? '0' : ''}${secs}`;
|
| 1032 |
+
totalSeconds--;
|
| 1033 |
+
};
|
| 1034 |
+
|
| 1035 |
+
updateTimer(); // Initial call
|
| 1036 |
+
const timerInterval = setInterval(updateTimer, 1000);
|
| 1037 |
+
} catch (e) {
|
| 1038 |
+
console.error('Error in delivery timer:', e);
|
| 1039 |
+
}
|
| 1040 |
+
}
|
| 1041 |
+
|
| 1042 |
+
// Set progress bar color based on points and start delivery timer
|
| 1043 |
document.addEventListener('DOMContentLoaded', () => {
|
| 1044 |
try {
|
| 1045 |
+
// Progress bar color
|
| 1046 |
const progressBar = document.getElementById('progressBar');
|
| 1047 |
const pointsDisplay = document.getElementById('pointsDisplay');
|
| 1048 |
const points = parseInt(pointsDisplay.textContent, 10) || 0;
|
|
|
|
| 1054 |
} else {
|
| 1055 |
progressBar.classList.add('range-200-plus');
|
| 1056 |
}
|
|
|
|
|
|
|
|
|
|
| 1057 |
|
| 1058 |
+
// Start delivery timer
|
| 1059 |
+
const deliveryTimeElement = document.getElementById('deliveryTimer');
|
| 1060 |
+
const deliveryTime = parseInt(deliveryTimeElement.textContent.split(':')[0], 10) || 0;
|
| 1061 |
+
if (deliveryTime > 0) {
|
| 1062 |
+
startDeliveryTimer(deliveryTime);
|
| 1063 |
+
}
|
| 1064 |
+
|
| 1065 |
+
// Lazy load images with IntersectionObserver
|
| 1066 |
+
const images = document.querySelectorAll('img.lazyload');
|
| 1067 |
+
if ('IntersectionObserver' in window) {
|
| 1068 |
+
const observer = new IntersectionObserver((entries, observer) => {
|
| 1069 |
+
entries.forEach(entry => {
|
| 1070 |
+
if (entry.isIntersecting) {
|
| 1071 |
+
const img = entry.target;
|
| 1072 |
+
img.src = img.src || '/static/placeholder.jpg';
|
| 1073 |
+
img.classList.remove('lazyload');
|
| 1074 |
+
observer.unobserve(img);
|
| 1075 |
+
}
|
| 1076 |
+
});
|
| 1077 |
});
|
| 1078 |
+
images.forEach(img => observer.observe(img));
|
| 1079 |
+
} else {
|
| 1080 |
+
images.forEach(img => {
|
| 1081 |
+
img.src = img.src || '/static/placeholder.jpg';
|
| 1082 |
+
img.classList.remove('lazyload');
|
| 1083 |
+
});
|
| 1084 |
+
}
|
| 1085 |
+
} catch (e) {
|
| 1086 |
+
console.error('Error in DOMContentLoaded:', e);
|
| 1087 |
}
|
| 1088 |
});
|
| 1089 |
|