lokesh341 commited on
Commit
dc7be63
·
verified ·
1 Parent(s): cf024a7

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +161 -17
templates/menu.html CHANGED
@@ -7,12 +7,11 @@
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
10
- <!-- Preload Placeholder Image -->
11
  <link rel="preload" href="/static/placeholder.jpg" as="image">
12
- <!-- Preload First Few Menu Item Images -->
13
  {% for section, items in ordered_menu.items() %}
14
- {% for item in items[:2] %}
15
- <link rel="preload" href="{{ item.Image1__c }}" as="image">
16
  {% endfor %}
17
  {% endfor %}
18
  <style>
@@ -44,7 +43,7 @@
44
  .menu-image {
45
  height: 200px;
46
  width: 100%;
47
- object-fit: fill;
48
  border-radius: 15px 15px 0 0;
49
  opacity: 0;
50
  transition: opacity 0.5s ease-in-out;
@@ -116,29 +115,47 @@
116
  box-shadow: none;
117
  transform: scale(0.98);
118
  }
119
- .view-cart-container {
120
  position: fixed;
121
  bottom: 20px;
122
  right: 20px;
123
  z-index: 999;
124
  }
125
- .view-cart-button {
 
 
 
 
 
126
  background-color: #0FAA39;
 
 
 
 
 
 
 
 
 
 
 
127
  color: #fff;
128
- padding: 10px 20px;
129
- border-radius: 30px;
130
- font-size: 1rem;
 
 
 
 
 
131
  font-weight: bold;
132
- text-decoration: none;
133
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
 
134
  display: flex;
135
  align-items: center;
136
  justify-content: center;
137
  }
138
- .view-cart-button:hover {
139
- background-color: #109835;
140
- text-decoration: none;
141
- }
142
  .avatar-dropdown-container {
143
  position: absolute;
144
  right: 10px;
@@ -508,8 +525,11 @@
508
  padding: 10px;
509
  }
510
  .search-bar-container {
511
- width: 60%;
512
  max-width: 100%;
 
 
 
513
  }
514
  .search-bar-container input {
515
  padding: 6px 12px 6px 35px;
@@ -637,6 +657,22 @@
637
  height: 18px;
638
  font-size: 9px;
639
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
640
  }
641
  </style>
642
  </head>
@@ -671,6 +707,114 @@
671
  <input type="hidden" name="category" id="selectedCategoryInput" value="{{ selected_category }}">
672
  </form>
673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  <div class="container mt-4">
675
  {% if selected_category == "Customized Dish" %}
676
  <div id="custom-dish-form" class="mt-4">
 
7
  <!-- Bootstrap CSS -->
8
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
10
+ <!-- Preload Critical Resources -->
11
  <link rel="preload" href="/static/placeholder.jpg" as="image">
 
12
  {% for section, items in ordered_menu.items() %}
13
+ {% for item in items[:1] %}
14
+ <link rel="preload" href="{{ item.Image1__c }}" as="image" fetchpriority="high">
15
  {% endfor %}
16
  {% endfor %}
17
  <style>
 
43
  .menu-image {
44
  height: 200px;
45
  width: 100%;
46
+ object-fit: cover;
47
  border-radius: 15px 15px 0 0;
48
  opacity: 0;
49
  transition: opacity 0.5s ease-in-out;
 
115
  box-shadow: none;
116
  transform: scale(0.98);
117
  }
118
+ .side-cart-container {
119
  position: fixed;
120
  bottom: 20px;
121
  right: 20px;
122
  z-index: 999;
123
  }
124
+ .side-cart-button {
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ width: 60px;
129
+ height: 60px;
130
  background-color: #0FAA39;
131
+ border-radius: 50%;
132
+ text-decoration: none;
133
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
134
+ transition: background-color 0.3s ease, transform 0.2s ease;
135
+ }
136
+ .side-cart-button:hover {
137
+ background-color: #109835;
138
+ transform: scale(1.1);
139
+ }
140
+ .cart-icon {
141
+ font-size: 24px;
142
  color: #fff;
143
+ }
144
+ .cart-count {
145
+ position: absolute;
146
+ top: -5px;
147
+ right: -5px;
148
+ background-color: #ff4d4d;
149
+ color: #fff;
150
+ font-size: 12px;
151
  font-weight: bold;
152
+ width: 20px;
153
+ height: 20px;
154
+ border-radius: 50%;
155
  display: flex;
156
  align-items: center;
157
  justify-content: center;
158
  }
 
 
 
 
159
  .avatar-dropdown-container {
160
  position: absolute;
161
  right: 10px;
 
525
  padding: 10px;
526
  }
527
  .search-bar-container {
528
+ width: 80%;
529
  max-width: 100%;
530
+ left: 10px;
531
+ top: 50%;
532
+ transform: translateY(-50%);
533
  }
534
  .search-bar-container input {
535
  padding: 6px 12px 6px 35px;
 
657
  height: 18px;
658
  font-size: 9px;
659
  }
660
+ .side-cart-container {
661
+ bottom: 10px;
662
+ right: 10px;
663
+ }
664
+ .side-cart-button {
665
+ width: 50px;
666
+ height: 50px;
667
+ }
668
+ .cart-icon {
669
+ font-size: 20px;
670
+ }
671
+ .cart-count {
672
+ width: 18px;
673
+ height: 18px;
674
+ font-size: 10px;
675
+ }
676
  }
677
  </style>
678
  </head>
 
707
  <input type="hidden" name="category" id="selectedCategoryInput" value="{{ selected_category }}">
