nagasurendra commited on
Commit
306f0b0
·
verified ·
1 Parent(s): 9330678

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +9 -2
templates/menu.html CHANGED
@@ -592,6 +592,7 @@ form-check-input addon-option{
592
  <!-- JavaScript -->
593
  <script>
594
  // Show item details and fetch customization options
 
595
  function showItemDetails(name, price, image, description, section, selectedCategory) {
596
  console.log(`Showing details for: ${name}`);
597
  document.getElementById('modal-name').innerText = name;
@@ -656,9 +657,14 @@ function showItemDetails(name, price, image, description, section, selectedCateg
656
 
657
  const checkboxes = document.querySelectorAll('.addon-option');
658
  checkboxes.forEach(checkbox => {
659
- const checkboxName = checkbox.getAttribute('data-name').trim(); // Trim spaces
 
 
 
 
 
660
  // If the checkbox option is one of the most common add-ons, select it
661
- if (window.most_common_addons.map(addon => addon.trim()).includes(checkboxName)) {
662
  console.log(`Pre-selecting checkbox for: ${checkboxName}`);
663
  checkbox.checked = true;
664
  } else {
@@ -676,6 +682,7 @@ function showItemDetails(name, price, image, description, section, selectedCateg
676
  }
677
 
678
 
 
679
  function handleToggle(source) {
680
  const form = document.getElementById("filter-form");
681
  const veg = document.getElementById("veg-toggle");
 
592
  <!-- JavaScript -->
593
  <script>
594
  // Show item details and fetch customization options
595
+ // Show item details and fetch customization options
596
  function showItemDetails(name, price, image, description, section, selectedCategory) {
597
  console.log(`Showing details for: ${name}`);
598
  document.getElementById('modal-name').innerText = name;
 
657
 
658
  const checkboxes = document.querySelectorAll('.addon-option');
659
  checkboxes.forEach(checkbox => {
660
+ const checkboxName = checkbox.getAttribute('data-name').trim(); // Trim spaces for checkbox value
661
+ // Normalize the most common add-ons to avoid spaces, then check if it's in the list
662
+ const normalizedAddons = window.most_common_addons.map(addon => addon.trim().toLowerCase()); // Normalize all to lowercase
663
+
664
+ console.log(`Checking checkbox for: ${checkboxName}`);
665
+
666
  // If the checkbox option is one of the most common add-ons, select it
667
+ if (normalizedAddons.includes(checkboxName.trim().toLowerCase())) {
668
  console.log(`Pre-selecting checkbox for: ${checkboxName}`);
669
  checkbox.checked = true;
670
  } else {
 
682
  }
683
 
684
 
685
+
686
  function handleToggle(source) {
687
  const form = document.getElementById("filter-form");
688
  const veg = document.getElementById("veg-toggle");