lokesh341 commited on
Commit
7d5d69e
·
verified ·
1 Parent(s): 721e03f

Update templates/search.html

Browse files
Files changed (1) hide show
  1. templates/search.html +59 -41
templates/search.html CHANGED
@@ -32,13 +32,13 @@
32
  }
33
  .search-bar-container {
34
  position: absolute;
35
- left: 20px;
36
  top: 50%;
37
  transform: translateY(-50%);
38
  display: flex;
39
  align-items: center;
40
  width: 300px;
41
- max-width: 90%;
42
  position: relative;
43
  }
44
  .search-bar-container input {
@@ -132,62 +132,87 @@
132
  justify-content: center;
133
  padding: 0;
134
  }
135
- /* Modal styling from menu.html */
136
- .modal-fullscreen {
137
- width: 100vw;
138
- max-width: none;
139
- height: 100%;
140
- margin: 0;
141
- }
142
- .modal-fullscreen .modal-content {
143
- height: 100%;
144
  border: none;
145
- border-radius: 0;
146
- background-color: #fdf4e3;
 
 
 
 
 
 
 
147
  }
148
- .modal-body {
149
- padding: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
150
  overflow-y: auto;
151
  }
152
- .modal-footer {
 
 
 
 
153
  padding: 15px;
154
- display: flex;
155
- justify-content: space-between;
156
- align-items: center;
157
- border-top: none;
158
  }
159
  .addon-section {
160
  background-color: #fff;
161
  border: 2px solid #ffa500;
162
  border-radius: 8px;
163
- padding: 12px;
164
- margin-bottom: 15px;
165
  }
166
  .addon-section h6 {
167
- margin-bottom: 10px;
168
- font-size: 1.1rem;
169
  font-weight: bold;
170
  color: #333;
171
  }
172
  .form-check {
173
- margin-bottom: 8px;
174
  }
175
  .form-check-input {
176
- margin-right: 10px;
177
  }
178
  .quantity-controls {
179
  display: flex;
180
  align-items: center;
181
- gap: 10px;
182
  }
183
  .quantity-controls input {
184
- width: 50px;
185
  text-align: center;
 
 
 
 
 
 
186
  }
187
  </style>
188
  </head>
189
  <body>
190
  <div class="fixed-top-bar">
 
191
  <div class="search-bar-container">
192
  <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
193
  <i class="bi bi-search search-icon"></i>
@@ -231,16 +256,16 @@
231
  </div>
232
  </div>
233
 
234
- <!-- Item Modal (Exact replica from menu.html) -->
235
  <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
236
- <div class="modal-dialog modal-fullscreen">
237
  <div class="modal-content">
238
  <div class="modal-header">
239
  <h5 class="modal-title" id="itemModalLabel">Item Details</h5>
240
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
241
  </div>
242
  <div class="modal-body">
243
- <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
244
  <h5 id="modal-name" class="fw-bold text-center"></h5>
245
  <p id="modal-price" class="text-muted text-center"></p>
246
  <p id="modal-description" class="text-secondary text-center"></p>
@@ -249,13 +274,13 @@
249
  <strong>Nutrition:</strong> <span id="modal-nutrition"></span><br>
250
  <strong>Allergens:</strong> <span id="modal-allergens"></span>
251
  </div>
252
- <div id="modal-addons" class="modal-addons mt-4">
253
  <h6 class="text-center">Customization Options</h6>
254
  <div id="addons-list" class="addons-container">Loading customization options...</div>
255
  </div>
256
- <div class="mt-4">
257
  <h6 class="text-center">Custom Request</h6>
258
- <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
259
  </div>
260
  <span id="modal-section" data-section="" data-category="" data-is-menu-item="" style="display: none;"></span>
261
  </div>
@@ -361,7 +386,6 @@
361
  quantityInput.value = currentQuantity;
362
  });
363
 
