DSatishchandra commited on
Commit
53c7c69
·
verified ·
1 Parent(s): c6c5fff

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +189 -80
templates/menu.html CHANGED
@@ -10,7 +10,7 @@
10
  <style>
11
  body {
12
  font-family: Arial, sans-serif;
13
- background-color: #fdf4e3;
14
  margin: 0;
15
  padding: 0;
16
  display: flex;
@@ -45,8 +45,9 @@
45
  font-weight: bold;
46
  border-radius: 5px;
47
  width: 100px;
48
- background-color: #0FAA39;
49
  border-color: #28a745;
 
50
  }
51
  .btn-primary:hover {
52
  background-color: #0FAA39;
@@ -65,7 +66,7 @@
65
  z-index: 999;
66
  }
67
  .view-cart-button {
68
- background-color: #0FAA39;
69
  color: #fff;
70
  padding: 10px 20px;
71
  border-radius: 30px;
@@ -78,7 +79,7 @@
78
  justify-content: center;
79
  }
80
  .view-cart-button:hover {
81
- background-color: #109835;
82
  text-decoration: none;
83
  }
84
  .avatar-dropdown-container {
@@ -103,7 +104,7 @@
103
  top: 100%;
104
  background-color: #fff;
105
  border-radius: 5px;
106
- width: 200px;
107
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
108
  display: none;
109
  }
@@ -115,55 +116,126 @@
115
  text-decoration: none;
116
  color: #333;
117
  border-bottom: 1px solid #ddd;
118
- display: block;
119
  }
120
  .dropdown-menu .dropdown-item:last-child {
121
- border-bottom: none;
122
  }
123
  .dropdown-menu .dropdown-item:hover {
124
  background-color: #f1f1f1;
125
  }
126
  .fixed-search-container {
127
  position: absolute;
128
- top: 90px;
129
  left: 50%;
130
  transform: translateX(-50%);
131
  width: 80%;
132
  max-width: 600px;
133
- z-index: 999;
134
  background-color: white;
135
  padding: 10px;
136
  border-radius: 25px;
137
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
138
  }
