Update templates/menu.html
Browse files- templates/menu.html +33 -59
templates/menu.html
CHANGED
@@ -53,14 +53,14 @@
|
|
53 |
border-radius: 15px 15px 0 0;
|
54 |
opacity: 0;
|
55 |
transition: opacity 0.5s ease-in-out;
|
56 |
-
background-color: #000;
|
57 |
}
|
58 |
.menu-video.loaded {
|
59 |
opacity: 1;
|
60 |
}
|
61 |
.menu-card:hover .menu-video {
|
62 |
opacity: 1;
|
63 |
-
transform: scale(1.05);
|
64 |
}
|
65 |
.menu-card .card-body .card-title {
|
66 |
font-size: 1.2rem;
|
@@ -233,29 +233,6 @@
|
|
233 |
.mic-icon.active {
|
234 |
color: #007bff;
|
235 |
}
|
236 |
-
.autocomplete-suggestions {
|
237 |
-
position: absolute;
|
238 |
-
top: 100%;
|
239 |
-
left: 0;
|
240 |
-
width: 100%;
|
241 |
-
max-height: 200px;
|
242 |
-
overflow-y: auto;
|
243 |
-
background-color: #fff;
|
244 |
-
border: 1px solid #ddd;
|
245 |
-
border-radius: 5px;
|
246 |
-
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
247 |
-
z-index: 1000;
|
248 |
-
display: none;
|
249 |
-
}
|
250 |
-
.autocomplete-suggestions .suggestion-item {
|
251 |
-
padding: 8px 15px;
|
252 |
-
cursor: pointer;
|
253 |
-
font-size: 14px;
|
254 |
-
color: #333;
|
255 |
-
}
|
256 |
-
.autocomplete-suggestions .suggestion-item:hover {
|
257 |
-
background-color: #f1f1f1;
|
258 |
-
}
|
259 |
.addon-section {
|
260 |
background-color: #fff;
|
261 |
border: 2px solid #ffa500;
|
@@ -769,7 +746,6 @@
|
|
769 |
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
|
770 |
<i class="bi bi-search search-icon"></i>
|
771 |
<i class="bi bi-mic mic-icon" id="micIcon"></i>
|
772 |
-
<div id="autocompleteSuggestions" class="autocomplete-suggestions"></div>
|
773 |
</div>
|
774 |
</div>
|
775 |
|
@@ -856,14 +832,13 @@
|
|
856 |
</div>
|
857 |
</div>
|
858 |
</div>
|
859 |
-
<!-- Only show toggle-details if not Soft Drinks -->
|
860 |
{% if item.Section__c != 'Soft Drinks' %}
|
861 |
<div class="toggle-details" data-item-name="{{ item.Name | default('Unnamed Item') }}">Show Details</div>
|
862 |
<div class="item-details" id="details-{{ item.Name | default('unnamed-item') | replace(' ', '-') }}">
|
863 |
<h6>Description</h6>
|
864 |
<p>{{ item.Description__c | default('No description available') }}</p>
|
865 |
<h6>Ingredients</h6>
|
866 |
-
<p>{{ item.
|
867 |
<h6>Nutritional Info</h6>
|
868 |
<p class="nutritional-info">{{ item.NutritionalInfo__c | default('Not available') }}</p>
|
869 |
<h6>Allergens</h6>
|
@@ -1149,14 +1124,12 @@
|
|
1149 |
if (itemName === selectedItem) {
|
1150 |
card.classList.add('highlighted');
|
1151 |
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
1152 |
-
// Show details if available
|
1153 |
const toggleLink = card.querySelector('.toggle-details');
|
1154 |
if (toggleLink) {
|
1155 |
toggleLink.click();
|
1156 |
}
|
1157 |
}
|
1158 |
});
|
1159 |
-
// Clear the selected item after highlighting
|
1160 |
localStorage.removeItem('selectedItem');
|
1161 |
}
|
1162 |
|
@@ -1205,7 +1178,6 @@
|
|
1205 |
const detailsDiv = document.getElementById(`details-${itemName}`);
|
1206 |
const isCurrentlyShown = detailsDiv.classList.contains('show');
|
1207 |
|
1208 |
-
// Hide all other details sections
|
1209 |
document.querySelectorAll('.item-details.show').forEach(otherDetails => {
|
1210 |
if (otherDetails !== detailsDiv) {
|
1211 |
otherDetails.classList.remove('show');
|
@@ -1216,7 +1188,6 @@
|
|
1216 |
}
|
1217 |
});
|
1218 |
|
1219 |
-
// Toggle the current details section
|
1220 |
if (!isCurrentlyShown) {
|
1221 |
detailsDiv.classList.add('show');
|
1222 |
this.innerText = 'Hide Details';
|
@@ -1234,7 +1205,7 @@
|
|
1234 |
if (!selectedCategoryInput.value) {
|
1235 |
selectedCategoryInput.value = "All";
|
1236 |
document.querySelector('.category-button[data-category="All"]').classList.add('selected');
|
1237 |
-
|
1238 |
categoryButtons.forEach(button => {
|
1239 |
button.addEventListener('click', function () {
|
1240 |
categoryButtons.forEach(btn => btn.classList.remove('selected'));
|
@@ -1376,7 +1347,6 @@
|
|
1376 |
recognition.lang = 'en-US';
|
1377 |
recognition.onstart = () => micIcon.classList.add('active');
|
1378 |
recognition.onresult = (event) => {
|
1379 |
-
// Navigate to search page with the transcribed query
|
1380 |
const query = event.results[0][0].transcript.trim();
|
1381 |
localStorage.setItem('searchQuery', query);
|
1382 |
window.location.href = '/search';
|
@@ -1483,11 +1453,13 @@
|
|
1483 |
const selectedAddOns = Array.from(
|
1484 |
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
1485 |
).map(addon => ({
|
1486 |
-
name: addon.getAttribute('data-name')
|
1487 |
-
price: parseFloat(addon.getAttribute('data-price') || 0
|
1488 |
}));
|
1489 |
-
const quantity = parseInt(document.getElementById('quantityInput').value) || 1;
|
1490 |
const instructions = document.getElementById('modal-instructions').value;
|
|
|
|
|
|
|
1491 |
const cartPayload = {
|
1492 |
itemName: itemName,
|
1493 |
itemPrice: itemPrice,
|
@@ -1498,7 +1470,6 @@
|
|
1498 |
instructions: instructions,
|
1499 |
quantity: quantity
|
1500 |
};
|
1501 |
-
|
1502 |
fetch('/cart/add', {
|
1503 |
method: 'POST',
|
1504 |
headers: {
|
@@ -1506,27 +1477,30 @@
|
|
1506 |
},
|
1507 |
body: JSON.stringify(cartPayload)
|
1508 |
})
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
|
|
|
|
|
|
1530 |
}
|
1531 |
</script>
|
1532 |
</body>
|
|
|
53 |
border-radius: 15px 15px 0 0;
|
54 |
opacity: 0;
|
55 |
transition: opacity 0.5s ease-in-out;
|
56 |
+
background-color: #000;
|
57 |
}
|
58 |
.menu-video.loaded {
|
59 |
opacity: 1;
|
60 |
}
|
61 |
.menu-card:hover .menu-video {
|
62 |
opacity: 1;
|
63 |
+
transform: scale(1.05);
|
64 |
}
|
65 |
.menu-card .card-body .card-title {
|
66 |
font-size: 1.2rem;
|
|
|
233 |
.mic-icon.active {
|
234 |
color: #007bff;
|
235 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
.addon-section {
|
237 |
background-color: #fff;
|
238 |
border: 2px solid #ffa500;
|
|
|
746 |
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
|
747 |
<i class="bi bi-search search-icon"></i>
|
748 |
<i class="bi bi-mic mic-icon" id="micIcon"></i>
|
|
|
749 |
</div>
|
750 |
</div>
|
751 |
|
|
|
832 |
</div>
|
833 |
</div>
|
834 |
</div>
|
|
|
835 |
{% if item.Section__c != 'Soft Drinks' %}
|
836 |
<div class="toggle-details" data-item-name="{{ item.Name | default('Unnamed Item') }}">Show Details</div>
|
837 |
<div class="item-details" id="details-{{ item.Name | default('unnamed-item') | replace(' ', '-') }}">
|
838 |
<h6>Description</h6>
|
839 |
<p>{{ item.Description__c | default('No description available') }}</p>
|
840 |
<h6>Ingredients</h6>
|
841 |
+
<p>{{ item.IngredientsInfo__c | default('Not specified') }}</p>
|
842 |
<h6>Nutritional Info</h6>
|
843 |
<p class="nutritional-info">{{ item.NutritionalInfo__c | default('Not available') }}</p>
|
844 |
<h6>Allergens</h6>
|
|
|
1124 |
if (itemName === selectedItem) {
|
1125 |
card.classList.add('highlighted');
|
1126 |
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
|
1127 |
const toggleLink = card.querySelector('.toggle-details');
|
1128 |
if (toggleLink) {
|
1129 |
toggleLink.click();
|
1130 |
}
|
1131 |
}
|
1132 |
});
|
|
|
1133 |
localStorage.removeItem('selectedItem');
|
1134 |
}
|
1135 |
|
|
|
1178 |
const detailsDiv = document.getElementById(`details-${itemName}`);
|
1179 |
const isCurrentlyShown = detailsDiv.classList.contains('show');
|
1180 |
|
|
|
1181 |
document.querySelectorAll('.item-details.show').forEach(otherDetails => {
|
1182 |
if (otherDetails !== detailsDiv) {
|
1183 |
otherDetails.classList.remove('show');
|
|
|
1188 |
}
|
1189 |
});
|
1190 |
|
|
|
1191 |
if (!isCurrentlyShown) {
|
1192 |
detailsDiv.classList.add('show');
|
1193 |
this.innerText = 'Hide Details';
|
|
|
1205 |
if (!selectedCategoryInput.value) {
|
1206 |
selectedCategoryInput.value = "All";
|
1207 |
document.querySelector('.category-button[data-category="All"]').classList.add('selected');
|
1208 |
+
}
|
1209 |
categoryButtons.forEach(button => {
|
1210 |
button.addEventListener('click', function () {
|
1211 |
categoryButtons.forEach(btn => btn.classList.remove('selected'));
|
|
|
1347 |
recognition.lang = 'en-US';
|
1348 |
recognition.onstart = () => micIcon.classList.add('active');
|
1349 |
recognition.onresult = (event) => {
|
|
|
1350 |
const query = event.results[0][0].transcript.trim();
|
1351 |
localStorage.setItem('searchQuery', query);
|
1352 |
window.location.href = '/search';
|
|
|
1453 |
const selectedAddOns = Array.from(
|
1454 |
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
1455 |
).map(addon => ({
|
1456 |
+
name: addon.getAttribute('data-name'),
|
1457 |
+
price: parseFloat(addon.getAttribute('data-price')) || 0
|
1458 |
}));
|
|
|
1459 |
const instructions = document.getElementById('modal-instructions').value;
|
1460 |
+
const quantity = parseInt(document.getElementById('quantityInput').value) || 1;
|
1461 |
+
if (isProcessingRequest) return;
|
1462 |
+
isProcessingRequest = true;
|
1463 |
const cartPayload = {
|
1464 |
itemName: itemName,
|
1465 |
itemPrice: itemPrice,
|
|
|
1470 |
instructions: instructions,
|
1471 |
quantity: quantity
|
1472 |
};
|
|
|
1473 |
fetch('/cart/add', {
|
1474 |
method: 'POST',
|
1475 |
headers: {
|
|
|
1477 |
},
|
1478 |
body: JSON.stringify(cartPayload)
|
1479 |
})
|
1480 |
+
.then(response => response.json())
|
1481 |
+
.then(data => {
|
1482 |
+
if (data.success) {
|
1483 |
+
updateCartUI(data.cart);
|
1484 |
+
const modal = bootstrap.Modal.getInstance(document.getElementById('itemModal'));
|
1485 |
+
modal.hide();
|
1486 |
+
} else {
|
1487 |
+
console.error('Failed to add item to cart:', data.error);
|
1488 |
+
const cart = addToCartLocalStorage(cartPayload);
|
1489 |
+
updateCartUI(cart);
|
1490 |
+
const modal = bootstrap.Modal.getInstance(document.getElementById('itemModal'));
|
1491 |
+
modal.hide();
|
1492 |
+
}
|
1493 |
+
})
|
1494 |
+
.catch(err => {
|
1495 |
+
console.error('Error adding item to cart:', err);
|
1496 |
+
const cart = addToCartLocalStorage(cartPayload);
|
1497 |
+
updateCartUI(cart);
|
1498 |
+
const modal = bootstrap.Modal.getInstance(document.getElementById('itemModal'));
|
1499 |
+
modal.hide();
|
1500 |
+
})
|
1501 |
+
.finally(() => {
|
1502 |
+
isProcessingRequest = false;
|
1503 |
+
});
|
1504 |
}
|
1505 |
</script>
|
1506 |
</body>
|