lokeshloki143 commited on
Commit
a87ec18
·
verified ·
1 Parent(s): d25e89a

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +191 -158
templates/menu.html CHANGED
@@ -35,7 +35,6 @@
35
  margin: auto;
36
  display: flex;
37
  flex-direction: column;
38
- opacity: 0;
39
  transition: opacity 0.3s ease-in-out;
40
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
41
  }
@@ -211,7 +210,7 @@
211
  }
212
  .search-bar-container input {
213
  width: 100%;
214
- padding: 8px 40px 8px 40px;
215
  font-size: 16px;
216
  border-radius: 25px;
217
  border: none;
@@ -230,6 +229,7 @@
230
  left: 15px;
231
  font-size: 18px;
232
  color: #888;
 
233
  }
234
  .mic-icon {
235
  position: absolute;
@@ -242,6 +242,21 @@
242
  .mic-icon.active {
243
  color: #007bff;
244
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  /* Addon Section */
246
  .addon-section {
247
  background-color: #fff;
@@ -830,7 +845,7 @@
830
  transform: translateY(-50%);
831
  }
832
  .search-bar-container input {
833
- padding: 6px 35px 6px 35px;
834
  font-size: 14px;
835
  border-radius: 20px;
836
  }
@@ -842,6 +857,11 @@
842
  right: 12px;
843
  font-size: 16px;
844
  }
 
 
 
 
 
845
  .avatar-dropdown-container {
846
  right: 10px;
847
  }
@@ -1314,84 +1334,6 @@
1314
  .cart-item .remove-button:hover {
1315
  background-color: #c82333;
1316
  }
1317
- /* Responsive Design */
1318
- @media (max-width: 480px) {
1319
- .chat-container {
1320
- border-radius: 0;
1321
- box-shadow: none;
1322
- }
1323
- .chat-header {
1324
- font-size: 16px;
1325
- padding: 10px;
1326
- }
1327
- .chat-messages {
1328
- padding: 10px;
1329
- }
1330
- .bot-message, .user-message {
1331
- font-size: 13px;
1332
- padding: 8px 12px;
1333
- margin: 5px 0;
1334
- }
1335
- .chat-input input {
1336
- font-size: 13px;
1337
- padding: 8px;
1338
- }
1339
- .chat-input button {
1340
- font-size: 13px;
1341
- padding: 8px 15px;
1342
- }
1343
- .ingredients-list, .menu-items-list, .customization-ingredients-list {
1344
- flex-direction: row;
1345
- gap: 10px;
1346
- }
1347
- .ingredient-item, .menu-item {
1348
- flex: 0 0 150px;
1349
- }
1350
- .ingredient-item img, .menu-item img {
1351
- height: 100px;
1352
- }
1353
- .ingredient-item div, .menu-item div {
1354
- font-size: 13px;
1355
- }
1356
- .ingredient-item button, .menu-item button {
1357
- font-size: 11px;
1358
- padding: 6px;
1359
- }
1360
- .option-button {
1361
- font-size: 13px;
1362
- padding: 8px 15px;
1363
- }
1364
- .selected-ingredients, .selected-customization-ingredients, .cart-items {
1365
- padding: 10px;
1366
- gap: 8px;
1367
- }
1368
- .cart-item {
1369
- font-size: 12px;
1370
- padding: 4px 8px;
1371
- }
1372
- .cart-item img {
1373
- width: 25px;
1374
- height: 25px;
1375
- }
1376
- }
1377
- @media (min-width: 481px) and (max-width: 768px) {
1378
- .chat-container {
1379
- max-width: 600px;
1380
- }
1381
- .chat-header {
1382
- font-size: 17px;
1383
- padding: 11px;
1384
- }
1385
- .chat-messages {
1386
- padding: 12px;
1387
- }
1388
- .ingredient-item, .menu-item {
1389
- flex: 0 0 180px;
1390
- }
1391
- .ingredient-item img, .menu-item img {
1392
- height: 110px;
1393
- }
1394
- }
1395
  /* Mic Modal Styling */
1396
  #micModal .modal-dialog {
1397
  max-width: 300px;
@@ -1498,6 +1440,84 @@
1498
  font-size: 0.9rem;
1499
  }
