nagasurendra commited on
Commit
7ebb7a5
·
verified ·
1 Parent(s): 22d07eb

Update templates/combined_summary.html

Browse files
Files changed (1) hide show
  1. templates/combined_summary.html +9 -5
templates/combined_summary.html CHANGED
@@ -238,6 +238,7 @@
238
 
239
 
240
 
 
241
  </div>
242
 
243
  <script>
@@ -263,17 +264,20 @@
263
  const ingredients = {{ order_items|tojson }}; // Make sure this is passed from the backend
264
 
265
  // Function to toggle the visibility of the ingredients section
 
266
  function toggleIngredients(index) {
267
  const ingredientsSection = document.getElementById('ingredientsSection' + index);
268
- const showButton = document.querySelector(`#ingredientsSection${index} ~ button:first-child`); // Show Ingredients button
269
- const hideButton = document.getElementById('hideIngredients' + index); // Hide Ingredients button
270
 
271
  // Toggle the visibility of the ingredients section
272
  ingredientsSection.classList.toggle('hidden');
273
 
274
- // Toggle the visibility of the buttons
275
- showButton.classList.toggle('hidden');
276
- hideButton.classList.toggle('hidden');
 
 
 
277
  }
278
 
279
  // Function to show ingredient details in the modal
 
238
 
239
 
240
 
241
+
242
  </div>
243
 
244
  <script>
 
264
  const ingredients = {{ order_items|tojson }}; // Make sure this is passed from the backend
265
 
266
  // Function to toggle the visibility of the ingredients section
267
+ // Function to toggle the visibility of the ingredients section and change the button text
268
  function toggleIngredients(index) {
269
  const ingredientsSection = document.getElementById('ingredientsSection' + index);
270
+ const button = document.getElementById('ingredientsToggleButton' + index); // Get the button dynamically
 
271
 
272
  // Toggle the visibility of the ingredients section
273
  ingredientsSection.classList.toggle('hidden');
274
 
275
+ // Change the button text based on the current state
276
+ if (ingredientsSection.classList.contains('hidden')) {
277
+ button.textContent = 'Show Ingredients'; // If hidden, show the "Show Ingredients" text
278
+ } else {
279
+ button.textContent = 'Hide Ingredients'; // If visible, show the "Hide Ingredients" text
280
+ }
281
  }
282
 
283
  // Function to show ingredient details in the modal