lokeshloki143 commited on
Commit
0801902
·
verified ·
1 Parent(s): cd9fdc9

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +109 -114
templates/menu.html CHANGED
@@ -149,10 +149,7 @@
149
  right: 10px;
150
  top: 50%;
151
  transform: translateY(-50%);
152
- display: flex;
153
- align-items: center;
154
- justify-content: center;
155
- z-index: 1100; /* Ensure it’s above other elements */
156
  }
157
  .avatar-icon {
158
  width: 40px;
@@ -172,48 +169,44 @@
172
  transform: scale(1.1);
173
  }
174
  .dropdown-menu {
175
- position: absolute;
176
- top: 100%; /* Position directly below the avatar */
177
- right: 0;
178
- background-color: #fff8f0;
179
- border-radius: 8px;
180
- width: 240px; /* Slightly wider for better readability */
181
- box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
182
- border: 1px solid #ffd8b1;
183
  display: none;
184
- opacity: 0;
185
- transform: translateY(-10px);
186
- transition: opacity 0.2s ease, transform 0.2s ease;
187
- z-index: 1050; /* Ensure it’s above other content */
188
- max-height: 300px; /* Prevent overflow on small screens */
189
- overflow-y: auto;
 
 
 
190
  }
191
  .dropdown-menu.show {
192
- display: block;
193
- opacity: 1;
194
- transform: translateY(0);
195
  }
196
- .dropdown-menu .dropdown-item {
197
- padding: 12px 16px;
198
- text-decoration: none;
199
- color: #333;
200
- border-bottom: 1px solid #ffd8b1;
 
 
 
 
201
  display: flex;
202
  align-items: center;
203
- font-size: 15px;
204
- transition: background-color 0.2s ease;
205
- }
206
- .dropdown-menu .dropdown-item i {
207
- margin-right: 10px; /* Space between icon and text */
208
  font-size: 16px;
209
- color: #007bff; /* Match avatar icon color */
210
  }
211
- .dropdown-menu .dropdown-item:last-child {
212
- border-bottom: none;
213
  }
214
- .dropdown-menu .dropdown-item:hover {
215
- background-color: #ffe4c4;
216
- color: #333;
 
217
  }
218
  .fixed-top-bar {
219
  position: relative;
@@ -893,19 +886,19 @@
893
  white-space: nowrap;
894
  }
