Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +85 -15
templates/menu.html
CHANGED
|
@@ -228,6 +228,29 @@
|
|
| 228 |
font-size: 18px;
|
| 229 |
color: #888;
|
| 230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
.addon-section {
|
| 232 |
background-color: #fff;
|
| 233 |
border: 2px solid #6c757d;
|
|
@@ -631,8 +654,9 @@
|
|
| 631 |
</div>
|
| 632 |
</div>
|
| 633 |
<div class="search-bar-container">
|
| 634 |
-
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections...">
|
| 635 |
<i class="bi bi-search search-icon"></i>
|
|
|
|
| 636 |
</div>
|
| 637 |
</div>
|
| 638 |
|
|
@@ -791,6 +815,28 @@
|
|
| 791 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
| 792 |
|
| 793 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 794 |
const menuItemDetails = {
|
| 795 |
"Veg Manchurian": {
|
| 796 |
ingredients: "Cauliflower, Onion, Ginger, Garlic, Soy Sauce, Cornflour, Green Chilies, Capsicum, Spring Onion",
|
|
@@ -923,7 +969,6 @@
|
|
| 923 |
}
|
| 924 |
|
| 925 |
document.addEventListener('DOMContentLoaded', function () {
|
| 926 |
-
// Avatar Dropdown Click Toggle
|
| 927 |
const avatarContainer = document.querySelector('.avatar-dropdown-container');
|
| 928 |
const dropdownMenu = document.querySelector('.dropdown-menu');
|
| 929 |
|
|
@@ -945,9 +990,7 @@
|
|
| 945 |
});
|
| 946 |
});
|
| 947 |
|
| 948 |
-
// Existing Menu Functionality
|
| 949 |
const menuCards = document.querySelectorAll('.menu-card');
|
| 950 |
-
|
| 951 |
menuCards.forEach(card => {
|
| 952 |
const itemName = card.querySelector('.card-title').innerText;
|
| 953 |
const detailsDiv = card.querySelector('.item-details');
|
|
@@ -973,7 +1016,6 @@
|
|
| 973 |
});
|
| 974 |
|
| 975 |
const menuImages = document.querySelectorAll('.menu-image');
|
| 976 |
-
|
| 977 |
const cardObserver = new IntersectionObserver((entries, observer) => {
|
| 978 |
entries.forEach(entry => {
|
| 979 |
if (entry.isIntersecting) {
|
|
@@ -1032,6 +1074,44 @@
|
|
| 1032 |
categoryForm.submit();
|
| 1033 |
});
|
| 1034 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1035 |
});
|
| 1036 |
|
| 1037 |
function debounce(func, wait) {
|
|
@@ -1053,8 +1133,6 @@
|
|
| 1053 |
modalImg.src = image || '/static/placeholder.jpg';
|
| 1054 |
}
|
| 1055 |
document.getElementById('modal-description').innerText = description || 'No description available.';
|
| 1056 |
-
|
| 1057 |
-
// Populate nutritional info
|
| 1058 |
const nutritionalInfoEl = document.getElementById('modal-nutritional-info');
|
| 1059 |
const itemDetails = menuItemDetails[name];
|
| 1060 |
if (itemDetails && itemDetails.nutritionalInfo) {
|
|
@@ -1066,11 +1144,9 @@
|
|
| 1066 |
|
| 1067 |
document.getElementById('addons-list').innerHTML = 'Loading customization options...';
|
| 1068 |
document.getElementById('modal-instructions').value = '';
|
| 1069 |
-
|
| 1070 |
const modalSectionEl = document.getElementById('modal-section');
|
| 1071 |
modalSectionEl.setAttribute('data-section', section);
|
| 1072 |
modalSectionEl.setAttribute('data-category', selectedCategory);
|
| 1073 |
-
|
| 1074 |
document.getElementById('quantityInput').value = 1;
|
| 1075 |
|
| 1076 |
const prepStyleOptions = document.getElementById('prep-style-options');
|
|
@@ -1096,7 +1172,6 @@
|
|
| 1096 |
|
| 1097 |
const addonsList = document.getElementById('addons-list');
|
| 1098 |
addonsList.innerHTML = '';
|
| 1099 |
-
|
| 1100 |
const dummySections = [
|
| 1101 |
{ name: "Beverages", options: ["Sprite ($3)", "Thums Up ($3)", "Virgin Mojito ($3)", "Lemonade ($3)", "Blue Lagoon Mocktail ($3)"] },
|
| 1102 |
{ name: "Sauces", options: ["Mint Chutney", "Tomato Sauce"] },
|
|
@@ -1326,17 +1401,13 @@
|
|
| 1326 |
});
|
| 1327 |
}
|
| 1328 |
|
| 1329 |
-
document.getElementById('searchBar').addEventListener('keyup', debounce(filterMenu, 300));
|
| 1330 |
-
|
| 1331 |
function addToCartFromModal() {
|
| 1332 |
const itemName = document.getElementById('modal-name').innerText;
|
| 1333 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
| 1334 |
-
|
| 1335 |
if (isNaN(itemPrice)) {
|
| 1336 |
alert('Invalid price for the item. Please check the item details.');
|
| 1337 |
return;
|
| 1338 |
}
|
| 1339 |
-
|
| 1340 |
const itemImage = document.getElementById('modal-img').src;
|
| 1341 |
const modalSectionEl = document.getElementById('modal-section');
|
| 1342 |
const section = modalSectionEl.getAttribute('data-section');
|
|
@@ -1347,7 +1418,6 @@
|
|
| 1347 |
}
|
| 1348 |
|
| 1349 |
let selectedAddOns = [];
|
| 1350 |
-
|
| 1351 |
const addonsListOptions = document.querySelectorAll('#addons-list .addon-option');
|
| 1352 |
addonsListOptions.forEach(option => {
|
| 1353 |
if (option.checked) {
|
|
|
|
| 228 |
font-size: 18px;
|
| 229 |
color: #888;
|
| 230 |
}
|
| 231 |
+
.autocomplete-suggestions {
|
| 232 |
+
position: absolute;
|
| 233 |
+
top: 100%;
|
| 234 |
+
left: 0;
|
| 235 |
+
width: 100%;
|
| 236 |
+
max-height: 200px;
|
| 237 |
+
overflow-y: auto;
|
| 238 |
+
background-color: #fff;
|
| 239 |
+
border: 1px solid #ddd;
|
| 240 |
+
border-radius: 5px;
|
| 241 |
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
| 242 |
+
z-index: 1000;
|
| 243 |
+
display: none;
|
| 244 |
+
}
|
| 245 |
+
.autocomplete-suggestions .suggestion-item {
|
| 246 |
+
padding: 8px 15px;
|
| 247 |
+
cursor: pointer;
|
| 248 |
+
font-size: 14px;
|
| 249 |
+
color: #333;
|
| 250 |
+
}
|
| 251 |
+
.autocomplete-suggestions .suggestion-item:hover {
|
| 252 |
+
background-color: #f1f1f1;
|
| 253 |
+
}
|
| 254 |
.addon-section {
|
| 255 |
background-color: #fff;
|
| 256 |
border: 2px solid #6c757d;
|
|
|
|
| 654 |
</div>
|
| 655 |
</div>
|
| 656 |
<div class="search-bar-container">
|
| 657 |
+
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
|
| 658 |
<i class="bi bi-search search-icon"></i>
|
| 659 |
+
<div id="autocompleteSuggestions" class="autocomplete-suggestions"></div>
|
| 660 |
</div>
|
| 661 |
</div>
|
| 662 |
|
|
|
|
| 815 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
| 816 |
|
| 817 |
<script>
|
| 818 |
+
// Menu items list for autocomplete
|
| 819 |
+
const menuItems = [
|
| 820 |
+
"Veg Manchurian",
|
| 821 |
+
"Veg Biryani",
|
| 822 |
+
"Sukka Gosht (Goat)",
|
| 823 |
+
"Samosa",
|
| 824 |
+
"Roti",
|
| 825 |
+
"Prawn Fry",
|
| 826 |
+
"Paneer Butter Masala",
|
| 827 |
+
"Paneer Biryani",
|
| 828 |
+
"Onion Pakoda",
|
| 829 |
+
"Mutton Biryani",
|
| 830 |
+
"Fish Curry",
|
| 831 |
+
"Fiery Mango Glaze Chicken",
|
| 832 |
+
"Chilli Gobi",
|
| 833 |
+
"Chilli Chicken",
|
| 834 |
+
"Chicken Manchurian",
|
| 835 |
+
"Chicken Curry",
|
| 836 |
+
"Chicken Biryani",
|
| 837 |
+
"Channa Masala"
|
| 838 |
+
];
|
| 839 |
+
|
| 840 |
const menuItemDetails = {
|
| 841 |
"Veg Manchurian": {
|
| 842 |
ingredients: "Cauliflower, Onion, Ginger, Garlic, Soy Sauce, Cornflour, Green Chilies, Capsicum, Spring Onion",
|
|
|
|
| 969 |
}
|
| 970 |
|
| 971 |
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
| 972 |
const avatarContainer = document.querySelector('.avatar-dropdown-container');
|
| 973 |
const dropdownMenu = document.querySelector('.dropdown-menu');
|
| 974 |
|
|
|
|
| 990 |
});
|
| 991 |
});
|
| 992 |
|
|
|
|
| 993 |
const menuCards = document.querySelectorAll('.menu-card');
|
|
|
|
| 994 |
menuCards.forEach(card => {
|
| 995 |
const itemName = card.querySelector('.card-title').innerText;
|
| 996 |
const detailsDiv = card.querySelector('.item-details');
|
|
|
|
| 1016 |
});
|
| 1017 |
|
| 1018 |
const menuImages = document.querySelectorAll('.menu-image');
|
|
|
|
| 1019 |
const cardObserver = new IntersectionObserver((entries, observer) => {
|
| 1020 |
entries.forEach(entry => {
|
| 1021 |
if (entry.isIntersecting) {
|
|
|
|
| 1074 |
categoryForm.submit();
|
| 1075 |
});
|
| 1076 |
});
|
| 1077 |
+
|
| 1078 |
+
// Autocomplete functionality
|
| 1079 |
+
const searchBar = document.getElementById('searchBar');
|
| 1080 |
+
const suggestionsContainer = document.getElementById('autocompleteSuggestions');
|
| 1081 |
+
|
| 1082 |
+
searchBar.addEventListener('input', function () {
|
| 1083 |
+
const input = this.value.trim().toLowerCase();
|
| 1084 |
+
suggestionsContainer.innerHTML = '';
|
| 1085 |
+
suggestionsContainer.style.display = 'none';
|
| 1086 |
+
|
| 1087 |
+
if (input) {
|
| 1088 |
+
const filteredItems = menuItems.filter(item =>
|
| 1089 |
+
item.toLowerCase().startsWith(input)
|
| 1090 |
+
);
|
| 1091 |
+
if (filteredItems.length > 0) {
|
| 1092 |
+
filteredItems.forEach(item => {
|
| 1093 |
+
const suggestionDiv = document.createElement('div');
|
| 1094 |
+
suggestionDiv.classList.add('suggestion-item');
|
| 1095 |
+
suggestionDiv.innerText = item;
|
| 1096 |
+
suggestionDiv.addEventListener('click', function () {
|
| 1097 |
+
searchBar.value = item;
|
| 1098 |
+
suggestionsContainer.style.display = 'none';
|
| 1099 |
+
filterMenu();
|
| 1100 |
+
});
|
| 1101 |
+
suggestionsContainer.appendChild(suggestionDiv);
|
| 1102 |
+
});
|
| 1103 |
+
suggestionsContainer.style.display = 'block';
|
| 1104 |
+
}
|
| 1105 |
+
}
|
| 1106 |
+
});
|
| 1107 |
+
|
| 1108 |
+
document.addEventListener('click', function (event) {
|
| 1109 |
+
if (!searchBar.contains(event.target) && !suggestionsContainer.contains(event.target)) {
|
| 1110 |
+
suggestionsContainer.style.display = 'none';
|
| 1111 |
+
}
|
| 1112 |
+
});
|
| 1113 |
+
|
| 1114 |
+
searchBar.addEventListener('keyup', debounce(filterMenu, 300));
|
| 1115 |
});
|
| 1116 |
|
| 1117 |
function debounce(func, wait) {
|
|
|
|
| 1133 |
modalImg.src = image || '/static/placeholder.jpg';
|
| 1134 |
}
|
| 1135 |
document.getElementById('modal-description').innerText = description || 'No description available.';
|
|
|
|
|
|
|
| 1136 |
const nutritionalInfoEl = document.getElementById('modal-nutritional-info');
|
| 1137 |
const itemDetails = menuItemDetails[name];
|
| 1138 |
if (itemDetails && itemDetails.nutritionalInfo) {
|
|
|
|
| 1144 |
|
| 1145 |
document.getElementById('addons-list').innerHTML = 'Loading customization options...';
|
| 1146 |
document.getElementById('modal-instructions').value = '';
|
|
|
|
| 1147 |
const modalSectionEl = document.getElementById('modal-section');
|
| 1148 |
modalSectionEl.setAttribute('data-section', section);
|
| 1149 |
modalSectionEl.setAttribute('data-category', selectedCategory);
|
|
|
|
| 1150 |
document.getElementById('quantityInput').value = 1;
|
| 1151 |
|
| 1152 |
const prepStyleOptions = document.getElementById('prep-style-options');
|
|
|
|
| 1172 |
|
| 1173 |
const addonsList = document.getElementById('addons-list');
|
| 1174 |
addonsList.innerHTML = '';
|
|
|
|
| 1175 |
const dummySections = [
|
| 1176 |
{ name: "Beverages", options: ["Sprite ($3)", "Thums Up ($3)", "Virgin Mojito ($3)", "Lemonade ($3)", "Blue Lagoon Mocktail ($3)"] },
|
| 1177 |
{ name: "Sauces", options: ["Mint Chutney", "Tomato Sauce"] },
|
|
|
|
| 1401 |
});
|
| 1402 |
}
|
| 1403 |
|
|
|
|
|
|
|
| 1404 |
function addToCartFromModal() {
|
| 1405 |
const itemName = document.getElementById('modal-name').innerText;
|
| 1406 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
|
|
|
| 1407 |
if (isNaN(itemPrice)) {
|
| 1408 |
alert('Invalid price for the item. Please check the item details.');
|
| 1409 |
return;
|
| 1410 |
}
|
|
|
|
| 1411 |
const itemImage = document.getElementById('modal-img').src;
|
| 1412 |
const modalSectionEl = document.getElementById('modal-section');
|
| 1413 |
const section = modalSectionEl.getAttribute('data-section');
|
|
|
|
| 1418 |
}
|
| 1419 |
|
| 1420 |
let selectedAddOns = [];
|
|
|
|
| 1421 |
const addonsListOptions = document.querySelectorAll('#addons-list .addon-option');
|
| 1422 |
addonsListOptions.forEach(option => {
|
| 1423 |
if (option.checked) {
|