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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
|
4 |
+
<head>
|
5 |
+
<meta charset="UTF-8">
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
8 |
+
<title>Order Summary</title>
|
9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
10 |
+
<style>
|
11 |
+
/* Custom animations */
|
12 |
+
@keyframes fadeIn {
|
13 |
+
from { opacity: 0; transform: translateY(10px); }
|
14 |
+
to { opacity: 1; transform: translateY(0); }
|
15 |
+
}
|
16 |
+
@keyframes lightMoveUp {
|
17 |
+
0% { background-position: 0 100%; }
|
18 |
+
100% { background-position: 0 0%; }
|
19 |
+
}
|
20 |
+
@keyframes shine {
|
21 |
+
from { transform: rotate(0deg) translateX(-100%); }
|
22 |
+
to { transform: rotate(25deg) translateX(100%); }
|
23 |
+
}
|
24 |
+
.modal, .popup {
|
25 |
+
animation: fadeIn 0.2s ease-in-out;
|
26 |
+
}
|
27 |
+
.progress-bar {
|
28 |
+
transition: width 0.6s ease-in-out;
|
29 |
+
}
|
30 |
+
.ingredient-image {
|
31 |
+
transition: transform 0.3s ease-in-out;
|
32 |
+
}
|
33 |
+
.ingredient-button:hover .ingredient-image {
|
34 |
+
transform: scale(1.1);
|
35 |
+
}
|
36 |
+
.tier-badge {
|
37 |
+
position: relative;
|
38 |
+
overflow: hidden;
|
39 |
+
background-color: #F97316;
|
40 |
+
}
|
41 |
+
.tier-badge::after {
|
42 |
+
content: '';
|
43 |
+
position: absolute;
|
44 |
+
top: -50%;
|
45 |
+
left: -50%;
|
46 |
+
width: 200%;
|
47 |
+
height: 200%;
|
48 |
+
background: linear-gradient(45deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
|
49 |
+
animation: shine 3s infinite;
|
50 |
+
}
|
51 |
+
/* Custom class for order items */
|
52 |
+
.custom-class {
|
53 |
+
text-align: center;
|
54 |
+
border-radius: 8px;
|
55 |
+
border-width: 1px;
|
56 |
+
border-color: #E5E7EB;
|
57 |
+
padding: 20px !important;
|
58 |
+
margin-bottom: 12px;
|
59 |
+
background-color: #FFFFFF;
|
60 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
61 |
+
}
|
62 |
+
.history {
|
63 |
+
display: flex;
|
64 |
+
justify-content: center;
|
65 |
+
font-size: 1.75rem;
|
66 |
+
font-weight: 700;
|
67 |
+
padding: 1.5rem;
|
68 |
+
}
|
69 |
+
/* Scrollable sector images */
|
70 |
+
.sector-images-container {
|
71 |
+
display: flex;
|
72 |
+
overflow-x: auto;
|
73 |
+
padding: 10px 0;
|
74 |
+
gap: 15px;
|
75 |
+
}
|
76 |
+
.sector-image {
|
77 |
+
max-width: 150px;
|
78 |
+
height: 100px;
|
79 |
+
object-fit: cover;
|
80 |
+
cursor: pointer;
|
81 |
+
border-radius: 6px;
|
82 |
+
}
|
83 |
+
.sector-name {
|
84 |
+
text-align: center;
|
85 |
+
font-size: 0.75rem;
|
86 |
+
font-weight: 600;
|
87 |
+
margin-top: 6px;
|
88 |
+
max-width: 100px;
|
89 |
+
color: #1F2937;
|
90 |
+
}
|
91 |
+
/* Full-width orange header */
|
92 |
+
.back-to-menu {
|
93 |
+
position: fixed;
|
94 |
+
top: 0;
|
95 |
+
left: 0;
|
96 |
+
right: 0;
|
97 |
+
display: flex;
|
98 |
+
align-items: center;
|
99 |
+
padding: 14px 24px;
|
100 |
+
background-color: #F97316;
|
101 |
+
color: #FFFFFF;
|
102 |
+
font-size: 1.125rem;
|
103 |
+
font-weight: 600;
|
104 |
+
text-decoration: none;
|
105 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
106 |
+
z-index: 9999;
|
107 |
+
transition: background-color 0.3s ease, transform 0.2s ease;
|
108 |
+
}
|
109 |
+
.back-to-menu:hover {
|
110 |
+
background-color: #EA580C;
|
111 |
+
transform: translateY(-1px);
|
112 |
+
}
|
113 |
+
/* Content spacing */
|
114 |
+
.container {
|
115 |
+
margin-top: 90px;
|
116 |
+
}
|
117 |
+
/* Sector popup */
|
118 |
+
#sector-popup {
|
119 |
+
display: none;
|
120 |
+
position: fixed;
|
121 |
+
inset: 0;
|
122 |
+
background: rgba(17, 24, 39, 0.6);
|
123 |
+
display: flex;
|
124 |
+
justify-content: center;
|
125 |
+
align-items: center;
|
126 |
+
z-index: 10000;
|
127 |
+
animation: fadeIn 0.2s ease-in-out;
|
128 |
+
}
|
129 |
+
#popup-content {
|
130 |
+
background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
|
131 |
+
padding: 24px;
|
132 |
+
border-radius: 12px;
|
133 |
+
width: 90%;
|
134 |
+
max-width: 550px;
|
135 |
+
max-height: 85vh;
|
136 |
+
overflow-y: auto;
|
137 |
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
138 |
+
border: 1px solid #E5E7EB;
|
139 |
+
position: relative;
|
140 |
+
contain: layout;
|
141 |
+
}
|
142 |
+
.popup-header {
|
143 |
+
position: relative;
|
144 |
+
padding-bottom: 12px;
|
145 |
+
margin-bottom: 16px;
|
146 |
+
border-bottom: 2px solid #F97316;
|
147 |
+
display: flex;
|
148 |
+
justify-content: space-between;
|
149 |
+
align-items: center;
|
150 |
+
}
|
151 |
+
.popup-close {
|
152 |
+
background: #F97316;
|
153 |
+
color: #FFFFFF;
|
154 |
+
border-radius: 50%;
|
155 |
+
width: 36px; /* Increased for better usability */
|
156 |
+
height: 36px;
|
157 |
+
display: flex;
|
158 |
+
align-items: center;
|
159 |
+
justify-content: center;
|
160 |
+
font-size: 22px; /* Adjusted to fit new size */
|
161 |
+
font-weight: bold;
|
162 |
+
border: none;
|
163 |
+
cursor: pointer;
|
164 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
165 |
+
line-height: 1;
|
166 |
+
padding: 0;
|
167 |
+
position: relative;
|
168 |
+
overflow: hidden;
|
169 |
+
will-change: transform, background;
|
170 |
+
}
|
171 |
+
.popup-close::before {
|
172 |
+
content: '';
|
173 |
+
position: absolute;
|
174 |
+
top: 100%;
|
175 |
+
left: 0;
|
176 |
+
width: 100%;
|
177 |
+
height: 100%;
|
178 |
+
background: linear-gradient(to top, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
|
179 |
+
animation: lightMoveUp 1.5s infinite linear;
|
180 |
+
z-index: 0;
|
181 |
+
}
|
182 |
+
.popup-close:hover {
|
183 |
+
background: #EA580C;
|
184 |
+
transform: scale(1.1);
|
185 |
+
}
|
186 |
+
.popup-close span {
|
187 |
+
position: relative;
|
188 |
+
z-index: 1;
|
189 |
+
}
|
190 |
+
/* Ingredient modal */
|
191 |
+
.ingredient-modal-container {
|
192 |
+
display: none;
|
193 |
+
position: fixed;
|
194 |
+
inset: 0;
|
195 |
+
background: rgba(0, 0, 0, 0.6);
|
196 |
+
display: flex;
|
197 |
+
justify-content: center;
|
198 |
+
align-items: center;
|
199 |
+
z-index: 10000;
|
200 |
+
animation: fadeIn 0.2s ease-in-out;
|
201 |
+
}
|
202 |
+
.ingredient-modal {
|
203 |
+
background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
|
204 |
+
border-radius: 12px;
|
205 |
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
206 |
+
border: 1px solid #E5E7EB;
|
207 |
+
width: 90%;
|
208 |
+
max-width: 500px;
|
209 |
+
max-height: 90vh;
|
210 |
+
overflow-y: auto;
|
211 |
+
position: relative;
|
212 |
+
contain: layout;
|
213 |
+
}
|
214 |
+
.modal-section {
|
215 |
+
padding: 16px;
|
216 |
+
border-left: 4px solid #2DD4BF;
|
217 |
+
margin-bottom: 16px;
|
218 |
+
background: #F9FAFB;
|
219 |
+
border-radius: 6px;
|
220 |
+
}
|
221 |
+
/* Green border for ingredient images when section is visible */
|
222 |
+
.ingredients-section:not(.hidden) .ingredient-image {
|
223 |
+
border: 2px solid #10B981;
|
224 |
+
border-radius: 6px;
|
225 |
+
}
|
226 |
+
/* Prevent body scroll when modal is open */
|
227 |
+
body.modal-open {
|
228 |
+
overflow: hidden;
|
229 |
+
}
|
230 |
+
/* Responsive adjustments */
|
231 |
+
@media (max-width: 640px) {
|
232 |
+
.back-to-menu {
|
233 |
+
padding: 12px 16px;
|
234 |
+
font-size: 1rem;
|
235 |
+
}
|
236 |
+
.container {
|
237 |
+
margin-top: 70px;
|
238 |
+
}
|
239 |
+
.history {
|
240 |
+
font-size: 1.5rem;
|
241 |
+
padding: 1rem;
|
242 |
+
}
|
243 |
+
.custom-class {
|
244 |
+
padding: 16px !important;
|
245 |
+
}
|
246 |
+
.sector-image {
|
247 |
+
max-width: 120px;
|
248 |
+
height: 80px;
|
249 |
+
}
|
250 |
+
#popup-content {
|
251 |
+
width: 95%;
|
252 |
+
padding: 16px;
|
253 |
+
max-height: 80vh;
|
254 |
+
}
|
255 |
+
.ingredient-modal {
|
256 |
+
width: 95%;
|
257 |
+
max-height: 80vh;
|
258 |
+
}
|
259 |
+
.popup-close {
|
260 |
+
width: 40px; /* Increased for touch target (WCAG) */
|
261 |
+
height: 40px;
|
262 |
+
font-size: 24px; /* Adjusted to fit new size */
|
263 |
+
}
|
264 |
+
.popup-close::before {
|
265 |
+
animation: lightMoveUp 1.2s infinite linear;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
</style>
|
269 |
+
</head>
|
270 |
+
|
271 |
+
<body class="bg-gray-50">
|
272 |
+
<a href="/menu" class="back-to-menu" aria-label="Go back to menu">
|
273 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 mr-2" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
274 |
+
<path d="M15 18l-6-6 6-6"></path>
|
275 |
+
</svg>
|
276 |
+
Back to Menu
|
277 |
+
</a>
|
278 |
+
|
279 |
+
<div class="container mx-auto p-6 pt-2">
|
280 |
+
<!-- Order Confirmation -->
|
281 |
+
<div class="section bg-white shadow-sm rounded-xl p-6 mb-6">
|
282 |
+
<h1 class="text-center text-2xl font-bold text-orange-500">Order Confirmed!</h1>
|
283 |
+
<p class="text-center text-gray-600 mt-2">Estimated delivery time: 35 minutes</p>
|
284 |
+
</div>
|
285 |
+
|
286 |
+
<!-- Reward Status Section -->
|
287 |
+
<div class="section bg-white rounded-xl shadow-lg p-6 mb-6">
|
288 |
+
<div class="flex items-center justify-between mb-4 cursor-pointer" onclick="toggleTierDetails()">
|
289 |
+
<div id="tierBadge" class="w-8 h-8 p-1 rounded-full flex items-center justify-center tier-badge">
|
290 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
291 |
+
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
292 |
+
class="text-white">
|
293 |
+
<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"></path>
|
294 |
+
<path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"></path>
|
295 |
+
<path d="M4 22h16"></path>
|
296 |
+
<path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"></path>
|
297 |
+
<path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"></path>
|
298 |
+
<path d="M9 9c0 .97.64 1.79 1.5 2.05A2 2 0 0 1 12 13c.82 0 1.54-.39 2-1"></path>
|
299 |
+
<path d="M18 9H6a4 4 0 0 1 0-8h12a4 4 0 0 1 0 8Z"></path>
|
300 |
+
</svg>
|
301 |
+
</div>
|
302 |
+
<span class="ml-2 text-xl font-bold text-orange-500" id="currentTier">{{ current_tier }} Tier</span>
|
303 |
+
<svg id="arrowIcon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
304 |
+
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
305 |
+
class="text-gray-600">
|
306 |
+
<path id="arrowPath" d="M19 9l-7 7-7-7"></path>
|
307 |
+
</svg>
|
308 |
+
</div>
|
309 |
+
|
310 |
+
<!-- Collapsible Content Section -->
|
311 |
+
<div id="tierDetails" class="tier-details hidden">
|
312 |
+
<div class="text-center mb-6">
|
313 |
+
<p class="text-gray-600">Valid through December 2024</p>
|
314 |
+
<p class="text-lg font-semibold mt-2 text-yellow-600" id="pointsDisplay">{{ user_points }} points</p>
|
315 |
+
</div>
|
316 |
+
|
317 |
+
<!-- Progress Bar -->
|
318 |
+
<div class="relative h-4 bg-gray-200 rounded-full overflow-hidden mb-4">
|
319 |
+
<div id="progressBar" class="absolute left-0 top-0 h-full progress-bar bg-teal-400"
|
320 |
+
style="width: {{ progress_percentage }}%"></div>
|
321 |
+
</div>
|
322 |
+
|
323 |
+
<div class="flex justify-between text-sm text-gray-600 mb-4">
|
324 |
+
<span id="startPoint">{{ start_point }}</span>
|
325 |
+
<span id="endPoint">{{ end_point }}</span>
|
326 |
+
</div>
|
327 |
+
|
328 |
+
<p class="text-center text-gray-700">
|
329 |
+
You need <span class="font-semibold text-gray-800" id="pointsNeeded">{{ points_needed_for_next_tier }}</span> more
|
330 |
+
points to reach
|
331 |
+
<span class="font-semibold text-orange-500" id="nextTier">{{ next_tier }}</span>
|
332 |
+
</p>
|
333 |
+
|
334 |
+
<!-- Tier Benefits -->
|
335 |
+
<div class="mt-6 bg-gray-50 rounded-xl p-4">
|
336 |
+
<h3 class="text-lg font-semibold mb-4 text-gray-800" id="benefitsTitle">
|
337 |
+
Benefits of Reaching {{ next_tier }} Tier
|
338 |
+
</h3>
|
339 |
+
<ul class="space-y-3" id="benefitsList">
|
340 |
+
{% if next_tier == "Silver" %}
|
341 |
+
<li class="flex items-center">
|
342 |
+
<span class="text-2xl mr-3">🏷️</span>
|
343 |
+
<span class="text-gray-700">10% discount on next purchase</span>
|
344 |
+
</li>
|
345 |
+
<li class="flex items-center">
|
346 |
+
<span class="text-2xl mr-3">🍹</span>
|
347 |
+
<span class="text-gray-700">Free soft drink with your next order</span>
|
348 |
+
</li>
|
349 |
+
{% elif next_tier == "Gold" %}
|
350 |
+
<li class="flex items-center">
|
351 |
+
<span class="text-2xl mr-3">🏷️</span>
|
352 |
+
<span class="text-gray-700">15% discount on next purchase</span>
|
353 |
+
</li>
|
354 |
+
<li class="flex items-center">
|
355 |
+
<span class="text-2xl mr-3">🍰</span>
|
356 |
+
<span class="text-gray-700">Free dessert on next order</span>
|
357 |
+
</li>
|
358 |
+
{% elif next_tier == "Platinum" %}
|
359 |
+
<li class="flex items-center">
|
360 |
+
<span class="text-2xl mr-3">🏷️</span>
|
361 |
+
<span class="text-gray-700">20% discount on next purchase</span>
|
362 |
+
</li>
|
363 |
+
<li class="flex items-center">
|
364 |
+
<span class="text-2xl mr-3">🍴</span>
|
365 |
+
<span class="text-gray-700">Free entrée with your next order</span>
|
366 |
+
</li>
|
367 |
+
{% endif %}
|
368 |
+
</ul>
|
369 |
+
</div>
|
370 |
+
</div>
|
371 |
+
</div>
|
372 |
+
<!-- Ingredient History -->
|
373 |
+
<div class="history">
|
374 |
+
<h1 class="text-center text-2xl font-bold text-orange-500">Ingredient History</h1>
|
375 |
+
</div>
|
376 |
+
<div class="sector-images-container">
|
377 |
+
{% for sector_name, sector in sector_details.items() %}
|
378 |
+
<div class="sector-item">
|
379 |
+
<img src="{{ sector.image_url }}" alt="{{ sector_name }}" class="sector-image lazyload" loading="lazy"
|
380 |
+
onclick="showSectorDescription('{{ sector.description }}')">
|
381 |
+
<h3 class="sector-name">{{ sector_name }}</h3>
|
382 |
+
</div>
|
383 |
+
{% endfor %}
|
384 |
+
</div>
|
385 |
+
|
386 |
+
<!-- Popup for Sector Description -->
|
387 |
+
<div id="sector-popup" class="popup" style="display:none;" role="dialog" aria-modal="true">
|
388 |
+
<div id="popup-content">
|
389 |
+
<div class="popup-header flex justify-between items-center">
|
390 |
+
<h3 class="text-xl font-semibold text-gray-800">Origin History</h3>
|
391 |
+
<button onclick="closePopup()" class="popup-close"><span>×</span></button>
|
392 |
+
</div>
|
393 |
+
<p id="sector-description" class="text-gray-700 leading-relaxed"></p>
|
394 |
+
</div>
|
395 |
+
</div>
|
396 |
+
|
397 |
+
<!-- Order Items Section -->
|
398 |
+
<div class="text-center text-2xl font-bold text-orange-500 mb-6">Previous Orders</div>
|
399 |
+
{% for item in order_items %}
|
400 |
+
<div class="custom-class">
|
401 |
+
<img src="{{ item.image_url }}" alt="{{ item.name }}" class="w-full h-48 object-cover rounded-xl mb-4 lazyload" loading="lazy" />
|
402 |
+
<h3 class="text-lg font-semibold text-gray-800">{{ item.name }}</h3>
|
403 |
+
<p class="text-gray-600 mb-2">${{ "%.2f"|format(item.price) }}</p>
|
404 |
+
|
405 |
+
{% if item.ingredients %}
|
406 |
+
<button id="ingredientsToggleButton{{ loop.index }}" class="text-green-600 text-sm font-semibold mt-2 ml-2 text-left pb-4 hover:text-green-700" onclick="toggleIngredients({{ loop.index }})">
|
407 |
+
Show Ingredients
|
408 |
+
</button>
|
409 |
+
|
410 |
+
<div id="ingredientsSection{{ loop.index }}" class="ingredients-section hidden mt-4">
|
411 |
+
<div class="grid grid-cols-2 gap-4">
|
412 |
+
{% for ingredient in item.ingredients %}
|
413 |
+
<button
|
414 |
+
onclick="showIngredientDetails(
|
415 |
+
'{{ loop.index }}',
|
416 |
+
'{{ ingredient.name }}',
|
417 |
+
'{{ ingredient.image }}',
|
418 |
+
'{{ ingredient.health_benefits }}',
|
419 |
+
'{{ ingredient.fun_facts }}'
|
420 |
+
)"
|
421 |
+
class="relative group ingredient-button"
|
422 |
+
>
|
423 |
+
<div class="overflow-hidden rounded-lg">
|
424 |
+
<img
|
425 |
+
src="{{ ingredient.image }}"
|
426 |
+
alt="{{ ingredient.name }}"
|
427 |
+
class="w-full h-32 object-cover ingredient-image lazyload"
|
428 |
+
loading="lazy"
|
429 |
+
/>
|
430 |
+
</div>
|
431 |
+
<p class="mt-2 text-center text-sm font-medium text-gray-800">{{ ingredient.name }}</p>
|
432 |
+
</button>
|
433 |
+
{% endfor %}
|
434 |
+
</div>
|
435 |
+
</div>
|
436 |
+
{% endif %}
|
437 |
+
</div>
|
438 |
+
|
439 |
+
<!-- Modal for Ingredients -->
|
440 |
+
<div id="ingredientModal{{ loop.index }}" class="ingredient-modal-container hidden modal" role="dialog" aria-modal="true">
|
441 |
+
<div class="ingredient-modal">
|
442 |
+
<div class="p-6">
|
443 |
+
<div class="popup-header flex justify-between items-center mb-4">
|
444 |
+
<h3 id="modalTitle{{ loop.index }}" class="text-xl font-semibold text-gray-800"></h3>
|
445 |
+
<button onclick="closeModal({{ loop.index }})" class="popup-close"><span>×</span></button>
|
446 |
+
</div>
|
447 |
+
|
448 |
+
<img id="modalImage{{ loop.index }}" src="" alt="" class="w-full h-48 object-cover rounded-xl mb-4 border border-gray-200 lazyload" loading="lazy" />
|
449 |
+
|
450 |
+
<div class="space-y-4">
|
451 |
+
<div class="modal-section">
|
452 |
+
<h4 class="font-semibold mb-2 text-gray-800 flex items-center">
|
453 |
+
<svg class="w-5 h-5 mr-2 text-teal-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
454 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
455 |
+
</svg>
|
456 |
+
Health Benefits
|
457 |
+
</h4>
|
458 |
+
<ul id="healthBenefits{{ loop.index }}" class="list-disc list-inside text-gray-700"></ul>
|
459 |
+
</div>
|
460 |
+
|
461 |
+
<div class="modal-section">
|
462 |
+
<h4 class="font-semibold mb-2 text-gray-800 flex items-center">
|
463 |
+
<svg class="w-5 h-5 mr-2 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
464 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
465 |
+
</svg>
|
466 |
+
Fun Facts
|
467 |
+
</h4>
|
468 |
+
<ul id="funFacts{{ loop.index }}" class="list-disc list-inside text-gray-700"></ul>
|
469 |
+
</div>
|
470 |
+
</div>
|
471 |
+
</div>
|
472 |
+
</div>
|
473 |
+
</div>
|
474 |
+
{% endfor %}
|
475 |
+
</div>
|
476 |
+
|
477 |
+
<script>
|
478 |
+
function debounce(func, wait) {
|
479 |
+
let timeout;
|
480 |
+
return function executedFunction(...args) {
|
481 |
+
const later = () => {
|
482 |
+
clearTimeout(timeout);
|
483 |
+
func(...args);
|
484 |
+
};
|
485 |
+
clearTimeout(timeout);
|
486 |
+
timeout = setTimeout(later, wait);
|
487 |
+
};
|
488 |
+
}
|
489 |
+
|
490 |
+
function showSectorDescription(description) {
|
491 |
+
document.getElementById('sector-description').innerText = description;
|
492 |
+
document.getElementById('sector-popup').style.display = 'flex';
|
493 |
+
document.body.classList.add('modal-open');
|
494 |
+
}
|
495 |
+
|
496 |
+
function closePopup() {
|
497 |
+
document.getElementById('sector-popup').style.display = 'none';
|
498 |
+
document.body.classList.remove('modal-open');
|
499 |
+
}
|
500 |
+
|
501 |
+
function toggleTierDetails() {
|
502 |
+
const tierDetails = document.getElementById('tierDetails');
|
503 |
+
const arrowPath = document.getElementById('arrowPath');
|
504 |
+
tierDetails.classList.toggle('hidden');
|
505 |
+
arrowPath.setAttribute('d', tierDetails.classList.contains('hidden') ? 'M19 9l-7 7-7-7' : 'M19 15l-7-7-7 7');
|
506 |
+
}
|
507 |
+
|
508 |
+
const ingredients = {{ order_items|tojson }};
|
509 |
+
|
510 |
+
function toggleIngredients(index) {
|
511 |
+
const currentSection = document.getElementById('ingredientsSection' + index);
|
512 |
+
const currentButton = document.getElementById('ingredientsToggleButton' + index);
|
513 |
+
const isCurrentlyVisible = !currentSection.classList.contains('hidden');
|
514 |
+
|
515 |
+
document.querySelectorAll('[id^="ingredientsSection"]').forEach(section => section.classList.add('hidden'));
|
516 |
+
document.querySelectorAll('[id^="ingredientsToggleButton"]').forEach(button => button.textContent = 'Show Ingredients');
|
517 |
+
|
518 |
+
if (!isCurrentlyVisible) {
|
519 |
+
currentSection.classList.remove('hidden');
|
520 |
+
currentButton.textContent = 'Hide Ingredients';
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
function showIngredientDetails(index, name, image, healthBenefits, funFacts) {
|
525 |
+
const healthBenefitsList = healthBenefits.split(',');
|
526 |
+
const funFactsList = funFacts.split(',');
|
527 |
+
document.getElementById("modalTitle" + index).textContent = name;
|
528 |
+
document.getElementById("modalImage" + index).src = image;
|
529 |
+
const healthBenefitsUl = document.getElementById("healthBenefits" + index);
|
530 |
+
const funFactsUl = document.getElementById("funFacts" + index);
|
531 |
+
healthBenefitsUl.innerHTML = '';
|
532 |
+
funFactsUl.innerHTML = '';
|
533 |
+
healthBenefitsList.forEach(item => {
|
534 |
+
const li = document.createElement("li");
|
535 |
+
li.textContent = item.trim();
|
536 |
+
healthBenefitsUl.appendChild(li);
|
537 |
+
});
|
538 |
+
funFactsList.forEach(item => {
|
539 |
+
const li = document.createElement("li");
|
540 |
+
li.textContent = item.trim();
|
541 |
+
funFactsUl.appendChild(li);
|
542 |
+
});
|
543 |
+
document.getElementById("ingredientModal" + index).style.display = "flex";
|
544 |
+
document.body.classList.add('modal-open');
|
545 |
+
}
|
546 |
+
|
547 |
+
function closeModal(index) {
|
548 |
+
document.getElementById("ingredientModal" + index).style.display = "none";
|
549 |
+
document.body.classList.remove('modal-open');
|
550 |
+
}
|
551 |
+
|
552 |
+
document.addEventListener('click', function(e) {
|
553 |
+
if (e.target.closest('#sector-popup') && e.target === document.getElementById('sector-popup')) {
|
554 |
+
closePopup();
|
555 |
+
}
|
556 |
+
document.querySelectorAll('.ingredient-modal-container').forEach(modal => {
|
557 |
+
if (e.target.closest(modal) && e.target === modal) {
|
558 |
+
const index = modal.id.replace('ingredientModal', '');
|
559 |
+
closeModal(index);
|
560 |
+
}
|
561 |
+
});
|
562 |
+
});
|
563 |
+
</script>
|
564 |
+
</body>
|
565 |
+
|
566 |
+
</html>
|