Update templates/menu.html
Browse files- templates/menu.html +17 -11
templates/menu.html
CHANGED
@@ -598,7 +598,6 @@ 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 |
-
// 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,11 +657,13 @@ function showItemDetails(name, price, image, description, section, selectedCateg
|
|
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 |
-
//
|
|
|
|
|
666 |
};
|
667 |
|
668 |
checkboxes.forEach(checkbox => {
|
@@ -670,12 +671,19 @@ function showItemDetails(name, price, image, description, section, selectedCateg
|
|
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[
|
676 |
-
console.log(`Pre-selecting spice level: ${checkboxName}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
checkbox.checked = true;
|
678 |
-
categorySelection["
|
679 |
}
|
680 |
} else {
|
681 |
// For other categories, select matching add-ons
|
@@ -694,8 +702,6 @@ function showItemDetails(name, price, image, description, section, selectedCateg
|
|
694 |
}
|
695 |
|
696 |
|
697 |
-
|
698 |
-
|
699 |
function handleToggle(source) {
|
700 |
const form = document.getElementById("filter-form");
|
701 |
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 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
602 |
console.log(`Showing details for: ${name}`);
|
603 |
document.getElementById('modal-name').innerText = name;
|
|
|
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 |
+
|
661 |
// Group add-ons by category
|
662 |
const categorySelection = {
|
663 |
+
"Select Spice Level": null, // Ensure only one spice level is selected
|
664 |
+
"Choose Spice Level": null, // Ensure only one spice level is selected
|
665 |
+
"Raita/Sides": [], // Allow multiple selections for Raita/Sides
|
666 |
+
// Add other categories if needed
|
667 |
};
|
668 |
|
669 |
checkboxes.forEach(checkbox => {
|
|
|
671 |
const checkboxGroup = checkbox.getAttribute('data-group'); // Get the category/group of this checkbox
|
672 |
|
673 |
// If the checkbox belongs to a predefined category like "Spice Level"
|
674 |
+
if (checkboxGroup === "Select Spice Level" || checkboxGroup === "Choose Spice Level") {
|
675 |
+
// If we haven't already selected a spice level for this category, select this one
|
676 |
+
if (categorySelection[checkboxGroup] === null) {
|
677 |
+
console.log(`Pre-selecting spice level: ${checkboxName} for ${checkboxGroup}`);
|
678 |
+
checkbox.checked = true;
|
679 |
+
categorySelection[checkboxGroup] = checkboxName; // Mark as selected for this category
|
680 |
+
}
|
681 |
+
} else if (checkboxGroup === "Raita/Sides") {
|
682 |
+
// For Raita/Sides, select any matching add-ons
|
683 |
+
if (window.most_common_addons.includes(checkboxName)) {
|
684 |
+
console.log(`Pre-selecting add-on: ${checkboxName}`);
|
685 |
checkbox.checked = true;
|
686 |
+
categorySelection["Raita/Sides"].push(checkboxName); // Mark as selected
|
687 |
}
|
688 |
} else {
|
689 |
// For other categories, select matching add-ons
|
|
|
702 |
}
|
703 |
|
704 |
|
|
|
|
|
705 |
function handleToggle(source) {
|
706 |
const form = document.getElementById("filter-form");
|
707 |
const veg = document.getElementById("veg-toggle");
|