895
  .bottom-action-bar .btn-order-history {
896
- background: linear-gradient(45deg, #FF8C00, #32CD32);
897
- border-color: transparent;
898
- color: #000000; /* Black text */
899
  }
900
  .bottom-action-bar .btn-order-history:hover {
901
- background: linear-gradient(45deg, #FF4500, #228B22);
902
- border-color: transparent;
903
- color: #000000; /* Black text on hover */
904
  }
905
  .bottom-action-bar .btn-view-cart {
906
  background-color: #0FAA39;
907
  border-color: #0FAA39;
908
- color: white;
909
  }
910
  .bottom-action-bar .btn-view-cart:hover {
911
  background-color: #0D9232;
@@ -957,18 +950,16 @@
957
  height: 40px;
958
  font-size: 20px;
959
  }
960
- .dropdown-menu {
961
- width: 220px;
962
- max-height: 250px; /* Adjusted for smaller screens */
963
- border-radius: 6px;
964
  }
965
- .dropdown-menu .dropdown-item {
966
- padding: 10px 14px;
967
  font-size: 14px;
968
  }
969
- .dropdown-menu .dropdown-item i {
970
- font-size: 14px;
971
- margin-right: 8px;
972
  }
973
  .modal-dialog {
974
  max-width: 90%;
@@ -1232,10 +1223,12 @@
1232
  <span>{{ first_letter }}</span>
1233
  </div>
1234
  <div class="dropdown-menu">
1235
- <a href="{{ url_for('user_details.customer_details') }}" class="dropdown-item"><i class="bi bi-person"></i> View Profile</a>
1236
- <a href="{{ url_for('orderhistory.order_history') }}" class="dropdown-item"><i class="bi bi-clock-history"></i> Order History</a>
1237
- <a href="{{ url_for('combined_summary.combined_summary') }}" class="dropdown-item"><i class="bi bi-bar-chart"></i> MY Summary</a>
1238
- <a href="{{ url_for('logout') }}" class="dropdown-item"><i class="bi bi-box-arrow-right"></i> Logout</a>
 
 
1239
  </div>
1240
  </div>
1241
  <div class="search-bar-container">
@@ -1857,7 +1850,7 @@
1857
  dropdownMenu.classList.toggle('show');
1858
  });
1859
  document.addEventListener('click', function (event) {
1860
- if (!avatarContainer.contains(event.target)) {
1861
  dropdownMenu.classList.remove('show');
1862
  }
1863
  });
@@ -1876,82 +1869,83 @@
1876
  try {
1877
  const { name, section } = JSON.parse(selectedItem);
1878
  const menuCards = document.querySelectorAll('.menu-card');
1879
- let targetButton = null;
 
1880
  menuCards.forEach(card => {
1881
- if (card.getAttribute('data-item-name') === name && card.getAttribute('data-item-section') === section) {
1882
- targetButton = card.querySelector('.button-container');
 
 
 
 
 
 
 
 
 
1883
  }
1884
  });
1885
- if (targetButton) {
1886
- const itemName = targetButton.getAttribute('data-item-name');
1887
- const itemPrice = targetButton.getAttribute('data-item-price');
1888
- const itemImage = targetButton.getAttribute('data-item-image2');
1889
- const itemDescription = targetButton.getAttribute('data-item-description');
1890
- const itemSection = targetButton.getAttribute('data-item-section');
1891
- const itemCategory = targetButton.getAttribute('data-item-category');
1892
- if (itemSection === 'Soft Drinks') {
1893
- showSoftDrinkModal(targetButton.querySelector('.add-to-cart-btn'));
1894
- } else {
1895
- showItemDetails(itemName, itemPrice, itemImage, itemDescription, itemSection, itemCategory);
1896
- const modal = new bootstrap.Modal(document.getElementById('itemModal'));
1897
- modal.show();
1898
- }
 
1899
  }
1900
- localStorage.removeItem('selectedItem');
1901
  } catch (e) {
1902
  console.error('Error parsing selectedItem:', e);
 
1903
  localStorage.removeItem('selectedItem');
1904
  }
1905
  }
1906
- document.querySelectorAll('.menu-video').forEach(video => {
1907
- video.addEventListener('loadeddata', () => {
1908
- video.classList.add('active');
1909
- video.previousElementSibling.classList.add('hidden');
1910
- });
1911
- video.addEventListener('error', () => {
1912
- video.classList.remove('active');
1913
- video.previousElementSibling.classList.remove('hidden');
1914
- });
1915
- });
1916
- document.querySelectorAll('.media-wrapper').forEach(wrapper => {
1917
  wrapper.addEventListener('mouseenter', () => {
1918
- const video = wrapper.querySelector('.menu-video');
1919
- if (video) {
1920
- video.play().catch(err => console.warn('Video play failed:', err));
1921
- }
1922
  });
1923
  wrapper.addEventListener('mouseleave', () => {
1924
- const video = wrapper.querySelector('.menu-video');
1925
- if (video) {
1926
- video.pause();
1927
- video.currentTime = 0;
1928
- }
1929
  });
1930
  wrapper.addEventListener('touchstart', () => {
1931
  wrapper.classList.add('touched');
1932
- const video = wrapper.querySelector('.menu-video');
1933
- if (video) {
1934
- video.play().catch(err => console.warn('Video play failed:', err));
1935
- }
1936
  });
1937
  wrapper.addEventListener('touchend', () => {
1938
  setTimeout(() => {
1939
  wrapper.classList.remove('touched');
1940
- const video = wrapper.querySelector('.menu-video');
1941
- if (video) {
1942
- video.pause();
1943
- video.currentTime = 0;
1944
- }
1945
- }, 1000);
1946
  });
1947
  });
1948
- document.querySelectorAll('.toggle-details').forEach(toggle => {
1949
- toggle.addEventListener('click', () => {
1950
- const itemName = toggle.getAttribute('data-item-name').replace(/ /g, '-');
1951
- const details = document.getElementById(`details-${itemName}`);
1952
- if (details) {
1953
- details.classList.toggle('show');
1954
- toggle.textContent = details.classList.contains('show') ? 'Hide Details' : 'Show Details';
 
1955
  }
1956
  });
1957
  });
