Update templates/menu.html
Browse files- templates/menu.html +25 -7
templates/menu.html
CHANGED
@@ -598,6 +598,7 @@ form-check-input addon-option{
|
|
598 |
console.log("Most common add-ons: ", window.most_common_addons);
|
599 |
// Show item details and fetch customization options
|
600 |
// Show item details and fetch customization options
|
|
|
601 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
602 |
console.log(`Showing details for: ${name}`);
|
603 |
document.getElementById('modal-name').innerText = name;
|
@@ -657,15 +658,31 @@ function showItemDetails(name, price, image, description, section, selectedCateg
|
|
657 |
// Pre-select the most common add-ons (if any)
|
658 |
if (window.most_common_addons && window.most_common_addons.length > 0) {
|
659 |
const checkboxes = document.querySelectorAll('.addon-option');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
checkboxes.forEach(checkbox => {
|
661 |
const checkboxName = checkbox.getAttribute('data-name').trim(); // Trim spaces for checkbox value
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
}
|
670 |
});
|
671 |
}
|
@@ -678,6 +695,7 @@ function showItemDetails(name, price, image, description, section, selectedCateg
|
|
678 |
|
679 |
|
680 |
|
|
|
681 |
function handleToggle(source) {
|
682 |
const form = document.getElementById("filter-form");
|
683 |
const veg = document.getElementById("veg-toggle");
|
|
|
598 |
console.log("Most common add-ons: ", window.most_common_addons);
|
599 |
// Show item details and fetch customization options
|
600 |
// Show item details and fetch customization options
|
601 |
+
// Show item details and fetch customization options
|
602 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
603 |
console.log(`Showing details for: ${name}`);
|
604 |
document.getElementById('modal-name').innerText = name;
|
|
|
658 |
// Pre-select the most common add-ons (if any)
|
659 |
if (window.most_common_addons && window.most_common_addons.length > 0) {
|
660 |
const checkboxes = document.querySelectorAll('.addon-option');
|
661 |
+
|
662 |
+
// Group add-ons by category
|
663 |
+
const categorySelection = {
|
664 |
+
"Spice Level": null, // Ensure only one spice level is selected
|
665 |
+
// Add other categories like "Oil/Ghee" if needed
|
666 |
+
};
|
667 |
+
|
668 |
checkboxes.forEach(checkbox => {
|
669 |
const checkboxName = checkbox.getAttribute('data-name').trim(); // Trim spaces for checkbox value
|
670 |
+
const checkboxGroup = checkbox.getAttribute('data-group'); // Get the category/group of this checkbox
|
671 |
+
|
672 |
+
// If the checkbox belongs to a predefined category like "Spice Level"
|
673 |
+
if (checkboxGroup === "Spice Level") {
|
674 |
+
// If we haven't already selected a spice level, select this one
|
675 |
+
if (categorySelection["Spice Level"] === null) {
|
676 |
+
console.log(`Pre-selecting spice level: ${checkboxName}`);
|
677 |
+
checkbox.checked = true;
|
678 |
+
categorySelection["Spice Level"] = checkboxName; // Mark as selected
|
679 |
+
}
|
680 |
+
} else {
|
681 |
+
// For other categories, select matching add-ons
|
682 |
+
if (window.most_common_addons.includes(checkboxName)) {
|
683 |
+
console.log(`Pre-selecting add-on: ${checkboxName}`);
|
684 |
+
checkbox.checked = true;
|
685 |
+
}
|
686 |
}
|
687 |
});
|
688 |
}
|
|
|
695 |
|
696 |
|
697 |
|
698 |
+
|
699 |
function handleToggle(source) {
|
700 |
const form = document.getElementById("filter-form");
|
701 |
const veg = document.getElementById("veg-toggle");
|