lokeshloki143 commited on
Commit
9648260
·
verified ·
1 Parent(s): 9536adc

Update templates/combined_summary.html

Browse files
Files changed (1) hide show
  1. templates/combined_summary.html +12 -22
templates/combined_summary.html CHANGED
@@ -590,8 +590,9 @@
590
  <div class="container mx-auto p-6 pt-2">
591
  <!-- Order Confirmation -->
592
  <!-- Added a hidden input to store delivery time in seconds -->
593
- <!-- Pass delivery_time_seconds from Flask for a NEW order -->
594
- <input type="hidden" id="deliveryTimeSeconds" value="{{ delivery_time_seconds | default('') }}">
 
595
 
596
  <div id="orderConfirmationSection" class="section bg-white shadow-sm rounded-xl p-6 mb-6 order-confirmed" role="alert">
597
  <h1 class="text-center text-2xl font-bold text-orange-500">Order Confirmed!</h1>
@@ -659,7 +660,7 @@
659
  {% elif next_tier == "Gold" %}
660
  <li class="flex items-center">
661
  <span class="text-2xl mr-3">🏷️</span>
662
- <span class="text-700">15% discount on next purchase</span>
663
  </li>
664
  <li class="flex items-center">
665
  <span class="text-2xl mr-3">🍰</span>
@@ -1047,9 +1048,10 @@
1047
 
1048
  let remainingSeconds = parseInt(deliveryTimeInput.value, 10);
1049
 
1050
- // Check if delivery time is a valid number and greater than 0
1051
  if (!isNaN(remainingSeconds) && remainingSeconds > 0) {
1052
- orderConfirmationSection.classList.remove('hidden'); // Ensure it's visible for a new order
 
1053
 
1054
  const timerInterval = setInterval(() => {
1055
  const minutes = Math.floor(remainingSeconds / 60);
@@ -1065,26 +1067,14 @@
1065
  if (remainingSeconds < 0) {
1066
  clearInterval(timerInterval);
1067
  countdownTimerSpan.textContent = 'Delivered!';
1068
- // You can optionally hide the section here if you prefer,
1069
- // but your request implied showing "Delivered!" after completion.
1070
- // If you want to hide it automatically after completion, uncomment:
1071
- /*
1072
- setTimeout(() => {
1073
- orderConfirmationSection.classList.add('hidden');
1074
- }, 3000); // Hide after 3 seconds
1075
- */
1076
  }
1077
  }, 1000);
1078
  } else {
1079
- // If no valid delivery time (e.g., page load for past orders or timer finished)
1080
- // Check if the delivery time was 0 or less, indicating completion
1081
- if (isNaN(remainingSeconds) || remainingSeconds <= 0) {
1082
- countdownTimerSpan.textContent = 'Delivered!';
1083
- orderConfirmationSection.classList.remove('hidden'); // Show "Delivered!" message
1084
- } else {
1085
- // This case shouldn't happen if backend sends valid data for new orders
1086
- orderConfirmationSection.classList.add('hidden'); // Hide if no valid time at all
1087
- }
1088
  }
1089
  }
1090
 
 
590
  <div class="container mx-auto p-6 pt-2">
591
  <!-- Order Confirmation -->
592
  <!-- Added a hidden input to store delivery time in seconds -->
593
+ <!-- Pass delivery_time_seconds from Flask for a NEW order (e.g., 1800 for 30 mins) -->
594
+ <!-- Pass 0 or None from Flask for a completed/past order -->
595
+ <input type="hidden" id="deliveryTimeSeconds" value="{{ delivery_time_seconds | default('0') }}">
596
 
597
  <div id="orderConfirmationSection" class="section bg-white shadow-sm rounded-xl p-6 mb-6 order-confirmed" role="alert">
598
  <h1 class="text-center text-2xl font-bold text-orange-500">Order Confirmed!</h1>
 
660
  {% elif next_tier == "Gold" %}
661
  <li class="flex items-center">
662
  <span class="text-2xl mr-3">🏷️</span>
663
+ <span class="text-gray-700">15% discount on next purchase</span>
664
  </li>
665
  <li class="flex items-center">
666
  <span class="text-2xl mr-3">🍰</span>
 
1048
 
1049
  let remainingSeconds = parseInt(deliveryTimeInput.value, 10);
1050
 
1051
+ // Check if delivery time is a valid positive number
1052
  if (!isNaN(remainingSeconds) && remainingSeconds > 0) {
1053
+ // Show the section and start the timer
1054
+ orderConfirmationSection.classList.remove('hidden');
1055
 
1056
  const timerInterval = setInterval(() => {
1057
  const minutes = Math.floor(remainingSeconds / 60);
 
1067
  if (remainingSeconds < 0) {
1068
  clearInterval(timerInterval);
1069
  countdownTimerSpan.textContent = 'Delivered!';
1070
+ // Keep the section visible to show the "Delivered!" message
 
 
 
 
 
 
 
1071
  }
1072
  }, 1000);
1073
  } else {
1074
+ // If no valid positive delivery time (0 or less, or not provided)
1075
+ // Assume the order is delivered or this is a past order view
1076
+ countdownTimerSpan.textContent = 'Delivered!';
1077
+ orderConfirmationSection.classList.remove('hidden'); // Show the "Delivered!" message
 
 
 
 
 
1078
  }
1079
  }
1080