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

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +22 -56
templates/menu.html CHANGED
@@ -229,40 +229,13 @@
229
  border-color: #006400;
230
  }
231
  .addon-section .form-check-input:checked::before {
232
- content: '';
233
  font-size: 14px;
234
  position: absolute;
235
  top: 3px;
236
  left: 4px;
237
  color: white;
238
  }
239
- .addon-section .form-check-input[type="radio"] {
240
- -webkit-appearance: none;
241
- -moz-appearance: none;
242
- appearance: none;
243
- width: 20px;
244
- height: 20px;
245
- border: 2px solid #343a40;
246
- border-radius: 50%;
247
- background-color: #f0f0f0;
248
- position: relative;
249
- margin-right: 10px;
250
- }
251
- .addon-section .form-check-input[type="radio"]:checked {
252
- background-color: #006400;
253
- border-color: #006400;
254
- }
255
- .addon-section .form-check-input[type="radio"]:checked::before {
256
- content: '';
257
- position: absolute;
258
- top: 50%;
259
- left: 50%;
260
- transform: translate(-50%, -50%);
261
- width: 10px;
262
- height: 10px;
263
- background-color: white;
264
- border-radius: 50%;
265
- }
266
  .addon-section .form-check-label {
267
  font-size: 16px;
268
  margin-left: 5px;
@@ -606,7 +579,7 @@
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>
@@ -640,23 +613,13 @@
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);
@@ -704,7 +667,7 @@
704
  }
705
 
706
  document.addEventListener('click', function(event) {
707
- if (event.target.classList.contains('addon-option')) {
708
  handleAddonClick(event.target);
709
  }
710
  });
@@ -712,8 +675,16 @@
712
  function handleAddonClick(checkbox) {
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) {
@@ -775,12 +746,7 @@
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)
@@ -801,7 +767,7 @@
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
 
229
  border-color: #006400;
230
  }
231
  .addon-section .form-check-input:checked::before {
232
+ content: '\2713';
233
  font-size: 14px;
234
  position: absolute;
235
  top: 3px;
236
  left: 4px;
237
  color: white;
238
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  .addon-section .form-check-label {
240
  font-size: 16px;
241
  margin-left: 5px;
 
579
  const optionId = `addon-spice-level-${option}`;
580
  const optionHTML = `
581
  <div class="form-check">
582
+ <input type="checkbox" class="form-check-input spice-level-option" id="${optionId}" value="${option}" data-name="${option}" data-group="Spice Level">
583
  <label class="form-check-label" for="${optionId}">
584
  ${option}
585
  </label>
 
613
  const listItem = document.createElement('div');
614
  listItem.classList.add('form-check');
615
 
616
+ listItem.innerHTML = `
617
+ <input type="checkbox" class="form-check-input ${addon.name.toLowerCase() === 'spice level' ? 'spice-level-option' : 'addon-option'}" id="${optionId}" value="${option}"
618
+ data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
619
+ <label class="form-check-label" for="${optionId}">
620
+ ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
621
+ </label>
622
+ `;
 
 
 
 
 
 
 
 
 
 
623
  optionsContainer.appendChild(listItem);
624
  });
625
  sectionDiv.appendChild(optionsContainer);
 
667
  }
668
 
669
  document.addEventListener('click', function(event) {
670
+ if (event.target.classList.contains('spice-level-option') || event.target.classList.contains('addon-option')) {
671
  handleAddonClick(event.target);
672
  }
673
  });
 
675
  function handleAddonClick(checkbox) {
676
  const groupName = checkbox.getAttribute('data-group');
677
  const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides", "Select Dip/Sauce", "Extra Add-ons", "Make it a Combo", "Beverages", "Sauces"].includes(groupName);
678
+
679
+ if (groupName.toLowerCase() === "spice level") {
680
+ const allSpiceLevelCheckboxes = document.querySelectorAll('.spice-level-option');
681
+ allSpiceLevelCheckboxes.forEach(otherCheckbox => {
682
+ if (otherCheckbox !== checkbox) {
683
+ otherCheckbox.checked = false;
684
+ }
685
+ });
686
+ }
687
+ else if (!isMultiSelectGroup) {
688
  const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
689
  checkboxes.forEach(otherCheckbox => {
690
  if (otherCheckbox !== checkbox) {
 
746
 
747
  const addonsListOptions = document.querySelectorAll('#addons-list .addon-option');
748
  addonsListOptions.forEach(option => {
749
+ if (option.checked) {
 
 
 
 
 
750
  selectedAddOns.push({
751
  name: option.getAttribute('data-name') || 'Default Name',
752
  price: parseFloat(option.getAttribute('data-price') || 0)
 
767
  name: option.getAttribute('data-name') || 'Default Type',
768
  price: 0
769
  }));
770
+ const spiceLevelOption = document.querySelector('#spice-level-options input[type="checkbox"].spice-level-option:checked');
771
  const spiceLevelOptions = spiceLevelOption ? [{
772
  name: spiceLevelOption.getAttribute('data-name') || 'Default Spice Level',
773
  price: 0