DSatishchandra commited on
Commit
94eaf2d
·
verified ·
1 Parent(s): 480cb3f

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +28 -30
templates/menu.html CHANGED
@@ -419,19 +419,31 @@ form-check-input addon-option{
419
  <form method="get" action="/menu" class="text-center mb-4">
420
  <label class="form-label fw-bold">Select a Category:</label>
421
  <div class="form-check form-check-inline">
422
- {% for category in categories %}
423
- <input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
424
- {% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
425
- <label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
426
- {% endfor %}
427
- </div>
428
- <!-- Separate Customized Dish radio button in a new div to align it properly -->
 
 
 
 
 
 
 
 
 
 
 
429
  <div class="form-check">
430
  <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
431
  {% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
432
  <label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
433
  </div>
434
  </form>
 
435
 
436
  <!-- Show menu items only when Customized Dish is not selected -->
437
  <div class="container mt-4">
@@ -773,31 +785,17 @@ document.addEventListener('DOMContentLoaded', function () {
773
  });
774
  });
775
 
776
- // Function to round reward points to a single digit
777
- function roundRewardPoints() {
778
- // Get the reward points element
779
- let rewardPointsElement = document.getElementById('reward-points');
780
-
781
- // Check if the element exists in the DOM
782
- if (rewardPointsElement) {
783
- let rewardPointsText = rewardPointsElement.innerText.trim(); // Get and trim the value to remove any extra spaces
784
-
785
- // Check if the innerText is a valid number
786
- let rewardPoints = parseFloat(rewardPointsText);
787
-
788
- // If it's a valid number, round it to 1 decimal place
789
- if (!isNaN(rewardPoints)) {
790
- rewardPointsElement.innerText = rewardPoints.toFixed(1); // Round to 1 decimal place
791
- } else {
792
- console.error("Reward points value is not a valid number:", rewardPointsText);
793
- }
794
  } else {
795
- console.error("Reward points element is missing.");
 
796
  }
797
- }
798
- // Run the function when the page loads
799
- window.onload = roundRewardPoints;
800
-
801
  </script>
802
 
803
  <!-- Bootstrap JS -->
 
419
  <form method="get" action="/menu" class="text-center mb-4">
420
  <label class="form-label fw-bold">Select a Category:</label>
421
  <div class="form-check form-check-inline">
422
+ <!-- Default category for Veg with remove radio button -->
423
+ <input type="radio" id="category-Veg" name="category" value="Veg" class="custom-radio"
424
+ {% if selected_category == "Veg" %}checked{% endif %} onchange="this.form.submit()">
425
+ <label class="form-check-label" for="category-Veg">Veg</label>
426
+
427
+ <!-- Remove Selection radio button for Veg category -->
428
+ <input type="radio" id="category-Remove" name="category" value="Remove" class="custom-radio"
429
+ {% if selected_category == "Remove" %}checked{% endif %} onchange="this.form.submit()">
430
+ <label class="form-check-label" for="category-Remove">Remove Selection</label>
431
+ </div>
432
+
433
+ <!-- Toggle switch for Veg/Non-Veg -->
434
+ <div class="form-check form-check-inline">
435
+ <input type="checkbox" id="vegToggle" class="form-check-input" onchange="toggleVegCategory()">
436
+ <label class="form-check-label" for="vegToggle">Toggle Veg/Non-Veg</label>
437
+ </div>
438
+
439
+ <!-- Separate Customized Dish radio button in a new div to align it properly -->
440
  <div class="form-check">
441
  <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
442
  {% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
443
  <label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
444
  </div>
445
  </form>
446
+
447
 
448
  <!-- Show menu items only when Customized Dish is not selected -->
449
  <div class="container mt-4">
 
785
  });
786
  });
787
 
788
+ // Toggle Veg/Non-Veg selection
789
+ function toggleVegCategory() {
790
+ const toggle = document.getElementById('vegToggle');
791
+ if (toggle.checked) {
792
+ // If checked, set category to Veg
793
+ window.location.href = '/menu?category=Veg'; // Change URL to reflect the new selection
 
 
 
 
 
 
 
 
 
 
 
 
794
  } else {
795
+ // If unchecked, set category to Non-Veg or remove the selection
796
+ window.location.href = '/menu?category=Non-Veg'; // Or another fallback category
797
  }
798
+ }
 
 
 
799
  </script>
800
 
801
  <!-- Bootstrap JS -->