Update templates/reward_status.html
Browse files- templates/reward_status.html +31 -24
templates/reward_status.html
CHANGED
@@ -179,7 +179,7 @@
|
|
179 |
<div class="ingredient-card">
|
180 |
{% for ingredient in item.ingredients %}
|
181 |
{% if ingredient.name %}
|
182 |
-
<div class="ingredient" onclick="showIngredientDetails('{{ ingredient.name }}')">
|
183 |
<img src="{{ ingredient.image }}" alt="{{ ingredient.name }}" onerror="this.src='/static/placeholder.jpg';">
|
184 |
<p>{{ ingredient.name }}</p>
|
185 |
</div>
|
@@ -202,35 +202,42 @@
|
|
202 |
<div class="modal-body">
|
203 |
<img id="ingredientImage" src="" alt="" style="width: 150px; height: 150px; object-fit: cover; border-radius: 8px;">
|
204 |
<h3>Health Benefits:</h3>
|
205 |
-
<
|
206 |
<h3>Fun Facts:</h3>
|
207 |
-
<
|
208 |
</div>
|
209 |
</div>
|
210 |
</div>
|
211 |
|
212 |
<script>
|
213 |
-
function showIngredientDetails(
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
document.getElementById("ingredientModal").style.display = "block";
|
235 |
}
|
236 |
|
|
|
179 |
<div class="ingredient-card">
|
180 |
{% for ingredient in item.ingredients %}
|
181 |
{% if ingredient.name %}
|
182 |
+
<div class="ingredient" onclick="showIngredientDetails('{{ ingredient.name }}', '{{ ingredient.image }}', '{{ ingredient.health_benefits }}', '{{ ingredient.fun_facts }}')">
|
183 |
<img src="{{ ingredient.image }}" alt="{{ ingredient.name }}" onerror="this.src='/static/placeholder.jpg';">
|
184 |
<p>{{ ingredient.name }}</p>
|
185 |
</div>
|
|
|
202 |
<div class="modal-body">
|
203 |
<img id="ingredientImage" src="" alt="" style="width: 150px; height: 150px; object-fit: cover; border-radius: 8px;">
|
204 |
<h3>Health Benefits:</h3>
|
205 |
+
<ul id="healthBenefits"></ul>
|
206 |
<h3>Fun Facts:</h3>
|
207 |
+
<ul id="funFacts"></ul>
|
208 |
</div>
|
209 |
</div>
|
210 |
</div>
|
211 |
|
212 |
<script>
|
213 |
+
function showIngredientDetails(name, image, healthBenefits, funFacts) {
|
214 |
+
// Split the health benefits and fun facts by commas
|
215 |
+
const healthBenefitsList = healthBenefits.split(',');
|
216 |
+
const funFactsList = funFacts.split(',');
|
217 |
+
|
218 |
+
// Set ingredient name and image
|
219 |
+
document.getElementById("ingredientName").textContent = name;
|
220 |
+
document.getElementById("ingredientImage").src = image;
|
221 |
+
|
222 |
+
// Clear the previous lists
|
223 |
+
document.getElementById("healthBenefits").innerHTML = '';
|
224 |
+
document.getElementById("funFacts").innerHTML = '';
|
225 |
+
|
226 |
+
// Add each health benefit as a list item
|
227 |
+
healthBenefitsList.forEach(function(item) {
|
228 |
+
const li = document.createElement("li");
|
229 |
+
li.textContent = item.trim();
|
230 |
+
document.getElementById("healthBenefits").appendChild(li);
|
231 |
+
});
|
232 |
+
|
233 |
+
// Add each fun fact as a list item
|
234 |
+
funFactsList.forEach(function(item) {
|
235 |
+
const li = document.createElement("li");
|
236 |
+
li.textContent = item.trim();
|
237 |
+
document.getElementById("funFacts").appendChild(li);
|
238 |
+
});
|
239 |
+
|
240 |
+
// Display the modal
|
241 |
document.getElementById("ingredientModal").style.display = "block";
|
242 |
}
|
243 |
|