Spaces:
Runtime error
Runtime error
Update templates/menu.html
Browse files- templates/menu.html +7 -15
templates/menu.html
CHANGED
@@ -470,7 +470,7 @@ form.text-center.mb-4 {
|
|
470 |
</a>
|
471 |
</div>
|
472 |
|
473 |
-
|
474 |
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
|
475 |
<div class="modal-dialog modal-dialog-centered">
|
476 |
<div class="modal-content">
|
@@ -557,7 +557,7 @@ form.text-center.mb-4 {
|
|
557 |
listItem.classList.add('form-check');
|
558 |
listItem.innerHTML = `
|
559 |
<input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
|
560 |
-
data-name="${option}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
|
561 |
<label class="form-check-label" for="${optionId}">
|
562 |
${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
|
563 |
</label>
|
@@ -583,18 +583,12 @@ form.text-center.mb-4 {
|
|
583 |
|
584 |
// Handle single-select/deselect logic for checkbox groups in all modals
|
585 |
function handleAddonClick(checkbox) {
|
586 |
-
const groupName = checkbox.getAttribute('data-
|
587 |
-
const
|
588 |
-
|
589 |
-
// Define groups that can allow multiple selections
|
590 |
-
const multiSelectGroups = ["Extra Toppings", "Choose Raita/Sides"];
|
591 |
-
|
592 |
-
// Check if this is a multi-select group
|
593 |
-
const isMultiSelectGroup = multiSelectGroups.includes(groupName);
|
594 |
|
|
|
595 |
if (!isMultiSelectGroup) {
|
596 |
-
|
597 |
-
const checkboxes = document.querySelectorAll(`.addon-option[data-name="${groupName}"]`);
|
598 |
checkboxes.forEach(otherCheckbox => {
|
599 |
if (otherCheckbox !== checkbox) {
|
600 |
otherCheckbox.checked = false;
|
@@ -604,7 +598,7 @@ form.text-center.mb-4 {
|
|
604 |
}
|
605 |
</script>
|
606 |
|
607 |
-
function addToCartFromModal() {
|
608 |
const itemName = document.getElementById('modal-name').innerText;
|
609 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
610 |
|
@@ -748,8 +742,6 @@ function roundRewardPoints() {
|
|
748 |
// Run the function when the page loads
|
749 |
window.onload = roundRewardPoints;
|
750 |
|
751 |
-
</script>
|
752 |
-
|
753 |
<!-- Bootstrap JS -->
|
754 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
755 |
</body>
|
|
|
470 |
</a>
|
471 |
</div>
|
472 |
|
473 |
+
<!-- Modal for Item Details -->
|
474 |
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
|
475 |
<div class="modal-dialog modal-dialog-centered">
|
476 |
<div class="modal-content">
|
|
|
557 |
listItem.classList.add('form-check');
|
558 |
listItem.innerHTML = `
|
559 |
<input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
|
560 |
+
data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
|
561 |
<label class="form-check-label" for="${optionId}">
|
562 |
${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
|
563 |
</label>
|
|
|
583 |
|
584 |
// Handle single-select/deselect logic for checkbox groups in all modals
|
585 |
function handleAddonClick(checkbox) {
|
586 |
+
const groupName = checkbox.getAttribute('data-group');
|
587 |
+
const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides"].includes(groupName);
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
|
589 |
+
// If it's not multi-select, uncheck all other checkboxes in the same group
|
590 |
if (!isMultiSelectGroup) {
|
591 |
+
const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
|
|
|
592 |
checkboxes.forEach(otherCheckbox => {
|
593 |
if (otherCheckbox !== checkbox) {
|
594 |
otherCheckbox.checked = false;
|
|
|
598 |
}
|
599 |
</script>
|
600 |
|
601 |
+
function addToCartFromModal() {
|
602 |
const itemName = document.getElementById('modal-name').innerText;
|
603 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
604 |
|
|
|
742 |
// Run the function when the page loads
|
743 |
window.onload = roundRewardPoints;
|
744 |
|
|
|
|
|
745 |
<!-- Bootstrap JS -->
|
746 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
747 |
</body>
|