708
  </form>
709
 
710
+ <div class="container mt-4">
711
+ {% if selected_category == "Customized Dish" %}
712
+ <div id="custom-dish-form" class="mt-4">
713
+ <h3>Create Your Custom Dish</h3>
714
+ <form method="POST" action="/customdish/generate_custom_dish">
715
+ <div class="mb-3">
716
+ <label for="custom-dish-name" class="form-label">Dish Name</label>
717
+ <input type="text" class="form-control" id="custom-dish-name" name="name" required>
718
+ </div>
719
+ <div class="mb-3 position-relative">
720
+ <label for="custom-dish-description" class="form-label">Dish Description</label>
721
+ <textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
722
+ <div id="descriptionSuggestions" class="autocomplete-suggestions"></div>
723
+ </div>
724
+ <button type="submit" class="btn btn-primary">Submit</button>
725
+ </form>
726
+ </div>
727
+ {% else %}
728
+ {% for section, items in ordered_menu.items() %}
729
+ <h3>{{ section }}</h3>
730
+ <div class="row">
731
+ {% for item in items %}
732
+ <div class="col-md-6 mb-4">
733
+ <div class="card menu-card">
734
+ <picture>
735
+ <source
736
+ srcset="{{ item.Image1__c_webp if item.Image1__c_webp else item.Image1__c }} 350w,
737
+ {{ item.Image1__c_small if item.Image1__c_small else item.Image1__c }} 175w"
738
+ sizes="(max-width: 576px) 175px, 350px"
739
+ type="image/webp">
740
+ <img
741
+ src="/static/placeholder.jpg"
742
+ data-src="{{ item.Image1__c }}"
743
+ class="card-img-top menu-image"
744
+ alt="{{ item.Name }}"
745
+ width="350"
746
+ height="200"
747
+ loading="lazy"
748
+ fetchpriority="low"
749
+ decoding="async"
750
+ onerror="this.onerror=null; this.src='/static/placeholder.jpg';">
751
+ </picture>
752
+ <div class="addbutton">
753
+ <div class="card-body d-flex align-items-center justify-content-between">
754
+ <div>
755
+ <h5 class="card-title">{{ item.Name }}</h5>
756
+ <p class="card-text">${{ item.Price__c }}</p>
757
+ </div>
758
+ <div class="d-flex flex-column align-item-center justify-content-center">
759
+ <div class="button-container" data-item-name="{{ item.Name }}" data-item-price="{{ item.Price__c }}" data-item-image="{{ item.Image1__c }}" data-item-section="{{ item.Section__c }}" data-item-category="{{ selected_category }}">
760
+ {% if item.Section__c == 'Soft Drinks' %}
761
+ <button class="btn btn-primary add-to-cart-btn" onclick="handleSoftDrinkAdd(this)">ADD</button>
762
+ <div class="quantity-selector" style="display: none;">
763
+ <button class="btn btn-outline-secondary decrease-btn" onclick="decreaseQuantity(this)">-</button>
764
+ <select class="quantity-to-remove">
765
+ {% for i in range(1, 21) %}
766
+ <option value="{{ i }}">{{ i }}</option>
767
+ {% endfor %}
768
+ </select>
769
+ <span class="quantity-display">0</span>
770
+ <button class="btn btn-outline-secondary increase-btn" onclick="increaseQuantity(this)">+</button>
771
+ <select class="quantity-to-add">
772
+ {% for i in range(1, 21) %}
773
+ <option value="{{ i }}">{{ i }}</option>
774
+ {% endfor %}
775
+ </select>
776
+ </div>
777
+ {% else %}
778
+ <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
779
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
780
+ ADD
781
+ </button>
782
+ {% endif %}
783
+ {% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' and item.Section__c !='Soft Drinks' %}
784
+ <span class="customisable-text">Customisable</span>
785
+ {% endif %}
786
+ </div>
787
+ </div>
788
+ </div>
789
+ </div>
790
+ <div class="toggle-details" data-item-name="{{ item.Name }}">Show Details</div>
791
+ <div class="item-details" id="details-{{ item.Name | replace(' ', '-') }}"></div>
792
+ </div>
793
+ </div>
794
+ {% endfor %}
795
+ </div>
796
+ {% endfor %}
797
+ {% endif %}
798
+ </div>
799
+
800
+ <div class="side-cart-container">
801
+ <a href="{{ url_for('cart.cart') }}" class="side-cart-button" title="View Cart">
802
+ <i class="bi bi-cart3 cart-icon"></i>
803
+ <span class="cart-count" id="cart-count">0</span>
804
+ </a>
805
+ </div>
806
+
807
+ <form method="get" action="/menu" class="text-center mb-4" id="categoryForm">
808
+ <label class="form-label fw-bold">Select a Category:</label>
809
+ <div class="category-buttons">
810
+ {% for category in categories %}
811
+ <button type="button" class="category-button {% if selected_category == category %}selected{% endif %}" data-category="{{ category }}">{{ category }}</button>
812
+ {% endfor %}
813
+ <button type="button" class="category-button {% if selected_category == 'Customized Dish' %}selected{% endif %}" data-category="Customized Dish">Customized Dish</button>
814
+ </div>
815
+ <input type="hidden" name="category" id="selectedCategoryInput" value="{{ selected_category }}">
816
+ </form>
817
+
818
  <div class="container mt-4">
819
  {% if selected_category == "Customized Dish" %}
820
  <div id="custom-dish-form" class="mt-4">