Update templates/menu.html
Browse files- templates/menu.html +263 -230
templates/menu.html
CHANGED
|
@@ -232,7 +232,7 @@
|
|
| 232 |
color: #888;
|
| 233 |
}
|
| 234 |
.search-bar-container input:focus {
|
| 235 |
-
border-bottom: 2px solid #
|
| 236 |
}
|
| 237 |
.search-icon {
|
| 238 |
position: absolute;
|
|
@@ -261,7 +261,7 @@
|
|
| 261 |
}
|
| 262 |
.addon-section h6 {
|
| 263 |
margin: 0;
|
| 264 |
-
padding:
|
| 265 |
font-size: 1.1rem;
|
| 266 |
font-weight: 600;
|
| 267 |
color: #fff;
|
|
@@ -369,7 +369,7 @@
|
|
| 369 |
animation: fadeInModal 0.3s ease-out;
|
| 370 |
}
|
| 371 |
#softDrinkModal .modal-content {
|
| 372 |
-
border-radius: 12px;
|
| 373 |
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 374 |
background-color: #fff;
|
| 375 |
overflow: hidden;
|
|
@@ -874,12 +874,12 @@
|
|
| 874 |
.bottom-action-bar .btn-order-history {
|
| 875 |
background: linear-gradient(45deg, #FF8C00, #32CD32);
|
| 876 |
border-color: transparent;
|
| 877 |
-
color: #
|
| 878 |
}
|
| 879 |
.bottom-action-bar .btn-order-history:hover {
|
| 880 |
background: linear-gradient(45deg, #FF4500, #228B22);
|
| 881 |
border-color: transparent;
|
| 882 |
-
color: #
|
| 883 |
}
|
| 884 |
.bottom-action-bar .btn-view-cart {
|
| 885 |
background-color: #0FAA39;
|
|
@@ -1194,6 +1194,61 @@
|
|
| 1194 |
padding: 8px 15px;
|
| 1195 |
font-size: 0.9rem;
|
| 1196 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1197 |
}
|
| 1198 |
</style>
|
| 1199 |
</head>
|
|
@@ -1856,277 +1911,255 @@
|
|
| 1856 |
if (itemName === name && itemSection === section) {
|
| 1857 |
targetCard = card;
|
| 1858 |
buttonContainer = card.querySelector('.button-container');
|
| 1859 |
-
card.classList.add('highlighted');
|
| 1860 |
-
card.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
| 1861 |
-
const toggleLink = card.querySelector('.toggle-details');
|
| 1862 |
-
if (toggleLink) {
|
| 1863 |
-
toggleLink.click();
|
| 1864 |
-
}
|
| 1865 |
}
|
| 1866 |
});
|
| 1867 |
if (targetCard && buttonContainer) {
|
| 1868 |
-
|
| 1869 |
-
const price = buttonContainer.getAttribute('data-item-price');
|
| 1870 |
-
const image = buttonContainer.getAttribute('data-item-image2');
|
| 1871 |
-
const description = buttonContainer.getAttribute('data-item-description');
|
| 1872 |
-
const category = buttonContainer.getAttribute('data-item-category');
|
| 1873 |
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1874 |
if (section === 'Soft Drinks') {
|
| 1875 |
-
showSoftDrinkModal(
|
| 1876 |
} else {
|
| 1877 |
-
|
| 1878 |
-
const modal = new bootstrap.Modal(document.getElementById('itemModal'));
|
| 1879 |
-
modal.show();
|
| 1880 |
}
|
| 1881 |
-
}
|
|
|
|
| 1882 |
}
|
| 1883 |
-
} catch (
|
| 1884 |
-
console.error('Error
|
| 1885 |
-
} finally {
|
| 1886 |
localStorage.removeItem('selectedItem');
|
| 1887 |
}
|
| 1888 |
}
|
| 1889 |
-
|
| 1890 |
-
|
| 1891 |
-
|
| 1892 |
-
|
| 1893 |
-
|
| 1894 |
-
|
| 1895 |
-
|
| 1896 |
-
|
| 1897 |
-
|
| 1898 |
-
|
| 1899 |
-
|
| 1900 |
-
|
| 1901 |
-
|
| 1902 |
-
|
| 1903 |
-
|
| 1904 |
-
|
| 1905 |
-
|
| 1906 |
-
|
| 1907 |
-
|
| 1908 |
-
|
| 1909 |
-
|
| 1910 |
-
|
| 1911 |
-
|
| 1912 |
-
|
| 1913 |
-
|
| 1914 |
-
|
| 1915 |
-
|
| 1916 |
-
|
| 1917 |
-
|
| 1918 |
-
|
| 1919 |
-
|
| 1920 |
-
|
| 1921 |
-
|
| 1922 |
-
|
| 1923 |
-
|
| 1924 |
-
|
| 1925 |
-
|
| 1926 |
-
|
| 1927 |
-
|
| 1928 |
-
|
| 1929 |
-
|
| 1930 |
-
|
| 1931 |
-
|
| 1932 |
-
|
| 1933 |
-
|
| 1934 |
-
|
| 1935 |
-
|
| 1936 |
-
|
| 1937 |
-
|
| 1938 |
-
|
| 1939 |
-
|
| 1940 |
-
|
| 1941 |
-
|
| 1942 |
-
|
| 1943 |
-
|
| 1944 |
-
|
| 1945 |
-
toggle.addEventListener('click', function () {
|
| 1946 |
-
const details = document.getElementById(`details-${this.getAttribute('data-item-name').replace(/\s+/g, '-')}`);
|
| 1947 |
-
if (details) {
|
| 1948 |
-
details.classList.toggle('show');
|
| 1949 |
-
this.textContent = details.classList.contains('show') ? 'Hide Details' : 'Show Details';
|
| 1950 |
-
}
|
| 1951 |
-
});
|
| 1952 |
});
|
| 1953 |
-
|
| 1954 |
-
// Quantity controls for item modal
|
| 1955 |
-
const decreaseBtn = document.getElementById('decreaseQuantity');
|
| 1956 |
-
const increaseBtn = document.getElementById('increaseQuantity');
|
| 1957 |
const quantityInput = document.getElementById('quantityInput');
|
| 1958 |
-
|
| 1959 |
-
|
| 1960 |
-
|
| 1961 |
-
|
| 1962 |
-
|
|
|
|
| 1963 |
updateModalPrice();
|
| 1964 |
}
|
| 1965 |
});
|
| 1966 |
-
|
| 1967 |
-
|
| 1968 |
-
|
| 1969 |
-
quantityInput.value = value + 1;
|
| 1970 |
updateModalPrice();
|
| 1971 |
});
|
| 1972 |
-
|
| 1973 |
-
|
| 1974 |
-
|
| 1975 |
-
|
| 1976 |
-
|
| 1977 |
-
|
| 1978 |
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
| 1979 |
recognition = new SpeechRecognition();
|
| 1980 |
-
recognition.continuous = false;
|
| 1981 |
-
recognition.interimResults = true;
|
| 1982 |
recognition.lang = 'en-US';
|
| 1983 |
-
|
| 1984 |
-
recognition.
|
| 1985 |
-
|
| 1986 |
-
|
| 1987 |
-
|
| 1988 |
-
|
| 1989 |
-
|
| 1990 |
-
recognition.onresult = (event)
|
| 1991 |
-
|
| 1992 |
-
|
| 1993 |
-
|
| 1994 |
-
|
| 1995 |
-
|
| 1996 |
-
|
| 1997 |
-
|
| 1998 |
-
|
| 1999 |
-
|
| 2000 |
-
|
| 2001 |
-
|
| 2002 |
-
|
| 2003 |
-
document.getElementById('mic-status').textContent = interimTranscript || finalTranscript;
|
| 2004 |
-
|
| 2005 |
-
if (finalTranscript) {
|
| 2006 |
-
const spokenItem = menuItems.find(item =>
|
| 2007 |
-
item.name.toLowerCase().includes(finalTranscript.toLowerCase())
|
| 2008 |
-
);
|
| 2009 |
-
|
| 2010 |
-
if (spokenItem) {
|
| 2011 |
-
document.getElementById('mic-status').style.display = 'none';
|
| 2012 |
-
document.getElementById('mic-item-details').style.display = 'block';
|
| 2013 |
-
document.getElementById('mic-item-name').textContent = spokenItem.name;
|
| 2014 |
-
document.getElementById('mic-item-image').src = spokenItem.image || '/static/placeholder.jpg';
|
| 2015 |
-
|
| 2016 |
const menuCards = document.querySelectorAll('.menu-card');
|
| 2017 |
-
let
|
|
|
|
| 2018 |
menuCards.forEach(card => {
|
| 2019 |
-
|
| 2020 |
-
|
| 2021 |
-
|
|
|
|
|
|
|
| 2022 |
}
|
| 2023 |
});
|
| 2024 |
-
|
| 2025 |
-
|
| 2026 |
-
const name = targetButton.getAttribute('data-item-name');
|
| 2027 |
-
const price = targetButton.getAttribute('data-item-price');
|
| 2028 |
-
const image = targetButton.getAttribute('data-item-image2');
|
| 2029 |
-
const description = targetButton.getAttribute('data-item-description');
|
| 2030 |
-
const section = targetButton.getAttribute('data-item-section');
|
| 2031 |
-
const category = targetButton.getAttribute('data-item-category');
|
| 2032 |
-
|
| 2033 |
setTimeout(() => {
|
| 2034 |
-
|
| 2035 |
-
|
| 2036 |
-
|
| 2037 |
-
|
| 2038 |
-
if (section === 'Soft Drinks') {
|
| 2039 |
-
showSoftDrinkModal(
|
| 2040 |
} else {
|
| 2041 |
-
|
| 2042 |
-
const modal = new bootstrap.Modal(document.getElementById('itemModal'));
|
| 2043 |
-
modal.show();
|
| 2044 |
}
|
| 2045 |
-
|
|
|
|
| 2046 |
}
|
| 2047 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2048 |
}
|
| 2049 |
};
|
| 2050 |
-
|
| 2051 |
-
|
| 2052 |
-
document.getElementById('
|
| 2053 |
-
|
| 2054 |
-
|
| 2055 |
};
|
| 2056 |
-
|
| 2057 |
-
recognition.onerror = (event) => {
|
| 2058 |
console.error('Speech recognition error:', event.error);
|
| 2059 |
document.getElementById('mic-status').textContent = 'Error occurred. Please try again.';
|
|
|
|
| 2060 |
setTimeout(() => {
|
| 2061 |
-
|
| 2062 |
}, 2000);
|
| 2063 |
};
|
| 2064 |
-
|
| 2065 |
-
|
| 2066 |
-
|
| 2067 |
-
|
| 2068 |
-
|
| 2069 |
-
|
| 2070 |
-
micModal.show();
|
| 2071 |
-
resetMicModal();
|
| 2072 |
-
recognition.start();
|
| 2073 |
-
});
|
| 2074 |
-
} else {
|
| 2075 |
-
document.getElementById('micIcon').style.display = 'none';
|
| 2076 |
-
console.warn('Speech recognition not supported in this browser.');
|
| 2077 |
-
}
|
| 2078 |
-
|
| 2079 |
-
// Autocomplete for custom dish description
|
| 2080 |
const descriptionInput = document.getElementById('custom-dish-description');
|
| 2081 |
-
const
|
| 2082 |
-
|
| 2083 |
-
|
| 2084 |
-
|
| 2085 |
-
|
| 2086 |
-
|
| 2087 |
-
|
| 2088 |
return;
|
| 2089 |
}
|
| 2090 |
-
|
| 2091 |
-
|
| 2092 |
-
|
| 2093 |
-
|
| 2094 |
-
|
| 2095 |
-
|
| 2096 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2097 |
});
|
| 2098 |
-
|
| 2099 |
});
|
| 2100 |
-
|
| 2101 |
-
|
| 2102 |
-
|
| 2103 |
-
|
| 2104 |
-
|
| 2105 |
-
|
| 2106 |
-
|
| 2107 |
-
|
| 2108 |
-
|
| 2109 |
-
|
| 2110 |
-
};
|
| 2111 |
-
|
| 2112 |
-
descriptionInput.addEventListener('
|
| 2113 |
-
|
| 2114 |
-
|
| 2115 |
-
|
| 2116 |
-
|
| 2117 |
-
|
| 2118 |
-
|
| 2119 |
-
}
|
| 2120 |
-
}, 300));
|
| 2121 |
-
|
| 2122 |
document.addEventListener('click', (event) => {
|
| 2123 |
-
if (!descriptionInput.contains(event.target) && !
|
| 2124 |
-
|
|
|
|
| 2125 |
}
|
| 2126 |
});
|
| 2127 |
}
|
| 2128 |
});
|
| 2129 |
</script>
|
| 2130 |
</body>
|
| 2131 |
-
</html>
|
| 2132 |
-
</xaiArtifact>
|
|
|
|
| 232 |
color: #888;
|
| 233 |
}
|
| 234 |
.search-bar-container input:focus {
|
| 235 |
+
border-bottom: 2px solid #FFS07A;
|
| 236 |
}
|
| 237 |
.search-icon {
|
| 238 |
position: absolute;
|
|
|
|
| 261 |
}
|
| 262 |
.addon-section h6 {
|
| 263 |
margin: 0;
|
| 264 |
+
padding: 12pxkais 15px;
|
| 265 |
font-size: 1.1rem;
|
| 266 |
font-weight: 600;
|
| 267 |
color: #fff;
|
|
|
|
| 369 |
animation: fadeInModal 0.3s ease-out;
|
| 370 |
}
|
| 371 |
#softDrinkModal .modal-content {
|
| 372 |
+
border-radius: 12òngs: 12px;
|
| 373 |
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
| 374 |
background-color: #fff;
|
| 375 |
overflow: hidden;
|
|
|
|
| 874 |
.bottom-action-bar .btn-order-history {
|
| 875 |
background: linear-gradient(45deg, #FF8C00, #32CD32);
|
| 876 |
border-color: transparent;
|
| 877 |
+
color: #000000; /* Black text color */
|
| 878 |
}
|
| 879 |
.bottom-action-bar .btn-order-history:hover {
|
| 880 |
background: linear-gradient(45deg, #FF4500, #228B22);
|
| 881 |
border-color: transparent;
|
| 882 |
+
color: #000000; /* Black text color on hover */
|
| 883 |
}
|
| 884 |
.bottom-action-bar .btn-view-cart {
|
| 885 |
background-color: #0FAA39;
|
|
|
|
| 1194 |
padding: 8px 15px;
|
| 1195 |
font-size: 0.9rem;
|
| 1196 |
}
|
| 1197 |
+
/* Order History Button Styling */
|
| 1198 |
+
.bottom-action-bar .btn-order-history {
|
| 1199 |
+
background: linear-gradient(45deg, #FF8C00, #32CD32);
|
| 1200 |
+
border-color: transparent;
|
| 1201 |
+
color: #000000; /* Black text color */
|
| 1202 |
+
}
|
| 1203 |
+
.bottom-action-bar .btn-order-history:hover {
|
| 1204 |
+
background: linear-gradient(45deg, #FF4500, #228B22);
|
| 1205 |
+
border-color: transparent;
|
| 1206 |
+
color: #000000; /* Black text color on hover */
|
| 1207 |
+
}
|
| 1208 |
+
/* Avatar Dropdown Styling */
|
| 1209 |
+
.dropdown-menu {
|
| 1210 |
+
background: linear-gradient(45deg, #FF8C00, #000000, #32CD32); /* Orange, black, green gradient */
|
| 1211 |
+
border: 1px solid #FFD700; /* Gold border for premium look */
|
| 1212 |
+
border-radius: 8px;
|
| 1213 |
+
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);
|
| 1214 |
+
}
|
| 1215 |
+
/* Dropdown Item Styling */
|
| 1216 |
+
.dropdown-menu .dropdown-item {
|
| 1217 |
+
padding: 12px 16px;
|
| 1218 |
+
text-decoration: none;
|
| 1219 |
+
color: #FFFFFF; /* White text for contrast */
|
| 1220 |
+
border-bottom: 1px solid rgba(255, 215, 0, 0.3); /* Subtle gold separator */
|
| 1221 |
+
display: flex;
|
| 1222 |
+
align-items: center;
|
| 1223 |
+
font-size: 15px;
|
| 1224 |
+
transition: background-color 0.2s ease;
|
| 1225 |
+
}
|
| 1226 |
+
.dropdown-menu .dropdown-item:last-child {
|
| 1227 |
+
border-bottom: none;
|
| 1228 |
+
}
|
| 1229 |
+
.dropdown-menu .dropdown-item:hover {
|
| 1230 |
+
background-color: rgba(255, 215, 0, 0.2); /* Gold highlight on hover */
|
| 1231 |
+
color: #FFFFFF;
|
| 1232 |
+
}
|
| 1233 |
+
/* Icon Styling for Dropdown Items */
|
| 1234 |
+
.dropdown-menu .dropdown-item::before {
|
| 1235 |
+
font-family: 'bootstrap-icons';
|
| 1236 |
+
margin-right: 10px;
|
| 1237 |
+
font-size: 16px;
|
| 1238 |
+
color: #FFD700; /* Gold icons */
|
| 1239 |
+
}
|
| 1240 |
+
.dropdown-menu .dropdown-item:nth-child(1)::before {
|
| 1241 |
+
content: '\F4DA'; /* User icon for View Profile */
|
| 1242 |
+
}
|
| 1243 |
+
.dropdown-menu .dropdown-item:nth-child(2)::before {
|
| 1244 |
+
content: '\F2EA'; /* Clock icon for Order History */
|
| 1245 |
+
}
|
| 1246 |
+
.dropdown-menu .dropdown-item:nth-child(3)::before {
|
| 1247 |
+
content: '\F4E6'; /* Summary icon for MY Summary */
|
| 1248 |
+
}
|
| 1249 |
+
.dropdown-menu .dropdown-item:nth-child(4)::before {
|
| 1250 |
+
content: '\F52B'; /* Logout icon */
|
| 1251 |
+
}
|
| 1252 |
}
|
| 1253 |
</style>
|
| 1254 |
</head>
|
|
|
|
| 1911 |
if (itemName === name && itemSection === section) {
|
| 1912 |
targetCard = card;
|
| 1913 |
buttonContainer = card.querySelector('.button-container');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1914 |
}
|
| 1915 |
});
|
| 1916 |
if (targetCard && buttonContainer) {
|
| 1917 |
+
targetCard.classList.add('highlighted');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1918 |
setTimeout(() => {
|
| 1919 |
+
targetCard.classList.remove('highlighted');
|
| 1920 |
+
}, 3000);
|
| 1921 |
+
const addButton = buttonContainer.querySelector('.btn-primary');
|
| 1922 |
+
if (addButton) {
|
| 1923 |
if (section === 'Soft Drinks') {
|
| 1924 |
+
showSoftDrinkModal(addButton);
|
| 1925 |
} else {
|
| 1926 |
+
addButton.click();
|
|
|
|
|
|
|
| 1927 |
}
|
| 1928 |
+
}
|
| 1929 |
+
localStorage.removeItem('selectedItem');
|
| 1930 |
}
|
| 1931 |
+
} catch (err) {
|
| 1932 |
+
console.error('Error processing selected item:', err);
|
|
|
|
| 1933 |
localStorage.removeItem('selectedItem');
|
| 1934 |
}
|
| 1935 |
}
|
| 1936 |
+
const menuCards = document.querySelectorAll('.menu-card');
|
| 1937 |
+
menuCards.forEach(card => {
|
| 1938 |
+
const video = card.querySelector('.menu-video');
|
| 1939 |
+
const image = card.querySelector('.menu-image');
|
| 1940 |
+
if (video && image) {
|
| 1941 |
+
let isTouching = false;
|
| 1942 |
+
card.addEventListener('mouseenter', () => {
|
| 1943 |
+
if (!isTouching) {
|
| 1944 |
+
video.classList.add('active');
|
| 1945 |
+
image.classList.add('hidden');
|
| 1946 |
+
video.play().catch(err => {
|
| 1947 |
+
console.error('Error playing video:', err);
|
| 1948 |
+
video.classList.remove('active');
|
| 1949 |
+
image.classList.remove('hidden');
|
| 1950 |
+
});
|
| 1951 |
+
}
|
| 1952 |
+
});
|
| 1953 |
+
card.addEventListener('mouseleave', () => {
|
| 1954 |
+
if (!isTouching) {
|
| 1955 |
+
video.classList.remove('active');
|
| 1956 |
+
image.classList.remove('hidden');
|
| 1957 |
+
video.pause();
|
| 1958 |
+
video.currentTime = 0;
|
| 1959 |
+
}
|
| 1960 |
+
});
|
| 1961 |
+
card.addEventListener('touchstart', () => {
|
| 1962 |
+
isTouching = true;
|
| 1963 |
+
video.classList.add('active');
|
| 1964 |
+
image.classList.add('hidden');
|
| 1965 |
+
video.play().catch(err => {
|
| 1966 |
+
console.error('Error playing video:', err);
|
| 1967 |
+
video.classList.remove('active');
|
| 1968 |
+
image.classList.remove('hidden');
|
| 1969 |
+
});
|
| 1970 |
+
card.classList.add('touched');
|
| 1971 |
+
});
|
| 1972 |
+
card.addEventListener('touchend', () => {
|
| 1973 |
+
setTimeout(() => {
|
| 1974 |
+
isTouching = false;
|
| 1975 |
+
video.classList.remove('active');
|
| 1976 |
+
image.classList.remove('hidden');
|
| 1977 |
+
video.pause();
|
| 1978 |
+
video.currentTime = 0;
|
| 1979 |
+
card.classList.remove('touched');
|
| 1980 |
+
}, 500);
|
| 1981 |
+
});
|
| 1982 |
+
}
|
| 1983 |
+
const toggleDetails = card.querySelector('.toggle-details');
|
| 1984 |
+
const itemDetails = card.querySelector('.item-details');
|
| 1985 |
+
if (toggleDetails && itemDetails) {
|
| 1986 |
+
toggleDetails.addEventListener('click', () => {
|
| 1987 |
+
const isVisible = itemDetails.classList.contains('show');
|
| 1988 |
+
itemDetails.classList.toggle('show');
|
| 1989 |
+
toggleDetails.textContent = isVisible ? 'Show Details' : 'Hide Details';
|
| 1990 |
+
});
|
| 1991 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1992 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1993 |
const quantityInput = document.getElementById('quantityInput');
|
| 1994 |
+
const decreaseButton = document.getElementById('decreaseQuantity');
|
| 1995 |
+
const increaseButton = document.getElementById('increaseQuantity');
|
| 1996 |
+
decreaseButton.addEventListener('click', () => {
|
| 1997 |
+
let currentValue = parseInt(quantityInput.value) || 1;
|
| 1998 |
+
if (currentValue > 1) {
|
| 1999 |
+
quantityInput.value = currentValue - 1;
|
| 2000 |
updateModalPrice();
|
| 2001 |
}
|
| 2002 |
});
|
| 2003 |
+
increaseButton.addEventListener('click', () => {
|
| 2004 |
+
let currentValue = parseInt(quantityInput.value) || 1;
|
| 2005 |
+
quantityInput.value = currentValue + 1;
|
|
|
|
| 2006 |
updateModalPrice();
|
| 2007 |
});
|
| 2008 |
+
const micIcon = document.getElementById('micIcon');
|
| 2009 |
+
micIcon.addEventListener('click', () => {
|
| 2010 |
+
if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) {
|
| 2011 |
+
alert('Speech recognition is not supported in this browser.');
|
| 2012 |
+
return;
|
| 2013 |
+
}
|
| 2014 |
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
| 2015 |
recognition = new SpeechRecognition();
|
|
|
|
|
|
|
| 2016 |
recognition.lang = 'en-US';
|
| 2017 |
+
recognition.interimResults = false;
|
| 2018 |
+
recognition.maxAlternatives = 1;
|
| 2019 |
+
recognition.start();
|
| 2020 |
+
micIcon.classList.add('active');
|
| 2021 |
+
const micModal = new bootstrap.Modal(document.getElementById('micModal'));
|
| 2022 |
+
micModal.show();
|
| 2023 |
+
document.getElementById('mic-status').textContent = 'Listening...';
|
| 2024 |
+
recognition.onresult = function (event) {
|
| 2025 |
+
const transcript = event.results[0][0].transcript.trim();
|
| 2026 |
+
console.log('Recognized speech:', transcript);
|
| 2027 |
+
const matchedItem = menuItems.find(item =>
|
| 2028 |
+
item.name.toLowerCase().includes(transcript.toLowerCase())
|
| 2029 |
+
);
|
| 2030 |
+
if (matchedItem) {
|
| 2031 |
+
document.getElementById('mic-status').style.display = 'none';
|
| 2032 |
+
document.getElementById('mic-item-details').style.display = 'block';
|
| 2033 |
+
document.getElementById('mic-item-name').textContent = matchedItem.name;
|
| 2034 |
+
document.getElementById('mic-item-image').src = matchedItem.image;
|
| 2035 |
+
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2036 |
const menuCards = document.querySelectorAll('.menu-card');
|
| 2037 |
+
let targetCard = null;
|
| 2038 |
+
let buttonContainer = null;
|
| 2039 |
menuCards.forEach(card => {
|
| 2040 |
+
const itemName = card.getAttribute('data-item-name');
|
| 2041 |
+
const itemSection = card.getAttribute('data-item-section');
|
| 2042 |
+
if (itemName === matchedItem.name && itemSection === matchedItem.section) {
|
| 2043 |
+
targetCard = card;
|
| 2044 |
+
buttonContainer = card.querySelector('.button-container');
|
| 2045 |
}
|
| 2046 |
});
|
| 2047 |
+
if (targetCard && buttonContainer) {
|
| 2048 |
+
targetCard.classList.add('highlighted');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2049 |
setTimeout(() => {
|
| 2050 |
+
targetCard.classList.remove('highlighted');
|
| 2051 |
+
}, 3000);
|
| 2052 |
+
const addButton = buttonContainer.querySelector('.btn-primary');
|
| 2053 |
+
if (addButton) {
|
| 2054 |
+
if (matchedItem.section === 'Soft Drinks') {
|
| 2055 |
+
showSoftDrinkModal(addButton);
|
| 2056 |
} else {
|
| 2057 |
+
addButton.click();
|
|
|
|
|
|
|
| 2058 |
}
|
| 2059 |
+
micModal.hide();
|
| 2060 |
+
}
|
| 2061 |
}
|
| 2062 |
+
}, 1000);
|
| 2063 |
+
} else {
|
| 2064 |
+
document.getElementById('mic-status').textContent = 'Item not found. Try again.';
|
| 2065 |
+
setTimeout(() => {
|
| 2066 |
+
document.getElementById('mic-status').textContent = 'Say the name of a menu item...';
|
| 2067 |
+
}, 2000);
|
| 2068 |
}
|
| 2069 |
};
|
| 2070 |
+
recognition.onend = function () {
|
| 2071 |
+
micIcon.classList.remove('active');
|
| 2072 |
+
if (document.getElementById('micModal').classList.contains('show')) {
|
| 2073 |
+
recognition.start();
|
| 2074 |
+
}
|
| 2075 |
};
|
| 2076 |
+
recognition.onerror = function (event) {
|
|
|
|
| 2077 |
console.error('Speech recognition error:', event.error);
|
| 2078 |
document.getElementById('mic-status').textContent = 'Error occurred. Please try again.';
|
| 2079 |
+
micIcon.classList.remove('active');
|
| 2080 |
setTimeout(() => {
|
| 2081 |
+
document.getElementById('mic-status').textContent = 'Say the name of a menu item...';
|
| 2082 |
}, 2000);
|
| 2083 |
};
|
| 2084 |
+
});
|
| 2085 |
+
const stopMicBtn = document.getElementById('stopMicBtn');
|
| 2086 |
+
stopMicBtn.addEventListener('click', stopSpeechRecognition);
|
| 2087 |
+
document.getElementById('micModal').addEventListener('hidden.bs.modal', stopSpeechRecognition);
|
| 2088 |
+
const cart = getCartLocalStorage();
|
| 2089 |
+
updateCartUI(cart);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2090 |
const descriptionInput = document.getElementById('custom-dish-description');
|
| 2091 |
+
const suggestionsDiv = document.getElementById('descriptionSuggestions');
|
| 2092 |
+
if (descriptionInput && suggestionsDiv) {
|
| 2093 |
+
const updateSuggestions = debounce(function () {
|
| 2094 |
+
const query = descriptionInput.value.toLowerCase();
|
| 2095 |
+
if (query.length < 2) {
|
| 2096 |
+
suggestionsDiv.innerHTML = '';
|
| 2097 |
+
suggestionsDiv.style.display = 'none';
|
| 2098 |
return;
|
| 2099 |
}
|
| 2100 |
+
const matchedIngredients = ingredientsList.filter(ingredient =>
|
| 2101 |
+
ingredient.toLowerCase().includes(query)
|
| 2102 |
+
);
|
| 2103 |
+
suggestionsDiv.innerHTML = '';
|
| 2104 |
+
if (matchedIngredients.length === 0) {
|
| 2105 |
+
suggestionsDiv.style.display = 'none';
|
| 2106 |
+
return;
|
| 2107 |
+
}
|
| 2108 |
+
matchedIngredients.forEach(ingredient => {
|
| 2109 |
+
const suggestionItem = document.createElement('div');
|
| 2110 |
+
suggestionItem.classList.add('suggestion-item');
|
| 2111 |
+
suggestionItem.textContent = ingredient;
|
| 2112 |
+
suggestionItem.style.padding = '8px';
|
| 2113 |
+
suggestionItem.style.cursor = 'pointer';
|
| 2114 |
+
suggestionItem.style.borderBottom = '1px solid #eee';
|
| 2115 |
+
suggestionItem.style.backgroundColor = '#fff';
|
| 2116 |
+
suggestionItem.style.transition = 'background-color 0.2s ease';
|
| 2117 |
+
suggestionItem.addEventListener('mouseover', () => {
|
| 2118 |
+
suggestionItem.style.backgroundColor = '#f0f0f0';
|
| 2119 |
+
});
|
| 2120 |
+
suggestionItem.addEventListener('mouseout', () => {
|
| 2121 |
+
suggestionItem.style.backgroundColor = '#fff';
|
| 2122 |
+
});
|
| 2123 |
+
suggestionItem.addEventListener('click', () => {
|
| 2124 |
+
const currentValue = descriptionInput.value;
|
| 2125 |
+
const lastSpaceIndex = currentValue.lastIndexOf(' ');
|
| 2126 |
+
const newValue = lastSpaceIndex === -1
|
| 2127 |
+
? ingredient
|
| 2128 |
+
: currentValue.substring(0, lastSpaceIndex + 1) + ingredient;
|
| 2129 |
+
descriptionInput.value = newValue;
|
| 2130 |
+
suggestionsDiv.innerHTML = '';
|
| 2131 |
+
suggestionsDiv.style.display = 'none';
|
| 2132 |
+
descriptionInput.focus();
|
| 2133 |
});
|
| 2134 |
+
suggestionsDiv.appendChild(suggestionItem);
|
| 2135 |
});
|
| 2136 |
+
suggestionsDiv.style.display = 'block';
|
| 2137 |
+
suggestionsDiv.style.position = 'absolute';
|
| 2138 |
+
suggestionsDiv.style.zIndex = '1000';
|
| 2139 |
+
suggestionsDiv.style.backgroundColor = '#fff';
|
| 2140 |
+
suggestionsDiv.style.border = '1px solid #ccc';
|
| 2141 |
+
suggestionsDiv.style.borderRadius = '4px';
|
| 2142 |
+
suggestionsDiv.style.maxHeight = '150px';
|
| 2143 |
+
suggestionsDiv.style.overflowY = 'auto';
|
| 2144 |
+
suggestionsDiv.style.width = descriptionInput.offsetWidth + 'px';
|
| 2145 |
+
suggestionsDiv.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
| 2146 |
+
}, 300);
|
| 2147 |
+
descriptionInput.addEventListener('input', updateSuggestions);
|
| 2148 |
+
descriptionInput.addEventListener('blur', () => {
|
| 2149 |
+
setTimeout(() => {
|
| 2150 |
+
suggestionsDiv.innerHTML = '';
|
| 2151 |
+
suggestionsDiv.style.display = 'none';
|
| 2152 |
+
}, 200);
|
| 2153 |
+
});
|
| 2154 |
+
descriptionInput.addEventListener('focus', updateSuggestions);
|
|
|
|
|
|
|
|
|
|
| 2155 |
document.addEventListener('click', (event) => {
|
| 2156 |
+
if (!descriptionInput.contains(event.target) && !suggestionsDiv.contains(event.target)) {
|
| 2157 |
+
suggestionsDiv.innerHTML = '';
|
| 2158 |
+
suggestionsDiv.style.display = 'none';
|
| 2159 |
}
|
| 2160 |
});
|
| 2161 |
}
|
| 2162 |
});
|
| 2163 |
</script>
|
| 2164 |
</body>
|
| 2165 |
+
</html>
|
|
|