Update templates/menu.html
Browse files- templates/menu.html +69 -62
templates/menu.html
CHANGED
@@ -73,6 +73,7 @@
|
|
73 |
width: 100%;
|
74 |
height: 100%;
|
75 |
object-fit: cover;
|
|
|
76 |
opacity: 1;
|
77 |
transition: opacity 0.3s ease;
|
78 |
}
|
@@ -157,7 +158,7 @@
|
|
157 |
width: 40px;
|
158 |
height: 40px;
|
159 |
border-radius: 50%;
|
160 |
-
background: linear-gradient(45deg, #
|
161 |
cursor: pointer;
|
162 |
display: flex;
|
163 |
align-items: center;
|
@@ -175,13 +176,13 @@
|
|
175 |
position: absolute;
|
176 |
right: 0;
|
177 |
top: 100%;
|
178 |
-
background
|
179 |
-
border-radius:
|
180 |
-
width:
|
181 |
-
box-shadow: 0
|
182 |
display: none;
|
183 |
border: none;
|
184 |
-
padding:
|
185 |
animation: slideDown 0.3s ease-out;
|
186 |
z-index: 1000;
|
187 |
overflow: hidden;
|
@@ -190,23 +191,24 @@
|
|
190 |
display: block;
|
191 |
}
|
192 |
.dropdown-menu .dropdown-item {
|
193 |
-
padding:
|
194 |
text-decoration: none;
|
195 |
color: #333;
|
196 |
display: flex;
|
197 |
align-items: center;
|
198 |
-
font-size:
|
199 |
font-weight: 500;
|
200 |
-
transition: background-color 0.2s ease, color 0.2s ease;
|
201 |
}
|
202 |
.dropdown-menu .dropdown-item i {
|
203 |
-
margin-right:
|
204 |
-
font-size:
|
205 |
color: #0FAA39;
|
206 |
}
|
207 |
.dropdown-menu .dropdown-item:hover {
|
208 |
background-color: #e6f4ea;
|
209 |
-
color: #
|
|
|
210 |
}
|
211 |
.dropdown-menu .dropdown-item:hover i {
|
212 |
color: #0D9232;
|
@@ -419,9 +421,10 @@
|
|
419 |
text-align: center;
|
420 |
}
|
421 |
#softDrinkModal .modal-body img {
|
422 |
-
|
423 |
-
|
424 |
object-fit: cover;
|
|
|
425 |
border-radius: 8px;
|
426 |
margin-bottom: 15px;
|
427 |
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
@@ -634,9 +637,10 @@
|
|
634 |
margin: 0;
|
635 |
}
|
636 |
#micModal .modal-body #mic-item-image {
|
637 |
-
|
638 |
-
|
639 |
object-fit: cover;
|
|
|
640 |
border-radius: 8px;
|
641 |
margin-bottom: 10px;
|
642 |
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
@@ -694,11 +698,15 @@
|
|
694 |
padding: 15px;
|
695 |
}
|
696 |
.modal-body #modal-img {
|
697 |
-
|
698 |
-
|
699 |
object-fit: cover;
|
|
|
700 |
border-radius: 8px;
|
701 |
margin-bottom: 10px;
|
|
|
|
|
|
|
702 |
}
|
703 |
.modal-body #modal-name {
|
704 |
font-size: 20px;
|
@@ -966,16 +974,16 @@
|
|
966 |
}
|
967 |
.dropdown-menu {
|
968 |
width: 200px;
|
969 |
-
border-radius:
|
970 |
-
padding:
|
971 |
}
|
972 |
.dropdown-menu .dropdown-item {
|
973 |
-
padding:
|
974 |
-
font-size:
|
975 |
}
|
976 |
.dropdown-menu .dropdown-item i {
|
977 |
-
font-size:
|
978 |
-
margin-right:
|
979 |
}
|
980 |
.modal-dialog {
|
981 |
max-width: 90%;
|
@@ -992,9 +1000,8 @@
|
|
992 |
padding: 12px;
|
993 |
}
|
994 |
.modal-body #modal-img {
|
995 |
-
|
996 |
-
|
997 |
-
max-width: 150px;
|
998 |
margin: 0 auto 8px;
|
999 |
display: block;
|
1000 |
}
|
@@ -1136,7 +1143,8 @@
|
|
1136 |
padding: 15px;
|
1137 |
}
|
1138 |
#softDrinkModal .modal-body img {
|
1139 |
-
|
|
|
1140 |
margin-bottom: 12px;
|
1141 |
}
|
1142 |
#softDrinkModal .modal-body h5 {
|
@@ -1218,7 +1226,8 @@
|
|
1218 |
font-size: 1rem;
|
1219 |
}
|
1220 |
#micModal .modal-body #mic-item-image {
|
1221 |
-
|
|
|
1222 |
margin-bottom: 8px;
|
1223 |
}
|
1224 |
#micModal .modal-body #mic-item-name {
|
@@ -1431,7 +1440,7 @@
|
|
1431 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
1432 |
</div>
|
1433 |
<div class="modal-body">
|
1434 |
-
<img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image"
|
1435 |
<h5 id="modal-name" class="fw-bold text-center"></h5>
|
1436 |
<p id="modal-price" class="text-muted text-center"></p>
|
1437 |
<p id="modal-description" class="text-secondary"></p>
|
@@ -1911,34 +1920,32 @@
|
|
1911 |
dropdownMenu.classList.remove('show');
|
1912 |
});
|
1913 |
});
|
|
|
1914 |
const searchBar = document.getElementById('searchBar');
|
1915 |
-
searchBar.addEventListener('
|
1916 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1917 |
});
|
1918 |
-
|
1919 |
-
if (selectedItem) {
|
1920 |
try {
|
1921 |
-
const
|
1922 |
-
const
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
const
|
1928 |
-
if (itemName === name && itemSection === section) {
|
1929 |
-
targetCard = card;
|
1930 |
-
buttonContainer = card.querySelector('.button-container');
|
1931 |
-
card.classList.add('highlighted');
|
1932 |
-
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
1933 |
-
const toggleLink = card.querySelector('.toggle-details');
|
1934 |
-
if (toggleLink) {
|
1935 |
-
toggleLink.click();
|
1936 |
-
}
|
1937 |
-
}
|
1938 |
-
});
|
1939 |
-
if (targetCard && buttonContainer) {
|
1940 |
const name = buttonContainer.getAttribute('data-item-name');
|
1941 |
-
|
1942 |
const image = buttonContainer.getAttribute('data-item-image2') || buttonContainer.getAttribute('data-item-image');
|
1943 |
const description = buttonContainer.getAttribute('data-item-description');
|
1944 |
const category = buttonContainer.getAttribute('data-item-category');
|
@@ -1957,12 +1964,10 @@
|
|
1957 |
}
|
1958 |
}
|
1959 |
|
1960 |
-
// Media wrapper hover and touch events
|
1961 |
document.querySelectorAll('.media-wrapper').forEach(wrapper => {
|
1962 |
const video = wrapper.querySelector('.menu-video');
|
1963 |
const image = wrapper.querySelector('.menu-image');
|
1964 |
|
1965 |
-
// Mouse events for desktop
|
1966 |
wrapper.addEventListener('mouseenter', () => {
|
1967 |
image.classList.add('hidden');
|
1968 |
video.classList.add('active');
|
@@ -1979,7 +1984,6 @@
|
|
1979 |
image.classList.remove('hidden');
|
1980 |
});
|
1981 |
|
1982 |
-
// Touch events for mobile
|
1983 |
let touchTimeout;
|
1984 |
wrapper.addEventListener('touchstart', (e) => {
|
1985 |
e.preventDefault();
|
@@ -2004,7 +2008,6 @@
|
|
2004 |
});
|
2005 |
});
|
2006 |
|
2007 |
-
// Quantity controls for item modal
|
2008 |
const decreaseBtn = document.getElementById('decreaseQuantity');
|
2009 |
const increaseBtn = document.getElementById('increaseQuantity');
|
2010 |
const quantityInput = document.getElementById('quantityInput');
|
@@ -2021,7 +2024,6 @@
|
|
2021 |
quantityInput.value = value + 1;
|
2022 |
});
|
2023 |
|
2024 |
-
// Toggle item details
|
2025 |
document.querySelectorAll('.toggle-details').forEach(link => {
|
2026 |
link.addEventListener('click', () => {
|
2027 |
const details = link.nextElementSibling;
|
@@ -2035,7 +2037,6 @@
|
|
2035 |
});
|
2036 |
});
|
2037 |
|
2038 |
-
// Initialize cart UI
|
2039 |
fetch('/cart')
|
2040 |
.then(response => response.json())
|
2041 |
.then(data => {
|
@@ -2050,7 +2051,6 @@
|
|
2050 |
updateCartUI(getCartLocalStorage());
|
2051 |
});
|
2052 |
|
2053 |
-
// Speech recognition setup
|
2054 |
if ('webkitSpeechRecognition' in window) {
|
2055 |
recognition = new webkitSpeechRecognition();
|
2056 |
recognition.continuous = false;
|
@@ -2070,6 +2070,8 @@
|
|
2070 |
);
|
2071 |
|
2072 |
if (matchedItem) {
|
|
|
|
|
2073 |
document.getElementById('mic-status').style.display = 'none';
|
2074 |
document.getElementById('mic-item-details').style.display = 'block';
|
2075 |
document.getElementById('mic-item-name').textContent = matchedItem.name;
|
@@ -2096,6 +2098,12 @@
|
|
2096 |
modal.show();
|
2097 |
}
|
2098 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2099 |
}
|
2100 |
} else {
|
2101 |
document.getElementById('mic-status').textContent = 'Item not found. Try again.';
|
@@ -2123,7 +2131,6 @@
|
|
2123 |
document.getElementById('micIcon').style.display = 'none';
|
2124 |
}
|
2125 |
|
2126 |
-
// Autocomplete for custom dish description
|
2127 |
const descriptionInput = document.getElementById('custom-dish-description');
|
2128 |
const suggestionsContainer = document.getElementById('descriptionSuggestions');
|
2129 |
|
|
|
73 |
width: 100%;
|
74 |
height: 100%;
|
75 |
object-fit: cover;
|
76 |
+
aspect-ratio: 16/9;
|
77 |
opacity: 1;
|
78 |
transition: opacity 0.3s ease;
|
79 |
}
|
|
|
158 |
width: 40px;
|
159 |
height: 40px;
|
160 |
border-radius: 50%;
|
161 |
+
background: linear-gradient(45deg, #FFA500, #000000, #0000FF);
|
162 |
cursor: pointer;
|
163 |
display: flex;
|
164 |
align-items: center;
|
|
|
176 |
position: absolute;
|
177 |
right: 0;
|
178 |
top: 100%;
|
179 |
+
background: linear-gradient(180deg, #ffffff, #f8f9fa);
|
180 |
+
border-radius: 12px;
|
181 |
+
width: 240px;
|
182 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
183 |
display: none;
|
184 |
border: none;
|
185 |
+
padding: 12px 0;
|
186 |
animation: slideDown 0.3s ease-out;
|
187 |
z-index: 1000;
|
188 |
overflow: hidden;
|
|
|
191 |
display: block;
|
192 |
}
|
193 |
.dropdown-menu .dropdown-item {
|
194 |
+
padding: 12px 18px;
|
195 |
text-decoration: none;
|
196 |
color: #333;
|
197 |
display: flex;
|
198 |
align-items: center;
|
199 |
+
font-size: 15px;
|
200 |
font-weight: 500;
|
201 |
+
transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
|
202 |
}
|
203 |
.dropdown-menu .dropdown-item i {
|
204 |
+
margin-right: 12px;
|
205 |
+
font-size: 18px;
|
206 |
color: #0FAA39;
|
207 |
}
|
208 |
.dropdown-menu .dropdown-item:hover {
|
209 |
background-color: #e6f4ea;
|
210 |
+
color: #0D9232;
|
211 |
+
transform: translateX(5px);
|
212 |
}
|
213 |
.dropdown-menu .dropdown-item:hover i {
|
214 |
color: #0D9232;
|
|
|
421 |
text-align: center;
|
422 |
}
|
423 |
#softDrinkModal .modal-body img {
|
424 |
+
width: 160px;
|
425 |
+
height: 160px;
|
426 |
object-fit: cover;
|
427 |
+
aspect-ratio: 1/1;
|
428 |
border-radius: 8px;
|
429 |
margin-bottom: 15px;
|
430 |
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
|
637 |
margin: 0;
|
638 |
}
|
639 |
#micModal .modal-body #mic-item-image {
|
640 |
+
width: 150px;
|
641 |
+
height: 150px;
|
642 |
object-fit: cover;
|
643 |
+
aspect-ratio: 1/1;
|
644 |
border-radius: 8px;
|
645 |
margin-bottom: 10px;
|
646 |
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
|
698 |
padding: 15px;
|
699 |
}
|
700 |
.modal-body #modal-img {
|
701 |
+
width: 200px;
|
702 |
+
height: 200px;
|
703 |
object-fit: cover;
|
704 |
+
aspect-ratio: 1/1;
|
705 |
border-radius: 8px;
|
706 |
margin-bottom: 10px;
|
707 |
+
display: block;
|
708 |
+
margin-left: auto;
|
709 |
+
margin-right: auto;
|
710 |
}
|
711 |
.modal-body #modal-name {
|
712 |
font-size: 20px;
|
|
|
974 |
}
|
975 |
.dropdown-menu {
|
976 |
width: 200px;
|
977 |
+
border-radius: 10px;
|
978 |
+
padding: 10px 0;
|
979 |
}
|
980 |
.dropdown-menu .dropdown-item {
|
981 |
+
padding: 10px 15px;
|
982 |
+
font-size: 14px;
|
983 |
}
|
984 |
.dropdown-menu .dropdown-item i {
|
985 |
+
font-size: 16px;
|
986 |
+
margin-right: 10px;
|
987 |
}
|
988 |
.modal-dialog {
|
989 |
max-width: 90%;
|
|
|
1000 |
padding: 12px;
|
1001 |
}
|
1002 |
.modal-body #modal-img {
|
1003 |
+
width: 150px;
|
1004 |
+
height: 150px;
|
|
|
1005 |
margin: 0 auto 8px;
|
1006 |
display: block;
|
1007 |
}
|
|
|
1143 |
padding: 15px;
|
1144 |
}
|
1145 |
#softDrinkModal .modal-body img {
|
1146 |
+
width: 130px;
|
1147 |
+
height: 130px;
|
1148 |
margin-bottom: 12px;
|
1149 |
}
|
1150 |
#softDrinkModal .modal-body h5 {
|
|
|
1226 |
font-size: 1rem;
|
1227 |
}
|
1228 |
#micModal .modal-body #mic-item-image {
|
1229 |
+
width: 120px;
|
1230 |
+
height: 120px;
|
1231 |
margin-bottom: 8px;
|
1232 |
}
|
1233 |
#micModal .modal-body #mic-item-name {
|
|
|
1440 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
1441 |
</div>
|
1442 |
<div class="modal-body">
|
1443 |
+
<img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" loading="lazy" decoding="async">
|
1444 |
<h5 id="modal-name" class="fw-bold text-center"></h5>
|
1445 |
<p id="modal-price" class="text-muted text-center"></p>
|
1446 |
<p id="modal-description" class="text-secondary"></p>
|
|
|
1920 |
dropdownMenu.classList.remove('show');
|
1921 |
});
|
1922 |
});
|
1923 |
+
|
1924 |
const searchBar = document.getElementById('searchBar');
|
1925 |
+
searchBar.addEventListener('input', function () {
|
1926 |
+
const query = this.value.toLowerCase();
|
1927 |
+
document.querySelectorAll('.menu-card').forEach(card => {
|
1928 |
+
const itemName = card.getAttribute('data-item-name').toLowerCase();
|
1929 |
+
const section = card.getAttribute('data-item-section').toLowerCase();
|
1930 |
+
if (itemName.includes(query) || section.includes(query)) {
|
1931 |
+
card.style.display = 'block';
|
1932 |
+
} else {
|
1933 |
+
card.style.display = 'none';
|
1934 |
+
}
|
1935 |
+
});
|
1936 |
});
|
1937 |
+
|
1938 |
+
if (localStorage.getItem('selectedItem')) {
|
1939 |
try {
|
1940 |
+
const selectedItem = JSON.parse(localStorage.getItem('selectedItem'));
|
1941 |
+
const card = document.querySelector(`.menu-card[data-item-name="${selectedItem.name}"]`);
|
1942 |
+
if (card) {
|
1943 |
+
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
1944 |
+
card.classList.add('highlighted');
|
1945 |
+
setTimeout(() => card.classList.remove('highlighted'), 2000);
|
1946 |
+
const buttonContainer = card.querySelector('.button-container');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1947 |
const name = buttonContainer.getAttribute('data-item-name');
|
1948 |
+
const price = buttonContainer.getAttribute('data-item-price');
|
1949 |
const image = buttonContainer.getAttribute('data-item-image2') || buttonContainer.getAttribute('data-item-image');
|
1950 |
const description = buttonContainer.getAttribute('data-item-description');
|
1951 |
const category = buttonContainer.getAttribute('data-item-category');
|
|
|
1964 |
}
|
1965 |
}
|
1966 |
|
|
|
1967 |
document.querySelectorAll('.media-wrapper').forEach(wrapper => {
|
1968 |
const video = wrapper.querySelector('.menu-video');
|
1969 |
const image = wrapper.querySelector('.menu-image');
|
1970 |
|
|
|
1971 |
wrapper.addEventListener('mouseenter', () => {
|
1972 |
image.classList.add('hidden');
|
1973 |
video.classList.add('active');
|
|
|
1984 |
image.classList.remove('hidden');
|
1985 |
});
|
1986 |
|
|
|
1987 |
let touchTimeout;
|
1988 |
wrapper.addEventListener('touchstart', (e) => {
|
1989 |
e.preventDefault();
|
|
|
2008 |
});
|
2009 |
});
|
2010 |
|
|
|
2011 |
const decreaseBtn = document.getElementById('decreaseQuantity');
|
2012 |
const increaseBtn = document.getElementById('increaseQuantity');
|
2013 |
const quantityInput = document.getElementById('quantityInput');
|
|
|
2024 |
quantityInput.value = value + 1;
|
2025 |
});
|
2026 |
|
|
|
2027 |
document.querySelectorAll('.toggle-details').forEach(link => {
|
2028 |
link.addEventListener('click', () => {
|
2029 |
const details = link.nextElementSibling;
|
|
|
2037 |
});
|
2038 |
});
|
2039 |
|
|
|
2040 |
fetch('/cart')
|
2041 |
.then(response => response.json())
|
2042 |
.then(data => {
|
|
|
2051 |
updateCartUI(getCartLocalStorage());
|
2052 |
});
|
2053 |
|
|
|
2054 |
if ('webkitSpeechRecognition' in window) {
|
2055 |
recognition = new webkitSpeechRecognition();
|
2056 |
recognition.continuous = false;
|
|
|
2070 |
);
|
2071 |
|
2072 |
if (matchedItem) {
|
2073 |
+
// Stop recognition immediately after finding a match
|
2074 |
+
recognition.stop();
|
2075 |
document.getElementById('mic-status').style.display = 'none';
|
2076 |
document.getElementById('mic-item-details').style.display = 'block';
|
2077 |
document.getElementById('mic-item-name').textContent = matchedItem.name;
|
|
|
2098 |
modal.show();
|
2099 |
}
|
2100 |
}
|
2101 |
+
// Hide the mic modal after showing item details
|
2102 |
+
const micModal = bootstrap.Modal.getInstance(document.getElementById('micModal'));
|
2103 |
+
if (micModal) {
|
2104 |
+
micModal.hide();
|
2105 |
+
resetMicModal();
|
2106 |
+
}
|
2107 |
}
|
2108 |
} else {
|
2109 |
document.getElementById('mic-status').textContent = 'Item not found. Try again.';
|
|
|
2131 |
document.getElementById('micIcon').style.display = 'none';
|
2132 |
}
|
2133 |
|
|
|
2134 |
const descriptionInput = document.getElementById('custom-dish-description');
|
2135 |
const suggestionsContainer = document.getElementById('descriptionSuggestions');
|
2136 |
|