Update templates/menu.html
Browse files- templates/menu.html +10 -8
templates/menu.html
CHANGED
|
@@ -404,11 +404,9 @@
|
|
| 404 |
document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
|
| 405 |
});
|
| 406 |
}
|
| 407 |
-
|
| 408 |
-
|
| 409 |
function filterMenu() {
|
| 410 |
let input = document.getElementById('searchBar').value.toLowerCase();
|
| 411 |
-
let sections = document.querySelectorAll('
|
| 412 |
let items = document.querySelectorAll('.menu-card'); // Select all items
|
| 413 |
|
| 414 |
let matchedSections = new Set(); // Store matched sections
|
|
@@ -416,11 +414,11 @@
|
|
| 416 |
// Hide all items initially
|
| 417 |
items.forEach(item => {
|
| 418 |
let itemName = item.querySelector('.card-title').innerText.toLowerCase();
|
| 419 |
-
let itemSection = item.closest('.
|
| 420 |
|
| 421 |
if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
|
| 422 |
item.style.display = 'block'; // Show item if it matches search
|
| 423 |
-
matchedSections.add(item.closest('.
|
| 424 |
} else {
|
| 425 |
item.style.display = 'none'; // Hide item if not matched
|
| 426 |
}
|
|
@@ -428,14 +426,18 @@
|
|
| 428 |
|
| 429 |
// Show or hide sections based on matched items
|
| 430 |
sections.forEach(section => {
|
| 431 |
-
|
| 432 |
-
|
|
|
|
|
|
|
| 433 |
} else {
|
| 434 |
-
section.style.display = 'none';
|
|
|
|
| 435 |
}
|
| 436 |
});
|
| 437 |
}
|
| 438 |
|
|
|
|
| 439 |
function addToCartFromModal() {
|
| 440 |
const itemName = document.getElementById('modal-name').innerText;
|
| 441 |
const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
|
|
|
| 404 |
document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
|
| 405 |
});
|
| 406 |
}
|
|
|
|
|
|
|
| 407 |
function filterMenu() {
|
| 408 |
let input = document.getElementById('searchBar').value.toLowerCase();
|
| 409 |
+
let sections = document.querySelectorAll('h3'); // Select section headers
|
| 410 |
let items = document.querySelectorAll('.menu-card'); // Select all items
|
| 411 |
|
| 412 |
let matchedSections = new Set(); // Store matched sections
|
|
|
|
| 414 |
// Hide all items initially
|
| 415 |
items.forEach(item => {
|
| 416 |
let itemName = item.querySelector('.card-title').innerText.toLowerCase();
|
| 417 |
+
let itemSection = item.closest('.row').previousElementSibling.innerText.toLowerCase(); // Get section name
|
| 418 |
|
| 419 |
if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
|
| 420 |
item.style.display = 'block'; // Show item if it matches search
|
| 421 |
+
matchedSections.add(item.closest('.row')); // Add section to matched list
|
| 422 |
} else {
|
| 423 |
item.style.display = 'none'; // Hide item if not matched
|
| 424 |
}
|
|
|
|
| 426 |
|
| 427 |
// Show or hide sections based on matched items
|
| 428 |
sections.forEach(section => {
|
| 429 |
+
let sectionRow = section.nextElementSibling; // The row containing items
|
| 430 |
+
if (matchedSections.has(sectionRow)) {
|
| 431 |
+
section.style.display = 'block'; // Show section header
|
| 432 |
+
sectionRow.style.display = 'flex'; // Show section items
|
| 433 |
} else {
|
| 434 |
+
section.style.display = 'none'; // Hide section header
|
| 435 |
+
sectionRow.style.display = 'none'; // Hide section items
|
| 436 |
}
|
| 437 |
});
|
| 438 |
}
|
| 439 |
|
| 440 |
+
|
| 441 |
function addToCartFromModal() {
|
| 442 |
const itemName = document.getElementById('modal-name').innerText;
|
| 443 |
const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|