lokesh341 commited on
Commit
b7be7b3
·
verified ·
1 Parent(s): 9e2fb5a

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +38 -16
templates/menu.html CHANGED
@@ -266,6 +266,7 @@
266
  .addon-section .form-check-label {
267
  font-size: 16px;
268
  margin-left: 5px;
 
269
  cursor: pointer;
270
  display: inline-block;
271
  vertical-align: middle;
@@ -605,7 +606,7 @@
605
  const optionId = `addon-spice-level-${option}`;
606
  const optionHTML = `
607
  <div class="form-check">
608
- <input type="radio" class="form-check-input" name="spice-level" id="${optionId}" value="${option}" data-name="${option}" data-group="Spice Level">
609
  <label class="form-check-label" for="${optionId}">
610
  ${option}
611
  </label>
@@ -638,13 +639,24 @@
638
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
639
  const listItem = document.createElement('div');
640
  listItem.classList.add('form-check');
641
- listItem.innerHTML = `
642
- <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
643
- data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
644
- <label class="form-check-label" for="${optionId}">
645
- ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
646
- </label>
647
- `;
 
 
 
 
 
 
 
 
 
 
 
648
  optionsContainer.appendChild(listItem);
649
  });
650
  sectionDiv.appendChild(optionsContainer);
@@ -701,7 +713,7 @@
701
  const groupName = checkbox.getAttribute('data-group');
702
  const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides", "Select Dip/Sauce", "Extra Add-ons", "Make it a Combo", "Beverages", "Sauces"].includes(groupName);
703
 
704
- if (!isMultiSelectGroup) {
705
  const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
706
  checkboxes.forEach(otherCheckbox => {
707
  if (otherCheckbox !== checkbox) {
@@ -759,12 +771,22 @@
759
  return;
760
  }
761
 
762
- let selectedAddOns = Array.from(
763
- document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
764
- ).map(addon => ({
765
- name: addon.getAttribute('data-name') || 'Default Name',
766
- price: parseFloat(addon.getAttribute('data-price') || 0)
767
- }));
 
 
 
 
 
 
 
 
 
 
768
 
769
  if (section.toLowerCase() === 'starters') {
770
  const prepStyleOptions = Array.from(
@@ -779,7 +801,7 @@
779
  name: option.getAttribute('data-name') || 'Default Type',
780
  price: 0
781
  }));
782
- const spiceLevelOption = document.querySelector('#spice-level-options input[type="radio"][name="spice-level"]:checked');
783
  const spiceLevelOptions = spiceLevelOption ? [{
784
  name: spiceLevelOption.getAttribute('data-name') || 'Default Spice Level',
785
  price: 0
 
266
  .addon-section .form-check-label {
267
  font-size: 16px;
268
  margin-left: 5px;
269
+ margin-right: 15px;
270
  cursor: pointer;
271
  display: inline-block;
272
  vertical-align: middle;
 
606
  const optionId = `addon-spice-level-${option}`;
607
  const optionHTML = `
608
  <div class="form-check">
609
+ <input type="radio" class="form-check-input" name="spice-level-first-row" id="${optionId}" value="${option}" data-name="${option}" data-group="Spice Level">
610
  <label class="form-check-label" for="${optionId}">
611
  ${option}
612
  </label>
 
639
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
640
  const listItem = document.createElement('div');
641
  listItem.classList.add('form-check');
642
+
643
+ if (addon.name.toLowerCase() === "spice level") {
644
+ listItem.innerHTML = `
645
+ <input type="radio" class="form-check-input addon-option" name="spice-level-addons" id="${optionId}" value="${option}"
646
+ data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
647
+ <label class="form-check-label" for="${optionId}">
648
+ ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
649
+ </label>
650
+ `;
651
+ } else {
652
+ listItem.innerHTML = `
653
+ <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
654
+ data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
655
+ <label class="form-check-label" for="${optionId}">
656
+ ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
657
+ </label>
658
+ `;
659
+ }
660
  optionsContainer.appendChild(listItem);
661
  });
662
  sectionDiv.appendChild(optionsContainer);
 
713
  const groupName = checkbox.getAttribute('data-group');
714
  const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides", "Select Dip/Sauce", "Extra Add-ons", "Make it a Combo", "Beverages", "Sauces"].includes(groupName);
715
 
716
+ if (!isMultiSelectGroup && groupName.toLowerCase() !== "spice level") {
717
  const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
718
  checkboxes.forEach(otherCheckbox => {
719
  if (otherCheckbox !== checkbox) {
 
771
  return;
772
  }
773
 
774
+ let selectedAddOns = [];
775
+
776
+ const addonsListOptions = document.querySelectorAll('#addons-list .addon-option');
777
+ addonsListOptions.forEach(option => {
778
+ if (option.type === "radio" && option.checked) {
779
+ selectedAddOns.push({
780
+ name: option.getAttribute('data-name') || 'Default Name',
781
+ price: parseFloat(option.getAttribute('data-price') || 0)
782
+ });
783
+ } else if (option.type === "checkbox" && option.checked) {
784
+ selectedAddOns.push({
785
+ name: option.getAttribute('data-name') || 'Default Name',
786
+ price: parseFloat(option.getAttribute('data-price') || 0)
787
+ });
788
+ }
789
+ });
790
 
791
  if (section.toLowerCase() === 'starters') {
792
  const prepStyleOptions = Array.from(
 
801
  name: option.getAttribute('data-name') || 'Default Type',
802
  price: 0
803
  }));
804
+ const spiceLevelOption = document.querySelector('#spice-level-options input[type="radio"][name="spice-level-first-row"]:checked');
805
  const spiceLevelOptions = spiceLevelOption ? [{
806
  name: spiceLevelOption.getAttribute('data-name') || 'Default Spice Level',
807
  price: 0