364
- // Item details and cart functionality (exact from menu.html)
365
  window.showItemDetails = function(name, price, image, description, ingredients, nutrition, allergens, section, vegNonVeg, isMenuItem) {
366
  document.getElementById('modal-name').innerText = name;
367
  document.getElementById('modal-price').innerText = `$${parseFloat(price).toFixed(2)}`;
@@ -379,7 +403,6 @@
379
  modalSectionEl.setAttribute('data-is-menu-item', isMenuItem);
380
  document.getElementById('quantityInput').value = 1;
381
 
382
- // Fetch customization options from Salesforce
383
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
384
  .then(response => response.json())
385
  .then(data => {
@@ -482,11 +505,6 @@
482
  alert('Item added to cart successfully!');
483
  const modal = bootstrap.Modal.getInstance(document.getElementById('itemModal'));
484
  modal.hide();
485
- // Update cart UI if you have a cart badge
486
- if (data.cart) {
487
- console.log('Updated cart:', data.cart);
488
- // Add cart badge update logic here if needed
489
- }
490
  } else {
491
  console.error('Failed to add item to cart:', data.error);
492
  alert(data.error || 'Failed to add item to cart.');
 
32
  }
33
  .search-bar-container {
34
  position: absolute;
35
+ left: 60px; /* Adjusted to make space for back button */
36
  top: 50%;
37
  transform: translateY(-50%);
38
  display: flex;
39
  align-items: center;
40
  width: 300px;
41
+ max-width: calc(90% - 60px); /* Adjusted for back button width */
42
  position: relative;
43
  }
44
  .search-bar-container input {
 
132
  justify-content: center;
133
  padding: 0;
134
  }
135
+ /* Back button styling */
136
+ .back-button {
137
+ position: absolute;
138
+ left: 15px;
139
+ top: 50%;
140
+ transform: translateY(-50%);
141
+ background-color: #FFA500;
142
+ color: white;
 
143
  border: none;
144
+ border-radius: 50%;
145
+ width: 30px;
146
+ height: 30px;
147
+ display: flex;
148
+ align-items: center;
149
+ justify-content: center;
150
+ font-size: 18px;
151
+ cursor: pointer;
152
+ z-index: 1001;
153
  }
154
+ /* Small modal for mobile view */
155
+ .modal-dialog-small {
156
+ max-width: 100%;
157
+ width: 90vw; /* 90% of viewport width */
158
+ margin: 0 auto;
159
+ position: fixed;
160
+ top: 50%;
161
+ left: 50%;
162
+ transform: translate(-50%, -50%);
163
+ }
164
+ .modal-content {
165
+ border-radius: 15px;
166
+ background-color: #fdf4e3;
167
+ max-height: 90vh; /* 90% of viewport height */
168
  overflow-y: auto;
169
  }
170
+ .modal-header, .modal-footer {
171
+ border: none;
172
+ padding: 10px 15px;
173
+ }
174
+ .modal-body {
175
  padding: 15px;
 
 
 
 
176
  }
177
  .addon-section {
178
  background-color: #fff;
179
  border: 2px solid #ffa500;
180
  border-radius: 8px;
181
+ padding: 10px;
182
+ margin-bottom: 10px;
183
  }
184
  .addon-section h6 {
185
+ margin-bottom: 8px;
186
+ font-size: 1rem;
187
  font-weight: bold;
188
  color: #333;
189
  }
190
  .form-check {
191
+ margin-bottom: 6px;
192
  }
193
  .form-check-input {
194
+ margin-right: 8px;
195
  }
196
  .quantity-controls {
197
  display: flex;
198
  align-items: center;
199
+ gap: 8px;
200
  }
201
  .quantity-controls input {
202
+ width: 40px;
203
  text-align: center;
204
+ font-size: 14px;
205
+ }
206
+ .modal-footer .btn-primary {
207
+ width: auto;
208
+ padding: 8px 15px;
209
+ height: 35px;
210
  }
211
  </style>
212
  </head>
213
  <body>
214
  <div class="fixed-top-bar">
215
+ <button class="back-button" onclick="window.location.href='/menu'">&lt;</button>
216
  <div class="search-bar-container">
217
  <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." autocomplete="off">
218
  <i class="bi bi-search search-icon"></i>
 
256
  </div>
257
  </div>
258
 
259
+ <!-- Item Modal (Small size for mobile view) -->
260
  <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
261
+ <div class="modal-dialog modal-dialog-small">
262
  <div class="modal-content">
263
  <div class="modal-header">
264
  <h5 class="modal-title" id="itemModalLabel">Item Details</h5>
265
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
266
  </div>
267
  <div class="modal-body">
268
+ <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 150px; object-fit: cover;">
269
  <h5 id="modal-name" class="fw-bold text-center"></h5>
270
  <p id="modal-price" class="text-muted text-center"></p>
271
  <p id="modal-description" class="text-secondary text-center"></p>
 
274
  <strong>Nutrition:</strong> <span id="modal-nutrition"></span><br>
275
  <strong>Allergens:</strong> <span id="modal-allergens"></span>
276
  </div>
277
+ <div id="modal-addons" class="modal-addons mt-3">
278
  <h6 class="text-center">Customization Options</h6>
279
  <div id="addons-list" class="addons-container">Loading customization options...</div>
280
  </div>
281
+ <div class="mt-3">
282
  <h6 class="text-center">Custom Request</h6>
283
+ <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..." rows="2"></textarea>
284
  </div>
285
  <span id="modal-section" data-section="" data-category="" data-is-menu-item="" style="display: none;"></span>
286
  </div>
 
386
  quantityInput.value = currentQuantity;
387
  });
388
 
 
389
  window.showItemDetails = function(name, price, image, description, ingredients, nutrition, allergens, section, vegNonVeg, isMenuItem) {
390
  document.getElementById('modal-name').innerText = name;
391
  document.getElementById('modal-price').innerText = `$${parseFloat(price).toFixed(2)}`;
 
403
  modalSectionEl.setAttribute('data-is-menu-item', isMenuItem);
404
  document.getElementById('quantityInput').value = 1;
405
 
 
406
  fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
407
  .then(response => response.json())
408
  .then(data => {
 
505
  alert('Item added to cart successfully!');
506
  const modal = bootstrap.Modal.getInstance(document.getElementById('itemModal'));
507
  modal.hide();
 
 
 
 
 
508
  } else {
509
  console.error('Failed to add item to cart:', data.error);
510
  alert(data.error || 'Failed to add item to cart.');