Spaces:
Sleeping
Sleeping
Update templates/search.html
Browse files- templates/search.html +58 -36
templates/search.html
CHANGED
|
@@ -7,6 +7,8 @@
|
|
| 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 |
<style>
|
| 11 |
body {
|
| 12 |
font-family: Arial, sans-serif;
|
|
@@ -20,6 +22,21 @@
|
|
| 20 |
.container {
|
| 21 |
max-width: 900px;
|
| 22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
.menu-card {
|
| 24 |
max-width: 350px;
|
| 25 |
border-radius: 15px;
|
|
@@ -28,30 +45,42 @@
|
|
| 28 |
margin: auto;
|
| 29 |
display: flex;
|
| 30 |
flex-direction: column;
|
| 31 |
-
opacity: 0;
|
| 32 |
-
transition: opacity 0.3s ease-in-out;
|
| 33 |
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 34 |
cursor: pointer;
|
| 35 |
}
|
| 36 |
-
.
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
.menu-card:hover {
|
| 40 |
-
transform: scale(1.05);
|
| 41 |
-
box-shadow: 0 6px 12px rgba(0,0,0,0.2);
|
| 42 |
-
}
|
| 43 |
-
.menu-card img {
|
| 44 |
height: 200px;
|
|
|
|
|
|
|
|
|
|
| 45 |
width: 100%;
|
| 46 |
object-fit: cover;
|
| 47 |
border-radius: 15px 15px 0 0;
|
| 48 |
-
|
| 49 |
}
|
| 50 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
font-size: 1.2rem;
|
| 52 |
font-weight: 600;
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
text-align: center;
|
| 56 |
}
|
| 57 |
.menu-card .card-body .card-text.section {
|
|
@@ -308,14 +337,21 @@
|
|
| 308 |
padding: 12px 16px;
|
| 309 |
font-size: 15px;
|
| 310 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
.menu-card {
|
| 312 |
max-width: 100%;
|
| 313 |
}
|
| 314 |
-
.
|
| 315 |
height: 150px;
|
| 316 |
}
|
| 317 |
-
.
|
| 318 |
font-size: 1rem;
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
.menu-card .card-body .card-text.section {
|
| 321 |
font-size: 0.8rem;
|
|
@@ -351,8 +387,7 @@
|
|
| 351 |
<a href="{{ url_for('user_details.customer_details') }}" class="dropdown-item">View Profile</a>
|
| 352 |
<a href="{{ url_for('orderhistory.order_history') }}" class="dropdown-item">Order History</a>
|
| 353 |
<a href="{{ url_for('combined_summary.combined_summary') }}" class="dropdown-item">MY Summary</a>
|
| 354 |
-
|
| 355 |
-
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
| 356 |
</div>
|
| 357 |
</div>
|
| 358 |
<div class="search-bar-container">
|
|
@@ -363,14 +398,17 @@
|
|
| 363 |
</div>
|
| 364 |
|
| 365 |
<div class="container mt-4">
|
|
|
|
| 366 |
<div class="row" id="menuItems">
|
| 367 |
{% for section, items in ordered_menu.items() %}
|
| 368 |
{% for item in items %}
|
| 369 |
<div class="col-md-6 mb-4 menu-item" data-name="{{ item.Name | default('Unnamed Item') }}" data-section="{{ item.Section__c | default(section) }}">
|
| 370 |
<div class="card menu-card" onclick="selectItem('{{ item.Name | default('Unnamed Item') }}', '{{ item.Section__c | default(section) }}')">
|
| 371 |
-
<
|
| 372 |
-
|
| 373 |
<h5 class="card-title">{{ item.Name | default('Unnamed Item') }}</h5>
|
|
|
|
|
|
|
| 374 |
<p class="card-text section">{{ item.Section__c | default(section) }}</p>
|
| 375 |
</div>
|
| 376 |
</div>
|
|
@@ -503,22 +541,6 @@
|
|
| 503 |
micIcon.style.display = 'none';
|
| 504 |
}
|
| 505 |
|
| 506 |
-
// Lazy Loading for Cards
|
| 507 |
-
const menuCards = document.querySelectorAll('.menu-card');
|
| 508 |
-
const cardObserver = new IntersectionObserver((entries, observer) => {
|
| 509 |
-
entries.forEach(entry => {
|
| 510 |
-
if (entry.isIntersecting) {
|
| 511 |
-
entry.target.classList.add('visible');
|
| 512 |
-
observer.unobserve(entry.target);
|
| 513 |
-
}
|
| 514 |
-
});
|
| 515 |
-
}, {
|
| 516 |
-
root: null,
|
| 517 |
-
rootMargin: '0px',
|
| 518 |
-
threshold: 0.1
|
| 519 |
-
});
|
| 520 |
-
menuCards.forEach(card => cardObserver.observe(card));
|
| 521 |
-
|
| 522 |
// Fetch Cart
|
| 523 |
fetch('/cart/get')
|
| 524 |
.then(response => {
|
|
|
|
| 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 |
<style>
|
| 13 |
body {
|
| 14 |
font-family: Arial, sans-serif;
|
|
|
|
| 22 |
.container {
|
| 23 |
max-width: 900px;
|
| 24 |
}
|
| 25 |
+
.menu-heading {
|
| 26 |
+
font-size: 2rem;
|
| 27 |
+
font-weight: 700;
|
| 28 |
+
color: #fff;
|
| 29 |
+
text-align: center;
|
| 30 |
+
padding: 15px 20px;
|
| 31 |
+
margin: 20px 0;
|
| 32 |
+
background: linear-gradient(45deg, #FFA07A, #FFB347);
|
| 33 |
+
border-radius: 10px;
|
| 34 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 35 |
+
width: 100%;
|
| 36 |
+
max-width: 900px;
|
| 37 |
+
margin-left: auto;
|
| 38 |
+
margin-right: auto;
|
| 39 |
+
}
|
| 40 |
.menu-card {
|
| 41 |
max-width: 350px;
|
| 42 |
border-radius: 15px;
|
|
|
|
| 45 |
margin: auto;
|
| 46 |
display: flex;
|
| 47 |
flex-direction: column;
|
|
|
|
|
|
|
| 48 |
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 49 |
cursor: pointer;
|
| 50 |
}
|
| 51 |
+
.card-img-container {
|
| 52 |
+
position: relative;
|
| 53 |
+
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
height: 200px;
|
| 55 |
+
}
|
| 56 |
+
.card-img {
|
| 57 |
+
height: 100%;
|
| 58 |
width: 100%;
|
| 59 |
object-fit: cover;
|
| 60 |
border-radius: 15px 15px 0 0;
|
| 61 |
+
display: block; /* Prevents gaps or flashes */
|
| 62 |
}
|
| 63 |
+
.card-title {
|
| 64 |
+
position: absolute;
|
| 65 |
+
top: 10px;
|
| 66 |
+
left: 50%;
|
| 67 |
+
transform: translateX(-50%);
|
| 68 |
font-size: 1.2rem;
|
| 69 |
font-weight: 600;
|
| 70 |
+
color: #fff;
|
| 71 |
+
text-align: center;
|
| 72 |
+
margin: 0;
|
| 73 |
+
padding: 5px 10px;
|
| 74 |
+
background-color: rgba(0, 0, 0, 0.5);
|
| 75 |
+
border-radius: 5px;
|
| 76 |
+
width: 90%;
|
| 77 |
+
white-space: nowrap;
|
| 78 |
+
overflow: hidden;
|
| 79 |
+
text-overflow: ellipsis;
|
| 80 |
+
z-index: 1;
|
| 81 |
+
}
|
| 82 |
+
.menu-card .card-body {
|
| 83 |
+
padding: 10px;
|
| 84 |
text-align: center;
|
| 85 |
}
|
| 86 |
.menu-card .card-body .card-text.section {
|
|
|
|
| 337 |
padding: 12px 16px;
|
| 338 |
font-size: 15px;
|
| 339 |
}
|
| 340 |
+
.menu-heading {
|
| 341 |
+
font-size: 1.5rem;
|
| 342 |
+
padding: 10px 15px;
|
| 343 |
+
margin: 15px 0;
|
| 344 |
+
}
|
| 345 |
.menu-card {
|
| 346 |
max-width: 100%;
|
| 347 |
}
|
| 348 |
+
.card-img-container {
|
| 349 |
height: 150px;
|
| 350 |
}
|
| 351 |
+
.card-title {
|
| 352 |
font-size: 1rem;
|
| 353 |
+
top: 8px;
|
| 354 |
+
padding: 4px 8px;
|
| 355 |
}
|
| 356 |
.menu-card .card-body .card-text.section {
|
| 357 |
font-size: 0.8rem;
|
|
|
|
| 387 |
<a href="{{ url_for('user_details.customer_details') }}" class="dropdown-item">View Profile</a>
|
| 388 |
<a href="{{ url_for('orderhistory.order_history') }}" class="dropdown-item">Order History</a>
|
| 389 |
<a href="{{ url_for('combined_summary.combined_summary') }}" class="dropdown-item">MY Summary</a>
|
| 390 |
+
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
|
|
|
| 391 |
</div>
|
| 392 |
</div>
|
| 393 |
<div class="search-bar-container">
|
|
|
|
| 398 |
</div>
|
| 399 |
|
| 400 |
<div class="container mt-4">
|
| 401 |
+
<h1 class="menu-heading">Search Menu Items</h1>
|
| 402 |
<div class="row" id="menuItems">
|
| 403 |
{% for section, items in ordered_menu.items() %}
|
| 404 |
{% for item in items %}
|
| 405 |
<div class="col-md-6 mb-4 menu-item" data-name="{{ item.Name | default('Unnamed Item') }}" data-section="{{ item.Section__c | default(section) }}">
|
| 406 |
<div class="card menu-card" onclick="selectItem('{{ item.Name | default('Unnamed Item') }}', '{{ item.Section__c | default(section) }}')">
|
| 407 |
+
<div class="card-img-container">
|
| 408 |
+
<img src="{{ item.Image1__c | default('/static/placeholder.jpg') }}" alt="{{ item.Name | default('Unnamed Item') }}" class="card-img" loading="eager" decoding="async" width="350" height="200">
|
| 409 |
<h5 class="card-title">{{ item.Name | default('Unnamed Item') }}</h5>
|
| 410 |
+
</div>
|
| 411 |
+
<div class="card-body">
|
| 412 |
<p class="card-text section">{{ item.Section__c | default(section) }}</p>
|
| 413 |
</div>
|
| 414 |
</div>
|
|
|
|
| 541 |
micIcon.style.display = 'none';
|
| 542 |
}
|
| 543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
// Fetch Cart
|
| 545 |
fetch('/cart/get')
|
| 546 |
.then(response => {
|