@@ -2105,4 +2099,5 @@
2105
  });
2106
  </script>
2107
  </body>
2108
- </html>
 
 
149
  right: 10px;
150
  top: 50%;
151
  transform: translateY(-50%);
152
+ z-index: 1100;
 
 
 
153
  }
154
  .avatar-icon {
155
  width: 40px;
 
169
  transform: scale(1.1);
170
  }
171
  .dropdown-menu {
 
 
 
 
 
 
 
 
172
  display: none;
173
+ position: fixed;
174
+ top: 0;
175
+ left: 0;
176
+ width: 100%;
177
+ height: 100%;
178
+ background: rgba(0, 0, 0, 0.5);
179
+ z-index: 1050;
180
+ justify-content: center;
181
+ align-items: center;
182
  }
183
  .dropdown-menu.show {
184
+ display: flex;
 
 
185
  }
186
+ .dropdown-content {
187
+ background-color: #fff;
188
+ border-radius: 10px;
189
+ width: 90%;
190
+ max-width: 300px;
191
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
192
+ padding: 10px 0;
193
+ }
194
+ .dropdown-item {
195
  display: flex;
196
  align-items: center;
197
+ padding: 12px 20px;
198
+ text-decoration: none;
199
+ color: #333;
 
 
200
  font-size: 16px;
201
+ transition: background-color 0.2s ease;
202
  }
203
+ .dropdown-item:hover {
204
+ background-color: #f8f9fa;
205
  }
206
+ .dropdown-item i {
207
+ margin-right: 10px;
208
+ font-size: 18px;
209
+ color: #0FAA39;
210
  }
211
  .fixed-top-bar {
212
  position: relative;
 
886
  white-space: nowrap;
887
  }
888
  .bottom-action-bar .btn-order-history {
889
+ background-color: #e9ecef;
890
+ border-color: #e9ecef;
891
+ color: #000000;
892
  }
893
  .bottom-action-bar .btn-order-history:hover {
894
+ background-color: #d1d4d7;
895
+ border-color: #d1d4d7;
896
+ color: #000000;
897
  }
898
  .bottom-action-bar .btn-view-cart {
899
  background-color: #0FAA39;
900
  border-color: #0FAA39;
901
+ color: #ffffff;
902
  }
903
  .bottom-action-bar .btn-view-cart:hover {
904
  background-color: #0D9232;
 
950
  height: 40px;
951
  font-size: 20px;
952
  }
953
+ .dropdown-content {
954
+ width: 90%;
955
+ max-width: 280px;
 
956
  }
957
+ .dropdown-item {
958
+ padding: 10px 15px;
959
  font-size: 14px;
960
  }
961
+ .dropdown-item i {
962
+ font-size: 16px;
 
963
  }
964
  .modal-dialog {
965
  max-width: 90%;
 
1223
  <span>{{ first_letter }}</span>
1224
  </div>
1225
  <div class="dropdown-menu">
1226
+ <div class="dropdown-content">
1227
+ <a href="{{ url_for('user_details.customer_details') }}" class="dropdown-item"><i class="bi bi-person"></i>View Profile</a>
1228
+ <a href="{{ url_for('orderhistory.order_history') }}" class="dropdown-item"><i class="bi bi-clock-history"></i>Order History</a>
1229
+ <a href="{{ url_for('combined_summary.combined_summary') }}" class="dropdown-item"><i class="bi bi-file-text"></i>MY Summary</a>
1230
+ <a href="{{ url_for('logout') }}" class="dropdown-item"><i class="bi bi-box-arrow-right"></i>Logout</a>
1231
+ </div>
1232
  </div>
1233
  </div>
1234
  <div class="search-bar-container">
 
1850
  dropdownMenu.classList.toggle('show');
1851
  });
1852
  document.addEventListener('click', function (event) {
1853
+ if (!avatarContainer.contains(event.target) && !dropdownMenu.contains(event.target)) {
1854
  dropdownMenu.classList.remove('show');
1855
  }
1856
  });
 