1500
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1501
  </style>
1502
  </head>
1503
  <body>
@@ -1515,15 +1535,15 @@
1515
  </div>
1516
  <div class="search-bar-container">
1517
  <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
1518
- <i class="bi bi-search search-icon"></i>
1519
  <i class="bi bi-mic mic-icon" id="micIcon"></i>
 
1520
  </div>
1521
  </div>
1522
 
1523
  <form method="get" action="/menu" class="text-center mb-4" id="filter-form">
1524
  <label class="form-label fw-bold">Filters:</label>
1525
  <div class="toggle-container">
1526
- <!-- Veg Only Toggle -->
1527
  <input type="checkbox" id="veg-toggle" name="veg"
1528
  {% if selected_category == "Veg" %}checked{% endif %}
1529
  class="custom-toggle" onchange="handleToggle('veg')"
@@ -1531,7 +1551,6 @@
1531
  <label for="veg-toggle">Veg</label>
1532
  </div>
1533
  <div class="toggle-container">
1534
- <!-- Customized Dish Toggle -->
1535
  <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish"
1536
  {% if selected_category == "Customized Dish" %}checked{% endif %}
1537
  class="custom-toggle" onchange="handleToggle('custom')"
@@ -1555,81 +1574,79 @@
1555
  </div>
1556
  </div>
1557
  {% else %}
1558
- {% if ordered_menu.items()|length == 0 %}
1559
- <p>No menu items available for this category.</p>
1560
- {% else %}
1561
- {% for section, items in ordered_menu.items() %}
1562
- <h3>{{ section }}</h3>
1563
- <div class="row">
1564
- {% for item in items %}
1565
- <div class="col-md-6 mb-4">
1566
- <div class="card menu-card" data-item-name="{{ item.Name | default('Unnamed Item') }}" data-item-section="{{ item.Section__c | default(section) }}">
1567
- <video
1568
- class="card-img-top menu-video"
1569
- muted
1570
- loop
1571
- preload="auto"
1572
- data-src="{{ item.Video1__c | default('/static/placeholder.mp4') }}"
1573
- poster="{{ item.Image1__c | default('/static/placeholder.jpg') }}"
1574
- width="350"
1575
- height="200"
1576
- onmouseover="this.play()"
1577
- onmouseout="this.pause(); this.currentTime = 0;"
1578
- onerror="this.poster='/static/placeholder.jpg';">
1579
- <source src="{{ item.Video1__c | default('/static/placeholder.mp4') }}" type="video/mp4">
1580
- Your browser does not support the video tag.
1581
- </video>
1582
- <div class="addbutton">
1583
- <div class="card-body d-flex align-items-center justify-content-between">
1584
- <div>
1585
- <h5 class="card-title">{{ item.Name | default('Unnamed Item') }}</h5>
1586
- <p class="card-text price">${{ item.Price__c | default('0.00') }}</p>
1587
- </div>
1588
- <div class="d-flex flex-column align-items-center justify-content-center">
1589
- <div class="button-container"
1590
- data-item-name="{{ item.Name | default('Unnamed Item') }}"
1591
- data-item-price="{{ item.Price__c | default('0.00') }}"
1592
- data-item-image="{{ item.Image1__c | default('/static/placeholder.jpg') }}"
1593
- data-item-section="{{ item.Section__c | default(section) }}"
1594
- data-item-category="{{ selected_category }}"
1595
- data-item-description="{{ item.Description__c | default('No description') }}"
1596
- data-item-image2="{{ item.Image2__c | default(item.Image1__c) }}">
1597
- {% if item.Section__c == 'Soft Drinks' %}
1598
- <button class="btn btn-primary add-to-cart-btn" onclick="showSoftDrinkModal(this)">ADD</button>
1599
- {% else %}
1600
- <button class="btn btn-primary"
1601
- data-bs-toggle="modal"
1602
- data-bs-target="#itemModal"
1603
- onclick="showItemDetails('{{ item.Name | default('Unnamed Item') }}', '{{ item.Price__c | default('0.00') }}', '{{ item.Image2__c | default(item.Image1__c) }}', '{{ item.Description__c | default('No description') }}', '{{ item.Section__c | default(section) }}', '{{ selected_category }}')">
1604
- ADD
1605
- </button>
1606
- {% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' %}
1607
- <span class="customisable-text">Customisable</span>
1608
- {% endif %}
1609
  {% endif %}
1610
- </div>
1611
  </div>
1612
  </div>
1613
  </div>
1614
- {% if item.Section__c != 'Soft Drinks' %}
1615
- <div class="toggle-details" data-item-name="{{ item.Name | default('Unnamed Item') }}">Show Details</div>
1616
- <div class="item-details" id="details-{{ item.Name | default('unnamed-item') | replace(' ', '-') }}">
1617
- <h6>Description</h6>
1618
- <p>{{ item.Description__c | default('No description available') }}</p>
1619
- <h6>Ingredients</h6>
1620
- <p>{{ item.Ingredientsinfo__c | default('Not specified') }}</p>
1621
- <h6>Nutritional Info</h6>
1622
- <p class="nutritional-info">{{ item.NutritionalInfo__c | default('Not available') }}</p>
1623
- <h6>Allergens</h6>
1624
- <p>{{ item.Allergens__c | default('None listed') }}</p>
1625
- </div>
1626
- {% endif %}
1627
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
1628
  </div>
1629
- {% endfor %}
1630
- </div>
1631
- {% endfor %}
1632
- {% endif %}
 
 
1633
  {% endif %}
1634
  </div>
1635
 
@@ -1752,8 +1769,13 @@
1752
  {% endfor %}
1753
  ];
