Update templates/menu.html
Browse files- templates/menu.html +19 -10
templates/menu.html
CHANGED
@@ -587,10 +587,13 @@ form-check-input addon-option{
|
|
587 |
</div>
|
588 |
</div>
|
589 |
</div>
|
|
|
|
|
590 |
</div>
|
591 |
|
592 |
<!-- JavaScript -->
|
593 |
<script>
|
|
|
594 |
// Show item details and fetch customization options
|
595 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
596 |
console.log(`Showing details for: ${name}`);
|
@@ -609,17 +612,23 @@ function showItemDetails(name, price, image, description, section, selectedCateg
|
|
609 |
|
610 |
// Display most common add-ons if available
|
611 |
const mostCommonAddonsSection = document.getElementById('most-common-addons');
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
window.most_common_addons.
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
} else {
|
622 |
-
|
623 |
}
|
624 |
|
625 |
// Fetch customization options based on the section
|
|
|
587 |
</div>
|
588 |
</div>
|
589 |
</div>
|
590 |
+
<div id="most-common-addons"></div>
|
591 |
+
|
592 |
</div>
|
593 |
|
594 |
<!-- JavaScript -->
|
595 |
<script>
|
596 |
+
|
597 |
// Show item details and fetch customization options
|
598 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
599 |
console.log(`Showing details for: ${name}`);
|
|
|
612 |
|
613 |
// Display most common add-ons if available
|
614 |
const mostCommonAddonsSection = document.getElementById('most-common-addons');
|
615 |
+
|
616 |
+
// Ensure the element exists before setting its innerHTML
|
617 |
+
if (mostCommonAddonsSection) {
|
618 |
+
mostCommonAddonsSection.innerHTML = ''; // Clear previous content
|
619 |
+
if (window.most_common_addons && window.most_common_addons.length > 0) {
|
620 |
+
// Display the most common add-ons
|
621 |
+
let commonAddonsText = "<h6>Most Common Add-Ons:</h6><ul>";
|
622 |
+
window.most_common_addons.forEach(addon => {
|
623 |
+
commonAddonsText += `<li>${addon}</li>`;
|
624 |
+
});
|
625 |
+
commonAddonsText += "</ul>";
|
626 |
+
mostCommonAddonsSection.innerHTML = commonAddonsText;
|
627 |
+
} else {
|
628 |
+
mostCommonAddonsSection.innerHTML = '<p>No most common add-ons found.</p>';
|
629 |
+
}
|
630 |
} else {
|
631 |
+
console.error("Element with id 'most-common-addons' not found.");
|
632 |
}
|
633 |
|
634 |
// Fetch customization options based on the section
|