1869
  try {
1870
  const { name, section } = JSON.parse(selectedItem);
1871
  const menuCards = document.querySelectorAll('.menu-card');
1872
+ let targetCard = null;
1873
+ let buttonContainer = null;
1874
  menuCards.forEach(card => {
1875
+ const itemName = card.getAttribute('data-item-name');
1876
+ const itemSection = card.getAttribute('data-item-section');
1877
+ if (itemName === name && itemSection === section) {
1878
+ targetCard = card;
1879
+ buttonContainer = card.querySelector('.button-container');
1880
+ card.classList.add('highlighted');
1881
+ card.scrollIntoView({ behavior: 'smooth', block: 'center' });
1882
+ const toggleLink = card.querySelector('.toggle-details');
1883
+ if (toggleLink) {
1884
+ toggleLink.click();
1885
+ }
1886
  }
1887
  });
1888
+ if (targetCard && buttonContainer) {
1889
+ const name = buttonContainer.getAttribute('data-item-name');
1890
+ const price = buttonContainer.getAttribute('data-item-price');
1891
+ const image = buttonContainer.getAttribute('data-item-image2');
1892
+ const description = buttonContainer.getAttribute('data-item-description');
1893
+ const category = buttonContainer.getAttribute('data-item-category');
1894
+ setTimeout(() => {
1895
+ if (section === 'Soft Drinks') {
1896
+ showSoftDrinkModal(buttonContainer.querySelector('.add-to-cart-btn'));
1897
+ } else {
1898
+ showItemDetails(name, price, image, description, section, category);
1899
+ const modal = new bootstrap.Modal(document.getElementById('itemModal'));
1900
+ modal.show();
1901
+ }
1902
+ }, 1000);
1903
  }
 
1904
  } catch (e) {
1905
  console.error('Error parsing selectedItem:', e);
1906
+ } finally {
1907
  localStorage.removeItem('selectedItem');
1908
  }
1909
  }
1910
+ const mediaWrappers = document.querySelectorAll('.media-wrapper');
1911
+ mediaWrappers.forEach(wrapper => {
1912
+ const video = wrapper.querySelector('.menu-video');
1913
+ const image = wrapper.querySelector('.menu-image');
 
 
 
 
 
 
 
1914
  wrapper.addEventListener('mouseenter', () => {
1915
+ image.classList.add('hidden');
1916
+ video.classList.add('active');
1917
+ video.play().catch(err => console.error('Video play error:', err));
 
1918
  });
1919
  wrapper.addEventListener('mouseleave', () => {
1920
+ video.classList.remove('active');
1921
+ image.classList.remove('.hidden');
1922
+ video.pause();
1923
+ video.currentTime = 0;
 
1924
  });
1925
  wrapper.addEventListener('touchstart', () => {
1926
  wrapper.classList.add('touched');
1927
+ image.classList.add('hidden');
1928
+ video.classList.add('active');
1929
+ video.play().catch(err => console.error('Video play error:', err));
 
1930
  });
1931
  wrapper.addEventListener('touchend', () => {
1932
  setTimeout(() => {
1933
  wrapper.classList.remove('touched');
1934
+ video.classList.remove('active');
1935
+ image.classList.remove('hidden');
1936
+ video.pause();
1937
+ video.currentTime = 0;
1938
+ }, 500);
 
1939
  });
1940
  });
1941
+ const toggleDetailsLinks = document.querySelectorAll('.toggle-details');
1942
+ toggleDetailsLinks.forEach(link => {
1943
+ link.addEventListener('click', function () {
1944
+ const itemName = this.getAttribute('data-item-name').replace(/\s+/g, '-');
1945
+ const detailsDiv = document.getElementById(`details-${itemName}`);
1946
+ if (detailsDiv) {
1947
+ detailsDiv.classList.toggle('show');
1948
+ this.textContent = detailsDiv.classList.contains('show') ? 'Hide Details' : 'Show Details';
1949
  }
1950
  });
1951
  });
 
2099
  });
2100
  </script>
2101
  </body>
2102
+ </html>
2103
+ </xaiArtifact>