Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +8 -7
templates/menu.html
CHANGED
@@ -598,7 +598,7 @@ form.text-center.mb-4 {
|
|
598 |
}
|
599 |
</script>
|
600 |
|
601 |
-
|
602 |
const itemName = document.getElementById('modal-name').innerText;
|
603 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
604 |
|
@@ -614,10 +614,10 @@ form.text-center.mb-4 {
|
|
614 |
const section = modalSectionEl.getAttribute('data-section');
|
615 |
const selectedCategory = modalSectionEl.getAttribute('data-category');
|
616 |
if (!itemName || !itemPrice || !section || !itemImage) {
|
617 |
-
console.error('Missing data for cart item:', { itemName, itemPrice, section, itemImage});
|
618 |
return;
|
619 |
}
|
620 |
-
|
621 |
// Collect selected add-ons
|
622 |
let selectedAddOns = Array.from(
|
623 |
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
@@ -694,6 +694,7 @@ function updateCartDisplay(cart) {
|
|
694 |
successNotification.remove(); // Remove success notification after a few seconds
|
695 |
}, 2000);
|
696 |
}
|
|
|
697 |
document.addEventListener('DOMContentLoaded', function () {
|
698 |
// Get references to the quantity buttons and the input field
|
699 |
const decreaseBtn = document.getElementById('decreaseQuantity');
|
@@ -717,7 +718,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
717 |
});
|
718 |
});
|
719 |
|
720 |
-
|
721 |
function roundRewardPoints() {
|
722 |
// Get the reward points element
|
723 |
let rewardPointsElement = document.getElementById('reward-points');
|
@@ -739,9 +740,9 @@ function roundRewardPoints() {
|
|
739 |
console.error("Reward points element is missing.");
|
740 |
}
|
741 |
}
|
742 |
-
|
743 |
-
|
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>
|
|
|
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 |
|
|
|
614 |
const section = modalSectionEl.getAttribute('data-section');
|
615 |
const selectedCategory = modalSectionEl.getAttribute('data-category');
|
616 |
if (!itemName || !itemPrice || !section || !itemImage) {
|
617 |
+
console.error('Missing data for cart item:', { itemName, itemPrice, section, itemImage });
|
618 |
return;
|
619 |
}
|
620 |
+
|
621 |
// Collect selected add-ons
|
622 |
let selectedAddOns = Array.from(
|
623 |
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
|
|
694 |
successNotification.remove(); // Remove success notification after a few seconds
|
695 |
}, 2000);
|
696 |
}
|
697 |
+
|
698 |
document.addEventListener('DOMContentLoaded', function () {
|
699 |
// Get references to the quantity buttons and the input field
|
700 |
const decreaseBtn = document.getElementById('decreaseQuantity');
|
|
|
718 |
});
|
719 |
});
|
720 |
|
721 |
+
// Function to round reward points to a single digit
|
722 |
function roundRewardPoints() {
|
723 |
// Get the reward points element
|
724 |
let rewardPointsElement = document.getElementById('reward-points');
|
|
|
740 |
console.error("Reward points element is missing.");
|
741 |
}
|
742 |
}
|
743 |
+
// Run the function when the page loads
|
744 |
+
window.onload = roundRewardPoints;
|
745 |
+
|
746 |
<!-- Bootstrap JS -->
|
747 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
748 |
</body>
|