139
  .container {
140
- margin-top: 180px;
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  .addon-section {
143
- background-color: #f8f9fa;
144
- border: 2px solid #ff6b35;
145
  border-radius: 8px;
146
  padding: 12px;
147
- margin-bottom: 15px;
148
  }
 
149
  .addon-section h6 {
150
  margin-bottom: 10px;
151
  font-size: 1.1rem;
152
  font-weight: bold;
153
  color: #333;
154
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  .form-check-label {
156
  font-size: 16px;
157
- margin-left: 8px;
158
  }
159
  .custom-radio {
 
 
 
160
  width: 18px;
161
  height: 18px;
162
  border: 2px solid #333;
163
  border-radius: 50%;
164
- margin-right: 10px;
165
  outline: none;
166
  cursor: pointer;
 
167
  }
168
  .custom-radio:checked {
169
  background-color: #007bff;
@@ -179,79 +251,105 @@
179
  background-color: #fff;
180
  border-radius: 50%;
181
  }
182
- .form-check-inline {
183
- margin-right: 10px;
184
  }
185
- </style>
 
 
 
 
 
186
  </head>
187
  <body>
188
- <div class="fixed-top-bar">
189
- <div class="avatar-dropdown-container">
190
- <div class="avatar-icon">
191
- <span>{{ first_letter }}</span> <!-- First letter of user's name -->
192
- </div>
193
- <div class="dropdown-menu">
194
- <a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
195
- <a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
196
- <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
197
- </div>
198
  </div>
199
  </div>
200
 
201
- <form method="get" action="/menu" class="text-center mb-4">
202
- <label class="form-label fw-bold">Select a Category:</label>
203
- <div class="form-check form-check-inline">
204
- {% for category in categories %}
205
- <input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
206
- {% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
207
- <label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
208
- {% endfor %}
209
- </div>
210
- </form>
 
 
 
 
 
 
 
 
 
 
 
211
 
 
212
  <div class="container mt-4">
213
  <h1 class="text-center">Menu</h1>
214
- {% if selected_category == "Customized Dish" %}
215
- <div id="custom-dish-form" class="mt-4">
216
- <h3>Create Your Custom Dish</h3>
217
- <form method="POST" action="/generate_custom_dish">
218
- <div class="mb-3">
219
- <label for="custom-dish-name" class="form-label">Dish Name</label>
220
- <input type="text" class="form-control" id="custom-dish-name" name="name" required>
221
- </div>
222
- <div class="mb-3">
223
- <label for="custom-dish-description" class="form-label">Dish Description</label>
224
- <textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
225
- </div>
226
- <button type="submit" class="btn btn-primary">Submit</button>
227
- </form>
228
  </div>
229
- {% else %}
230
- {% for section, items in ordered_menu.items() %}
231
- <h3>{{ section }}</h3>
232
- <div class="row">
233
- {% for item in items %}
234
- <div class="col-md-6 mb-4">
235
- <div class="card menu-card">
236
- <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
237
- <div class="card-body">
238
- <h5 class="card-title">{{ item.Name }}</h5>
239
- <p class="card-text">${{ item.Price__c }}</p>
240
- <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
241
- onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
242
- Add
243
- </button>
244
- </div>
 
 
 
 
245
  </div>
246
  </div>
247
- {% endfor %}
248
- </div>
249
- {% endfor %}
250
- {% endif %}
 
 
 
251
  </div>
252
 
 
253
  <div class="view-cart-container">
254
- <a href="/cart" class="view-cart-button">View Cart</a>
 
 
255
  </div>
256
 
257
  <!-- Modal for Item Details -->
@@ -263,18 +361,27 @@
263
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
264
  </div>
265
  <div class="modal-body">
 
266
  <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
 
267
  <h5 id="modal-name" class="fw-bold text-center"></h5>
 
268
  <p id="modal-price" class="text-muted text-center"></p>
 
269
  <p id="modal-description" class="text-secondary"></p>
 
270
  <div id="modal-addons" class="modal-addons mt-4">
271
  <h6>Customization Options</h6>
272
  <div id="addons-list" class="addons-container">Loading customization options...</div>
273
  </div>
 
 
274
  <div class="mt-4">
275
  <h6>Custom Request</h6>
276
  <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
277
  </div>
 
 
278
  </div>
279
  <div class="modal-footer">
280
  <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
@@ -293,24 +400,30 @@
293
  document.getElementById('modal-description').innerText = description || 'No description available.';
294
  document.getElementById('addons-list').innerHTML = 'Loading customization options...';
295
  document.getElementById('modal-instructions').value = '';
 
296
  const modalSectionEl = document.getElementById('modal-section');
297
  modalSectionEl.setAttribute('data-section', section);
298
  modalSectionEl.setAttribute('data-category', selectedCategory);
 
299
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
300
  .then(response => response.json())
301
  .then(data => {
302
  const addonsList = document.getElementById('addons-list');
303
  addonsList.innerHTML = ''; // Clear previous content
 
304
  if (!data.success || !data.addons || data.addons.length === 0) {
305
  addonsList.innerHTML = '<p>No customization options available.</p>';
306
  return;
307
  }
 
308
  data.addons.forEach(addon => {
309
  const sectionDiv = document.createElement('div');
310
- sectionDiv.classList.add('addon-section');
 
311
  const title = document.createElement('h6');
312
  title.innerText = addon.name;
313
  sectionDiv.appendChild(title);
 
314
  const optionsContainer = document.createElement('div');
315
  addon.options.forEach((option, index) => {
316
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
@@ -319,9 +432,7 @@
319
  listItem.innerHTML = `
320
  <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
321
  data-name="${option}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
322
- <label class="form-check-label" for="${optionId}">
323
- ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
324
- </label>
325
  `;
326
  optionsContainer.appendChild(listItem);
327
  });
@@ -334,7 +445,7 @@
334
  document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
335
  });
336
  }
337
-
338
  function addToCartFromModal() {
339
  const itemName = document.getElementById('modal-name').innerText;
340
  let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
@@ -390,7 +501,5 @@
390
  cartIcon.innerText = cart.length;
391
  }
392
  </script>
393
-
394
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
395
  </body>
396
  </html>
 
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;
 
45
  font-weight: bold;
46
  border-radius: 5px;
47
  width: 100px;
48
+ background-color: #0FAA39; /* Updated button background color */
49
  border-color: #28a745;
50
+
51
  }
52
  .btn-primary:hover {
53
  background-color: #0FAA39;
 
66
  z-index: 999;
67
  }
68
  .view-cart-button {
69
+ background-color: #0FAA39; /* Updated View Cart button background color */
70
  color: #fff;
71
  padding: 10px 20px;
72
  border-radius: 30px;
 
79
  justify-content: center;
80
  }
81
  .view-cart-button:hover {
82
+ background-color: #109835; /* Slightly darker shade for hover effect */
83
  text-decoration: none;
84
  }
85
  .avatar-dropdown-container {
 
104
  top: 100%;
105
  background-color: #fff;
106
  border-radius: 5px;
107
+ width: 200px; /* Adjust width as needed */
108
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
109
  display: none;
110
  }
 
116
  text-decoration: none;
117
  color: #333;
118
  border-bottom: 1px solid #ddd;
119
+ display: block; /* Make each item stack vertically */
120
  }
121
  .dropdown-menu .dropdown-item:last-child {
122
+ border-bottom: none; /* Remove the bottom border from the last item */
123
  }
124
  .dropdown-menu .dropdown-item:hover {
125
  background-color: #f1f1f1;
126
  }
127
  .fixed-search-container {
128
  position: absolute;
129
+ top: 90px; /* Move it slightly lower */
130
  left: 50%;
131
  transform: translateX(-50%);
132
  width: 80%;
133
  max-width: 600px;
134
+ z-index: 999; /* Keep it above content */
135
  background-color: white;
136
  padding: 10px;
137
  border-radius: 25px;
138
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
139
  }
140
  .container {
141
+ margin-top: 180px; /* Adjust spacing based on navbar and search bar */
142
  }
143
+ .fixed-top-bar {
144
+ position: fixed;
145
+ top: 0;
146
+ left: 0;
147
+ width: 100%;
148
+ height: 54px; /* Adjust the height as needed */
149
+ z-index: 1000;
150
+ background-color: #FF6B35;
151
+ color: white;
152
+ padding: 15px;
153
+ display: flex;
154
+ justify-content: space-between;
155
+ align-items: center; /* Vertically align items */
156
+ z-index: 10000; /* Make sure it's at the top */
157
+ }
158
+ .avatar-dropdown-container {
159
+ position: absolute;
160
+ right: 20px; /* Adjust the value as needed to position it properly */
161
+ top: 50%; /* Adjust top to place it within the header */
162
+ transform: translateY(-50%); /* Correct the alignment to be perfectly centered */
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+ }
167
+ .search-bar-container {
168
+ position: absolute;
169
+ left: 20px;
170
+ top: 50%;
171
+ transform: translateY(-50%);
172
+ display: flex;
173
+ justify-content: flex-start;
174
+ align-items: center;
175
+ width: 300px; /* Adjust width as needed */
176
+ }
177
+ .search-bar-container input {
178
+ width: 100%;
179
+ padding: 8px 10px 8px 30px; /* Add padding for the icon */
180
+ font-size: 16px;
181
+ border-radius: 20px;
182
+ border: none;
183
+ }
184
+ .search-icon {
185
+ position: absolute;
186
+ left: 10px; /* Position the icon inside the input box */
187
+ font-size: 20px;
188
+ color: #888; /* Icon color */
189
+ }
190
+ /* Style for customization sections */
191
  .addon-section {
192
+ background-color: #f8f9fa; /* Light gray background */
193
+ border: 2px solid #ff6b35; /* Border color */
194
  border-radius: 8px;
195
  padding: 12px;
196
+ margin-bottom: 15px; /* Spacing between sections */
197
  }
198
+ /* Customization section title */
199
  .addon-section h6 {
200
  margin-bottom: 10px;
201
  font-size: 1.1rem;
202
  font-weight: bold;
203
  color: #333;
204
  }
205
+ /* Style for add-on checkboxes */
206
+ .addon-section .form-check {
207
+ margin-left: 10px;
208
+ }
209
+ /* Category Filter with Custom Radio Buttons */
210
+ form.text-center.mb-4 {
211
+ display: flex;
212
+ flex-direction: column;
213
+ align-items: center;
214
+ }
215
+ .form-check {
216
+ display: inline-block;
217
+ margin-right: 15px;
218
+ margin-bottom: 10px; /* Add space between buttons */
219
+ }
220
+ .form-check-inline {
221
+ margin-right: 10px;
222
+ }
223
  .form-check-label {
224
  font-size: 16px;
225
+ margin-left: 8px; /* Space between radio button and label */
226
  }
227
  .custom-radio {
228
+ appearance: none;
229
+ -webkit-appearance: none;
230
+ -moz-appearance: none;
231
  width: 18px;
232
  height: 18px;
233
  border: 2px solid #333;
234
  border-radius: 50%;
235
+ margin-right: 10px; /* Increased spacing between button and label */
236
  outline: none;
237
  cursor: pointer;
238
+ position: relative;
239
  }
240
  .custom-radio:checked {
241
  background-color: #007bff;
 
251
  background-color: #fff;
252
  border-radius: 50%;
253
  }
254
+ .custom-radio:hover {
255
+ border-color: #007bff;
256
  }
257
+ /* Optional: Style the labels */
258
+ .form-check-label {
259
+ font-size: 16px;
260
+ margin-left: 8px; /* Space between the radio button and the label */
261
+ }
262
+ </style>
263
  </head>
264
  <body>
265
+ <div class="fixed-top-bar">
266
+ <!-- Avatar and Dropdown -->
267
+ <div class="avatar-dropdown-container">
268
+ <div class="avatar-icon">
269
+ <span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
270
+ </div>
271
+ <div class="dropdown-menu">
272
+ <a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
273
+ <a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
274
+ <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
275
  </div>
276
  </div>
277
 
278
+ <!-- Search Bar Section -->
279
+ <div class="search-bar-container">
280
+ <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
281
+ <i class="bi bi-search search-icon"></i> <!-- Search icon inside the input -->
282
+ </div>
283
+ </div>
284
+
285
+ <!-- Category Filter with Custom Radio Buttons -->
286
+ <form method="get" action="/menu" class="text-center mb-4">
287
+ <label class="form-label fw-bold">Select a Category:</label>
288
+ <div class="form-check form-check-inline">
289
+ {% for category in categories %}
290
+ <input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
291
+ {% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
292
+ <label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
293
+ {% endfor %}
294
+ <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
295
+ {% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
296
+ <label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
297
+ </div>
298
+ </form>
299
 
300
+ <!-- Show menu items only when Customized Dish is not selected -->
301
  <div class="container mt-4">
302
  <h1 class="text-center">Menu</h1>
303
+
304
+ <!-- Display text boxes for Customized Dish -->
305
+ {% if selected_category == "Customized Dish" %}
306
+ <div id="custom-dish-form" class="mt-4">
307
+ <h3>Create Your Custom Dish</h3>
308
+ <form method="POST" action="/generate_custom_dish">
309
+ <div class="mb-3">
310
+ <label for="custom-dish-name" class="form-label">Dish Name</label>
311
+ <input type="text" class="form-control" id="custom-dish-name" name="name" required>
312
+ </div>
313
+ <div class="mb-3">
314
+ <label for="custom-dish-description" class="form-label">Dish Description</label>
315
+ <textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
 
316
  </div>
317
+ <button type="submit" class="btn btn-primary">Submit</button>
318
+ </form>
319
+ </div>
320
+ {% else %}
321
+
322
+ <!-- Menu Sections -->
323
+ {% for section, items in ordered_menu.items() %}
324
+ <h3>{{ section }}</h3>
325
+ <div class="row">
326
+ {% for item in items %}
327
+ <div class="col-md-6 mb-4">
328
+ <div class="card menu-card">
329
+ <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
330
+ <div class="card-body">
331
+ <h5 class="card-title">{{ item.Name }}</h5>
332
+ <p class="card-text">${{ item.Price__c }}</p>
333
+ <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
334
+ onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
335
+ Add
336
+ </button>
337
  </div>
338
  </div>
339
+ </div>
340
+ {% endfor %}
341
+ </div>
342
+ {% endfor %}
343
+ </div>
344
+ {% endif %}
345
+
346
  </div>
347
 
348
+ <!-- View Cart Button -->
349
  <div class="view-cart-container">
350
+ <a href="/cart" class="view-cart-button">
351
+ View Cart
352
+ </a>
353
  </div>
354
 
355
  <!-- Modal for Item Details -->
 
361
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
362
  </div>
363
  <div class="modal-body">
364
+ <!-- Item Image -->
365
  <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
366
+ <!-- Item Name -->
367
  <h5 id="modal-name" class="fw-bold text-center"></h5>
368
+ <!-- Item Price -->
369
  <p id="modal-price" class="text-muted text-center"></p>
370
+ <!-- Item Description -->
371
  <p id="modal-description" class="text-secondary"></p>
372
+ <!-- Add-ons -->
373
  <div id="modal-addons" class="modal-addons mt-4">
374
  <h6>Customization Options</h6>
375
  <div id="addons-list" class="addons-container">Loading customization options...</div>
376
  </div>
377
+
378
+
379
  <div class="mt-4">
380
  <h6>Custom Request</h6>
381
  <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
382
  </div>
383
+ <span id="modal-section" data-section="" data-category="" style="display: none;"></span>
384
+
385
  </div>
386
  <div class="modal-footer">
387
  <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
 
400
  document.getElementById('modal-description').innerText = description || 'No description available.';
401
  document.getElementById('addons-list').innerHTML = 'Loading customization options...';
402
  document.getElementById('modal-instructions').value = '';
403
+ // Set section and category for reference
404
  const modalSectionEl = document.getElementById('modal-section');
405
  modalSectionEl.setAttribute('data-section', section);
406
  modalSectionEl.setAttribute('data-category', selectedCategory);
407
+ // Fetch customization options based on the section
408
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
409
  .then(response => response.json())
410
  .then(data => {
411
  const addonsList = document.getElementById('addons-list');
412
  addonsList.innerHTML = ''; // Clear previous content
413
+
414
  if (!data.success || !data.addons || data.addons.length === 0) {
415
  addonsList.innerHTML = '<p>No customization options available.</p>';
416
  return;
417
  }
418
+ // Display customization options inside styled divs
419
  data.addons.forEach(addon => {
420
  const sectionDiv = document.createElement('div');
421
+ sectionDiv.classList.add('addon-section'); // Add styling class
422
+ // Add section title
423
  const title = document.createElement('h6');
424
  title.innerText = addon.name;
425
  sectionDiv.appendChild(title);
426
+ // Create options list
427
  const optionsContainer = document.createElement('div');
428
  addon.options.forEach((option, index) => {
429
  const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
 
432
  listItem.innerHTML = `
433
  <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
434
  data-name="${option}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
435
+ <label class="form-check-label" for="${optionId}">${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}</label>
 
 
436
  `;
437
  optionsContainer.appendChild(listItem);
438
  });
 
445
  document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
446
  });
447
  }
448
+
449
  function addToCartFromModal() {
450
  const itemName = document.getElementById('modal-name').innerText;
451
  let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
 
501
  cartIcon.innerText = cart.length;
502
  }
503
  </script>
 
 
504
  </body>
505
  </html>