geethareddy commited on
Commit
66321af
·
verified ·
1 Parent(s): 7536c27

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +221 -56
templates/menu.html CHANGED
@@ -10,7 +10,7 @@
10
  <style>
11
  body {
12
  font-family: Arial, sans-serif;
13
- background-color: #fdf4e3; /* Updated background color */
14
  margin: 0;
15
  padding: 0;
16
  display: flex;
@@ -27,13 +27,12 @@
27
  margin: auto;
28
  display: flex;
29
  flex-direction: column;
30
- position: relative;
31
  }
32
  .menu-image {
33
- height: 200px; /* Fixed height */
34
- width: 100%; /* Full width of the card */
35
- object-fit: fill; /* Ensure the image covers the area and maintains the aspect ratio */
36
- border-radius: 15px 15px 0 0; /* Rounded top corners */
37
  }
38
  .card-title {
39
  font-size: 1.2rem;
@@ -45,50 +44,239 @@
45
  color: #6c757d;
46
  }
47
  .customisable-text {
48
- font-size: 0.8rem; /* Smaller font size */
49
- color: #6c757d; /* Gray color */
50
- text-align: center; /* Center the text */
51
- margin-top: 5px; /* Small space above the text */
52
  }
53
  .btn-primary {
54
  font-size: 13px;
55
  font-weight: bold;
56
  border-radius: 5px;
57
  width: 100px;
58
- background-color: #0FAA39; /* Green button color */
59
  border-color: #0FAA39;
60
- text-transform: uppercase; /* Added to ensure button text is uppercase */
61
- margin-top: 10px; /* Space between the customisable text and the button */
62
- margin-left: auto; /* Align the button to the right */
63
- margin-right: auto; /* Ensure the button is centered */
 
64
  }
65
- .btn-primary:hover {
66
  background-color: #0FAA39;
67
  border-color: #0FAA39;
 
68
  }
69
- .btn-primary:active,
70
- .btn-primary:focus {
 
 
 
 
 
71
  background-color: #0FAA39;
72
- border-color: #ffffff;
73
- box-shadow: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
  .container {
76
- margin-top: 10px; /* Adjust spacing based on navbar and search bar */
77
- padding-top: 0 !important; /* Ensure no padding is added by default */
78
  }
79
  h1.text-center {
80
- margin-top: 10px; /* Reduced space above */
81
- padding-top: 0 !important; /* Removed padding */
82
- font-weight: semi-bold; /* Make the "Menu" text bold */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  }
84
  </style>
85
  </head>
86
  <body>
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  <div class="container mt-4">
89
  <h1 class="text-center">Menu</h1>
90
-
91
- <!-- Menu Sections -->
92
  {% for section, items in ordered_menu.items() %}
93
  <h3>{{ section }}</h3>
94
  <div class="row">
@@ -99,13 +287,11 @@
99
  <div class="card-body">
100
  <h5 class="card-title">{{ item.Name }}</h5>
101
  <p class="card-text">${{ item.Price__c }}</p>
102
- <!-- Customisable text below the item description -->
103
- <div class="customisable-text">Customisable</div>
104
- <!-- ADD button below the customisable text -->
105
  <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
106
- onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}', '{{ selected_category }}')">
107
  ADD
108
  </button>
 
109
  </div>
110
  </div>
111
  </div>
@@ -114,14 +300,12 @@
114
  {% endfor %}
115
  </div>
116
 
117
- <!-- View Cart Button -->
118
  <div class="view-cart-container">
119
  <a href="/cart" class="view-cart-button">
120
  View Cart
121
  </a>
122
  </div>
123
 
124
- <!-- Modal for Item Details -->
125
  <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
126
  <div class="modal-dialog modal-dialog-centered">
127
  <div class="modal-content">
@@ -130,15 +314,10 @@
130
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
131
  </div>
132
  <div class="modal-body">
133
- <!-- Item Image -->
134
  <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
135
- <!-- Item Name -->
136
  <h5 id="modal-name" class="fw-bold text-center"></h5>
137
- <!-- Item Price -->
138
  <p id="modal-price" class="text-muted text-center"></p>
139
- <!-- Item Description -->
140
  <p id="modal-description" class="text-secondary"></p>
141
- <!-- Add-ons -->
142
  <div id="modal-addons" class="modal-addons mt-4">