1754
 
1755
- // Lazy load videos
1756
  document.addEventListener('DOMContentLoaded', function () {
 
 
 
 
 
1757
  const videos = document.querySelectorAll('.menu-video');
1758
  const observer = new IntersectionObserver((entries) => {
1759
  entries.forEach(entry => {
@@ -1775,9 +1797,16 @@
1775
 
1776
  // Search functionality
1777
  const searchBar = document.getElementById('searchBar');
1778
- searchBar.addEventListener('input', function () {
1779
- const searchTerm = this.value.toLowerCase();
 
 
 
1780
  const menuCards = document.querySelectorAll('.menu-card');
 
 
 
 
1781
  menuCards.forEach(card => {
1782
  const itemName = card.getAttribute('data-item-name').toLowerCase();
1783
  const itemSection = card.getAttribute('data-item-section').toLowerCase();
@@ -1789,7 +1818,11 @@
1789
  card.classList.remove('visible');
1790
  }
1791
  });
1792
- });
 
 
 
 
1793
 
1794
  // Toggle details
1795
  document.querySelectorAll('.toggle-details').forEach(link => {
@@ -1834,7 +1867,7 @@
1834
  addonsList.classList.add('addon-loading');
1835
  addonsList.innerHTML = '';
1836
 
1837
- fetch(`/get_addons?name=${encodeURIComponent(name)}&section=${encodeURIComponent(section)}`)
1838
  .then(response => response.json())
1839
  .then(data => {
1840
  addonsList.classList.remove('addon-loading');
 
35
  margin: auto;
36
  display: flex;
37
  flex-direction: column;
 
38
  transition: opacity 0.3s ease-in-out;
39
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
40
  }
 
210
  }
211
  .search-bar-container input {
212
  width: 100%;
213
+ padding: 8px 100px 8px 40px;
214
  font-size: 16px;
215
  border-radius: 25px;
216
  border: none;
 
229
  left: 15px;
230
  font-size: 18px;
231
  color: #888;
232
+ cursor: pointer;
233
  }
234
  .mic-icon {
235
  position: absolute;
 
242
  .mic-icon.active {
243
  color: #007bff;
244
  }
245
+ #searchButton {
246
+ background-color: #0FAA39;
247
+ border-color: #0FAA39;
248
+ border-radius: 20px;
249
+ height: 30px;
250
+ line-height: 1;
251
+ position: absolute;
252
+ right: 40px;
253
+ padding: 5px 10px;
254
+ font-size: 14px;
255
+ }
256
+ #searchButton:hover {
257
+ background-color: #0D9232;
258
+ border-color: #0D9232;
259
+ }
260
  /* Addon Section */
261
  .addon-section {
262
  background-color: #fff;
 
845
  transform: translateY(-50%);
846
  }
847
  .search-bar-container input {
848
+ padding: 6px 90px 6px 35px;
849
  font-size: 14px;
850
  border-radius: 20px;
851
  }
 
857
  right: 12px;
858
  font-size: 16px;
859
  }
860
+ #searchButton {
861
+ padding: 4px 8px;
862
+ font-size: 12px;
863
+ right: 35px;
864
+ }
865
  .avatar-dropdown-container {
866
  right: 10px;
867
  }
 
1334
  .cart-item .remove-button:hover {
1335
  background-color: #c82333;
1336
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1337
  /* Mic Modal Styling */
1338
  #micModal .modal-dialog {
1339
  max-width: 300px;
 
1440
  font-size: 0.9rem;
1441
  }
1442
  }
1443
+ /* Responsive Design */
1444
+ @media (max-width: 480px) {
1445
+ .chat-container {
1446
+ border-radius: 0;
1447
+ box-shadow: none;
1448
+ }
1449
+ .chat-header {
1450
+ font-size: 16px;
1451
+ padding: 10px;
1452
+ }
1453
+ .chat-messages {
1454
+ padding: 10px;
1455
+ }
1456
+ .bot-message, .user-message {
1457
+ font-size: 13px;
1458
+ padding: 8px 12px;
1459
+ margin: 5px 0;
1460
+ }
1461
+ .chat-input input {
1462
+ font-size: 13px;
1463
+ padding: 8px;
1464
+ }
1465
+ .chat-input button {
1466
+ font-size: 13px;
1467
+ padding: 8px 15px;
1468
+ }
1469
+ .ingredients-list, .menu-items-list, .customization-ingredients-list {
1470
+ flex-direction: row;
1471
+ gap: 10px;
1472
+ }
1473
+ .ingredient-item, .menu-item {
1474
+ flex: 0 0 150px;
1475
+ }
1476
+ .ingredient-item img, .menu-item img {
1477
+ height: 100px;
1478
+ }
1479
+ .ingredient-item div, .menu-item div {
1480
+ font-size: 13px;
1481
+ }
1482
+ .ingredient-item button, .menu-item button {
1483
+ font-size: 11px;
1484
+ padding: 6px;
1485
+ }
1486
+ .option-button {
1487
+ font-size: 13px;
1488
+ padding: 8px 15px;
1489
+ }
1490
+ .selected-ingredients, .selected-customization-ingredients, .cart-items {
1491
+ padding: 10px;
1492
+ gap: 8px;
1493
+ }
1494
+ .cart-item {
1495
+ font-size: 12px;
1496
+ padding: 4px 8px;
1497
+ }
1498
+ .cart-item img {
1499
+ width: 25px;
1500
+ height: 25px;
1501
+ }
1502
+ }
1503
+ @media (min-width: 481px) and (max-width: 768px) {
1504
+ .chat-container {
1505
+ max-width: 600px;
1506
+ }
1507
+ .chat-header {
1508
+ font-size: 17px;
1509
+ padding: 11px;
1510
+ }
1511
+ .chat-messages {
1512
+ padding: 12px;
1513
+ }
1514
+ .ingredient-item, .menu-item {
1515
+ flex: 0 0 180px;
1516
+ }
1517
+ .ingredient-item img, .menu-item img {
1518
+ height: 110px;
1519
+ }
1520
+ }
1521
  </style>
1522
  </head>
1523
  <body>
 
1535
  </div>
1536
  <div class="search-bar-container">
1537
  <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
1538
+ <i class="bi bi-search search-icon" id="searchIcon" style="cursor: pointer;"></i>
1539
  <i class="bi bi-mic mic-icon" id="micIcon"></i>
1540
+ <button type="button" id="searchButton" class="btn btn-primary">Search</button>
1541
  </div>
1542
  </div>
1543
 
1544
  <form method="get" action="/menu" class="text-center mb-4" id="filter-form">
1545
  <label class="form-label fw-bold">Filters:</label>
1546
  <div class="toggle-container">
 
1547
  <input type="checkbox" id="veg-toggle" name="veg"
1548
  {% if selected_category == "Veg" %}checked{% endif %}
1549
  class="custom-toggle" onchange="handleToggle('veg')"
 
1551
  <label for="veg-toggle">Veg</label>
1552
  </div>
1553
  <div class="toggle-container">
 
1554
  <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish"
1555
  {% if selected_category == "Customized Dish" %}checked{% endif %}
1556
  class="custom-toggle" onchange="handleToggle('custom')"
 
1574
  </div>
1575
  </div>
1576
  {% else %}
1577
+ {% for section, items in ordered_menu.items() %}
1578
+ <h3>{{ section }}</h3>
1579
+ <div class="row">
1580
+ {% for item in items %}
1581
+ <div class="col-md-6 mb-4">
1582
+ <div class="card menu-card" data-item-name="{{ item.Name | default('Unnamed Item') }}" data-item-section="{{ item.Section__c | default(section) }}">
1583
+ <video
1584
+ class="card-img-top menu-video"
1585
+ muted
1586
+ loop
1587
+ preload="auto"
1588
+ data-src="{{ item.Video1__c | default('/static/placeholder.mp4') }}"
1589
+ poster="{{ item.Image1__c | default('/static/placeholder.jpg') }}"
1590
+ width="350"
1591
+ height="200"
1592
+ onmouseover="this.play()"
1593
+ onmouseout="this.pause(); this.currentTime = 0;"
1594
+ onerror="this.poster='/static/placeholder.jpg';">
1595
+ <source src="{{ item.Video1__c | default('/static/placeholder.mp4') }}" type="video/mp4">
1596
+ Your browser does not support the video tag.
1597
+ </video>
1598
+ <div class="addbutton">
1599
+ <div class="card-body d-flex align-items-center justify-content-between">
1600
+ <div>
1601
+ <h5 class="card-title">{{ item.Name | default('Unnamed Item') }}</h5>
1602
+ <p class="card-text price">${{ item.Price__c | default('0.00') }}</p>
1603
+ </div>
1604
+ <div class="d-flex flex-column align-items-center justify-content-center">
1605
+ <div class="button-container"
1606
+ data-item-name="{{ item.Name | default('Unnamed Item') }}"
1607
+ data-item-price="{{ item.Price__c | default('0.00') }}"
1608
+ data-item-image="{{ item.Image1__c | default('/static/placeholder.jpg') }}"
1609
+ data-item-section="{{ item.Section__c | default(section) }}"
1610
+ data-item-category="{{ selected_category }}"
1611
+ data-item-description="{{ item.Description__c | default('No description') }}"
1612
+ data-item-image2="{{ item.Image2__c | default(item.Image1__c) }}">
1613
+ {% if item.Section__c == 'Soft Drinks' %}
1614
+ <button class="btn btn-primary add-to-cart-btn" onclick="showSoftDrinkModal(this)">ADD</button>
1615
+ {% else %}
1616
+ <button class="btn btn-primary"
1617
+ data-bs-toggle="modal"
1618
+ data-bs-target="#itemModal"
1619
+ onclick="showItemDetails('{{ item.Name | default('Unnamed Item') }}', '{{ item.Price__c | default('0.00') }}', '{{ item.Image2__c | default(item.Image1__c) }}', '{{ item.Description__c | default('No description') }}', '{{ item.Section__c | default(section) }}', '{{ selected_category }}')">
1620
+ ADD
1621
+ </button>
1622
+ {% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' %}
1623
+ <span class="customisable-text">Customisable</span>
 
 
 
 
1624
  {% endif %}
1625
+ {% endif %}
1626
  </div>
1627
  </div>
1628
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
1629
  </div>
1630
+ {% if item.Section__c != 'Soft Drinks' %}
1631
+ <div class="toggle-details" data-item-name="{{ item.Name | default('Unnamed Item') }}">Show Details</div>
1632
+ <div class="item-details" id="details-{{ item.Name | default('unnamed-item') | replace(' ', '-') }}">
1633
+ <h6>Description</h6>
1634
+ <p>{{ item.Description__c | default('No description available') }}</p>
1635
+ <h6>Ingredients</h6>
1636
+ <p>{{ item.Ingredientsinfo__c | default('Not specified') }}</p>
1637
+ <h6>Nutritional Info</h6>
1638
+ <p class="nutritional-info">{{ item.NutritionalInfo__c | default('Not available') }}</p>
1639
+ <h6>Allergens</h6>
1640
+ <p>{{ item.Allergens__c | default('None listed') }}</p>
1641
+ </div>
1642
+ {% endif %}
1643
  </div>
1644
+ </div>
1645
+ {% endfor %}
1646
+ </div>
1647
+ {% else %}
1648
+ <p>No menu items available for this category. Please try a different filter or contact support.</p>
1649
+ {% endfor %}
1650
  {% endif %}
1651
  </div>
1652
 
 
1769
  {% endfor %}
1770
  ];
1771
 
1772
+ // Lazy load videos and initialize menu cards
1773
  document.addEventListener('DOMContentLoaded', function () {
1774
+ // Ensure menu cards are visible on load
1775
+ document.querySelectorAll('.menu-card').forEach(card => {
1776
+ card.classList.add('visible');
1777
+ });
1778
+
1779
  const videos = document.querySelectorAll('.menu-video');
1780
  const observer = new IntersectionObserver((entries) => {
1781
  entries.forEach(entry => {
 
1797
 
1798
  // Search functionality
1799
  const searchBar = document.getElementById('searchBar');
1800
+ const searchIcon = document.getElementById('searchIcon');
1801
+ const searchButton = document.getElementById('searchButton');
1802
+
1803
+ function performSearch() {
1804
+ const searchTerm = searchBar.value.toLowerCase();
1805
  const menuCards = document.querySelectorAll('.menu-card');
1806
+ if (menuCards.length === 0) {
1807
+ console.warn('No menu cards found. Check if menu items are loaded.');
1808
+ return;
1809
+ }
1810
  menuCards.forEach(card => {
1811
  const itemName = card.getAttribute('data-item-name').toLowerCase();
1812
  const itemSection = card.getAttribute('data-item-section').toLowerCase();
 
1818
  card.classList.remove('visible');
1819
  }
1820
  });
1821
+ }
1822
+
1823
+ searchBar.addEventListener('input', performSearch);
1824
+ searchIcon.addEventListener('click', performSearch);
1825
+ searchButton.addEventListener('click', performSearch);
1826
 
1827
  // Toggle details
1828
  document.querySelectorAll('.toggle-details').forEach(link => {
 
1867
  addonsList.classList.add('addon-loading');
1868
  addonsList.innerHTML = '';
1869
 
1870
+ fetch(`/get_addons?name=${encodeURIComponent(name)}§ion=${encodeURIComponent(section)}`)
1871
  .then(response => response.json())
1872
  .then(data => {
1873
  addonsList.classList.remove('addon-loading');