143
  <h6>Customization Options</h6>
144
  <div id="addons-list" class="addons-container">Loading customization options...</div>
@@ -149,24 +328,19 @@
149
  </div>
150
  <span id="modal-section" data-section="" data-category="" style="display: none;"></span>
151
  </div>
152
- <!-- Quantity Controls and Add to Cart Button -->
153
  <div class="modal-footer d-flex align-items-center justify-content-between">
154
- <!-- Quantity Controls -->
155
  <div class="d-flex align-items-center gap-2">
156
  <button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
157
  <input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/>
158
  <button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
159
  </div>
160
- <!-- Add to Cart Button -->
161
  <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
162
  </div>
163
  </div>
164
  </div>
165
  </div>
166
 
167
- <!-- JavaScript -->
168
  <script>
169
- // Show item details and fetch customization options
170
  function showItemDetails(name, price, image, description, section, selectedCategory) {
171
  document.getElementById('modal-name').innerText = name;
172
  document.getElementById('modal-price').innerText = `$${price}`;
@@ -178,33 +352,24 @@
178
  const modalSectionEl = document.getElementById('modal-section');
179
  modalSectionEl.setAttribute('data-section', section);
180
  modalSectionEl.setAttribute('data-category', selectedCategory);
181
-
182
- // Set the default quantity to 1
183
  document.getElementById('quantityInput').value = 1;
184
-
185
- // Fetch customization options based on the section
186
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
187
  .then(response => response.json())
188
  .then(data => {
189
  const addonsList = document.getElementById('addons-list');
190
- addonsList.innerHTML = ''; // Clear previous content
191
-
192
  if (!data.success || !data.addons || data.addons.length === 0) {
193
  addonsList.innerHTML = '<p>No customization options available.</p>';
194
  return;
195
  }
196
-
197
- // Display customization options inside styled divs
198
  data.addons.forEach(addon => {
199
  const sectionDiv = document.createElement('div');
200
- sectionDiv.classList.add('addon-section'); // Add styling class
201
-
202
- // Add section title
203
  const title = document.createElement('h6');
204
  title.innerText = addon.name;
205
  sectionDiv.appendChild(title);
206
-
207
- // Create options list
208
  const optionsContainer = document.createElement('div');
209
  addon.options.forEach((option, index) => {
210
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
 
10
  <style>
11
  body {
12
  font-family: Arial, sans-serif;
13
+ background-color: #fdf4e3;
14
  margin: 0;
15
  padding: 0;
16
  display: flex;
 
27
  margin: auto;
28
  display: flex;
29
  flex-direction: column;
 
30
  }
31
  .menu-image {
32
+ height: 200px;
33
+ width: 100%;
34
+ object-fit: fill;
35
+ border-radius: 15px 15px 0 0;
36
  }
37
  .card-title {
38
  font-size: 1.2rem;
 
44
  color: #6c757d;
45
  }
46
  .customisable-text {
47
+ font-size: 0.8rem;
48
+ color: #6c757d;
49
+ text-align: center;
50
+ margin-top: 5px;
51
  }
52
  .btn-primary {
53
  font-size: 13px;
54
  font-weight: bold;
55
  border-radius: 5px;
56
  width: 100px;
57
+ background-color: #0FAA39;
58
  border-color: #0FAA39;
59
+ text-transform: uppercase;
60
+ margin-top: 10px;
61
+ margin-left: auto;
62
+ margin-right: auto;
63
+ display: block; /* Ensure the button is centered */
64
  }
65
+ .btn-primary:hover, .btn-primary:active, .btn-primary:focus {
66
  background-color: #0FAA39;
67
  border-color: #0FAA39;
68
+ box-shadow: none;
69
  }
70
+ .view-cart-container {
71
+ position: fixed;
72
+ bottom: 20px;
73
+ right: 20px;
74
+ z-index: 999;
75
+ }
76
+ .view-cart-button {
77
  background-color: #0FAA39;
78
+ color: #fff;
79
+ padding: 10px 20px;
80
+ border-radius: 30px;
81
+ font-size: 1rem;
82
+ font-weight: bold;
83
+ text-decoration: none;
84
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ }
89
+ .view-cart-button:hover {
90
+ background-color: #109835;
91
+ text-decoration: none;
92
+ }
93
+ .fixed-search-container {
94
+ position: absolute;
95
+ top: 90px;
96
+ left: 50%;
97
+ transform: translateX(-50%);
98
+ width: 80%;
99
+ max-width: 600px;
100
+ z-index: 999;
101
+ background-color: white;
102
+ padding: 10px;
103
+ border-radius: 25px;
104
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
105
  }
106
  .container {
107
+ margin-top: 10px;
 
108
  }
109
  h1.text-center {
110
+ margin-top: 10px;
111
+ padding-top: 0 !important;
112
+ font-weight: semi-bold;
113
+ }
114
+ .fixed-top-bar {
115
+ position: relative;
116
+ top: 0;
117
+ left: 0;
118
+ width: 100%;
119
+ height: 54px;
120
+ background-color: #FF6B35;
121
+ color: white;
122
+ padding: 15px;
123
+ display: flex;
124
+ justify-content: space-between;
125
+ align-items: center;
126
+ z-index: 1000;
127
+ }
128
+ .search-bar-container {
129
+ padding: 10px;
130
+ position: absolute;
131
+ left: 20px;
132
+ top: 50%;
133
+ transform: translateY(-50%);
134
+ display: flex;
135
+ justify-content: flex-start;
136
+ align-items: center;
137
+ width: 300px;
138
+ }
139
+ .search-bar-container input {
140
+ width: 85%;
141
+ padding: 8px 10px 8px 30px;
142
+ font-size: 16px;
143
+ border-radius: 10px;
144
+ border: none;
145
+ }
146
+ .search-icon {
147
+ position: absolute;
148
+ left: 15px;
149
+ font-size: 20px;
150
+ color: #888;
151
+ }
152
+ .addon-section {
153
+ background-color: #fff;
154
+ border: 2px solid #6c757d;
155
+ border-radius: 8px;
156
+ padding: 12px;
157
+ margin-bottom: 10px;
158
+ }
159
+ .addon-section h6 {
160
+ margin-bottom: 10px;
161
+ font-size: 1.1rem;
162
+ font-weight: bold;
163
+ color: #343a40;
164
+ }
165
+ .addon-section .form-check {
166
+ display: inline-flex;
167
+ align-items: center;
168
+ margin-left: 10px;
169
+ color: #343a40;
170
+ }
171
+ .addon-section .form-check-input {
172
+ -webkit-appearance: none;
173
+ -moz-appearance: none;
174
+ appearance: none;
175
+ width: 20px;
176
+ height: 20px;
177
+ border: 2px solid #343a40;
178
+ border-radius: 5px;
179
+ background-color: #f0f0f0;
180
+ position: relative;
181
+ margin-right: 10px;
182
+ }
183
+ .addon-section .form-check-input:checked {
184
+ background-color: #006400;
185
+ border-color: #006400;
186
+ }
187
+ .addon-section .form-check-input:checked::before {
188
+ content: '';
189
+ font-size: 14px;
190
+ position: absolute;
191
+ top: 3px;
192
+ left: 4px;
193
+ color: white;
194
+ }
195
+ .addon-section .form-check-input:focus {
196
+ outline: none;
197
+ box-shadow: 0 0 0 2px #006400;
198
+ }
199
+ .addon-section .form-check-label {
200
+ font-size: 16px;
201
+ margin-left: 5px;
202
+ cursor: pointer;
203
+ }
204
+ .cart-container {
205
+ display: flex;
206
+ align-items: center;
207
+ gap: 10px;
208
+ }
209
+ .modal-footer {
210
+ display: flex;
211
+ align-items: center;
212
+ justify-content: space-between;
213
+ padding: 10px;
214
+ }
215
+ .modal-footer .d-flex {
216
+ display: flex;
217
+ align-items: center;
218
+ gap: 10px;
219
+ }
220
+ .modal-footer .btn {
221
+ height: 40px;
222
+ padding: 0 15px;
223
+ }
224
+ .modal-footer .form-control {
225
+ width: 50px;
226
+ height: 40px;
227
+ text-align: center;
228
+ }
229
+ .modal-footer .btn-primary {
230
+ background-color: #0FAA39;
231
+ border-color: #0FAA39;
232
+ font-weight: bold;
233
+ padding: 10px 20px;
234
+ height: 40px;
235
+ display: flex;
236
+ justify-content: center;
237
+ align-items: center;
238
+ width: auto;
239
+ }
240
+ .modal-footer .btn-outline-secondary {
241
+ height: 40px;
242
+ width: 40px;
243
+ }
244
+ @media (max-width: 576px) {
245
+ .modal-dialog {
246
+ max-width: 98%;
247
+ }
248
+ .modal-footer .btn {
249
+ height: 35px;
250
+ }
251
+ .modal-footer .form-control {
252
+ width: 40px;
253
+ height: 35px;
254
+ }
255
  }
256
  </style>
257
  </head>
258
  <body>
259
 
260
+ <div class="fixed-top-bar">
261
+ <div class="avatar-dropdown-container">
262
+ <div class="avatar-icon">
263
+ <span>{{ first_letter }}</span>
264
+ </div>
265
+ <div class="dropdown-menu">
266
+ <a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
267
+ <a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
268
+ <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
269
+ </div>
270
+ </div>
271
+
272
+ <div class="search-bar-container">
273
+ <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
274
+ <i class="bi bi-search search-icon"></i>
275
+ </div>
276
+ </div>
277
+
278
  <div class="container mt-4">
279
  <h1 class="text-center">Menu</h1>
 
 
280
  {% for section, items in ordered_menu.items() %}
281
  <h3>{{ section }}</h3>
282
  <div class="row">
 
287
  <div class="card-body">
288
  <h5 class="card-title">{{ item.Name }}</h5>
289
  <p class="card-text">${{ item.Price__c }}</p>
 
 
 
290
  <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
291
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
292
  ADD
293
  </button>
294
+ <div class="customisable-text">Customisable</div>
295
  </div>
296
  </div>
297
  </div>
 
300
  {% endfor %}
301
  </div>
302
 
 
303
  <div class="view-cart-container">
304
  <a href="/cart" class="view-cart-button">
305
  View Cart
306
  </a>
307
  </div>
308
 
 
309
  <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
310
  <div class="modal-dialog modal-dialog-centered">
311
  <div class="modal-content">
 
314
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
315
  </div>
316
  <div class="modal-body">
 
317
  <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
 
318
  <h5 id="modal-name" class="fw-bold text-center"></h5>
 
319
  <p id="modal-price" class="text-muted text-center"></p>
 
320
  <p id="modal-description" class="text-secondary"></p>
 
321
  <div id="modal-addons" class="modal-addons mt-4">
322
  <h6>Customization Options</h6>
323
  <div id="addons-list" class="addons-container">Loading customization options...</div>
 
328
  </div>
329
  <span id="modal-section" data-section="" data-category="" style="display: none;"></span>
330
  </div>
 
331
  <div class="modal-footer d-flex align-items-center justify-content-between">
 
332
  <div class="d-flex align-items-center gap-2">
333
  <button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
334
  <input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/>
335
  <button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
336
  </div>
 
337
  <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
338
  </div>
339
  </div>
340
  </div>
341
  </div>
342
 
 
343
  <script>
 
344
  function showItemDetails(name, price, image, description, section, selectedCategory) {
345
  document.getElementById('modal-name').innerText = name;
346
  document.getElementById('modal-price').innerText = `$${price}`;
 
352
  const modalSectionEl = document.getElementById('modal-section');
353
  modalSectionEl.setAttribute('data-section', section);
354
  modalSectionEl.setAttribute('data-category', selectedCategory);
 
 
355
  document.getElementById('quantityInput').value = 1;
356
+
 
357
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
358
  .then(response => response.json())
359
  .then(data => {
360
  const addonsList = document.getElementById('addons-list');
361
+ addonsList.innerHTML = '';
 
362
  if (!data.success || !data.addons || data.addons.length === 0) {
363
  addonsList.innerHTML = '<p>No customization options available.</p>';
364
  return;
365
  }
366
+
 
367
  data.addons.forEach(addon => {
368
  const sectionDiv = document.createElement('div');
369
+ sectionDiv.classList.add('addon-section');
 
 
370
  const title = document.createElement('h6');
371
  title.innerText = addon.name;
372
  sectionDiv.appendChild(title);
 
 
373
  const optionsContainer = document.createElement('div');
374
  addon.options.forEach((option, index) => {
375
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;