Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +60 -63
templates/menu.html
CHANGED
|
@@ -269,52 +269,6 @@
|
|
| 269 |
justify-content: center;
|
| 270 |
margin-bottom: 5px;
|
| 271 |
}
|
| 272 |
-
.form-check {
|
| 273 |
-
display: inline-block;
|
| 274 |
-
margin-right: 5px;
|
| 275 |
-
margin-bottom: 0;
|
| 276 |
-
margin-top: 10px;
|
| 277 |
-
vertical-align: middle;
|
| 278 |
-
}
|
| 279 |
-
.form-check-inline {
|
| 280 |
-
display: inline-block;
|
| 281 |
-
margin-right: 5px;
|
| 282 |
-
}
|
| 283 |
-
.form-check-label {
|
| 284 |
-
display: inline-block;
|
| 285 |
-
font-size: 16px;
|
| 286 |
-
margin-left: 5px;
|
| 287 |
-
vertical-align: middle;
|
| 288 |
-
}
|
| 289 |
-
.custom-radio {
|
| 290 |
-
appearance: none;
|
| 291 |
-
-webkit-appearance: none;
|
| 292 |
-
-moz-appearance: none;
|
| 293 |
-
width: 20px;
|
| 294 |
-
height: 20px;
|
| 295 |
-
border: 3px solid #4CAF50;
|
| 296 |
-
border-radius: 50%;
|
| 297 |
-
margin-right: -5px;
|
| 298 |
-
outline: none;
|
| 299 |
-
cursor: pointer;
|
| 300 |
-
position: relative;
|
| 301 |
-
display: inline-block;
|
| 302 |
-
vertical-align: middle;
|
| 303 |
-
}
|
| 304 |
-
.custom-radio:checked {
|
| 305 |
-
background-color: #4CAF50;
|
| 306 |
-
border-color: #4CAF50;
|
| 307 |
-
}
|
| 308 |
-
.custom-radio:checked::after {
|
| 309 |
-
content: '';
|
| 310 |
-
position: relative;
|
| 311 |
-
top: 5px;
|
| 312 |
-
left: 5px;
|
| 313 |
-
border-radius: 50%;
|
| 314 |
-
}
|
| 315 |
-
.custom-radio:hover {
|
| 316 |
-
border-color: #388E3C;
|
| 317 |
-
}
|
| 318 |
.modal-footer {
|
| 319 |
display: flex;
|
| 320 |
align-items: center;
|
|
@@ -369,10 +323,10 @@
|
|
| 369 |
border-radius: 8px;
|
| 370 |
padding: 10px;
|
| 371 |
margin: 10px 15px;
|
| 372 |
-
display: none;
|
| 373 |
}
|
| 374 |
.item-details.show {
|
| 375 |
-
display: block;
|
| 376 |
}
|
| 377 |
.item-details h6 {
|
| 378 |
font-size: 0.9rem;
|
|
@@ -403,6 +357,32 @@
|
|
| 403 |
.toggle-details:hover {
|
| 404 |
text-decoration: underline;
|
| 405 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
</style>
|
| 407 |
</head>
|
| 408 |
<body>
|
|
@@ -424,20 +404,17 @@
|
|
| 424 |
</div>
|
| 425 |
</div>
|
| 426 |
|
| 427 |
-
|
|
|
|
| 428 |
<label class="form-label fw-bold">Select a Category:</label>
|
| 429 |
-
<div class="
|
| 430 |
{% for category in categories %}
|
| 431 |
-
<
|
| 432 |
-
{% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
|
| 433 |
-
<label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
|
| 434 |
{% endfor %}
|
|
|
|
| 435 |
</div>
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
{% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
|
| 439 |
-
<label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
|
| 440 |
-
</div>
|
| 441 |
</form>
|
| 442 |
|
| 443 |
<div class="container mt-4">
|
|
@@ -495,12 +472,8 @@
|
|
| 495 |
</div>
|
| 496 |
</div>
|
| 497 |
</div>
|
| 498 |
-
<!-- Toggle Link for Details -->
|
| 499 |
<div class="toggle-details" data-item-name="{{ item.Name }}">Show Details</div>
|
| 500 |
-
|
| 501 |
-
<div class="item-details" id="details-{{ item.Name | replace(' ', '-') }}">
|
| 502 |
-
<!-- Content will be populated by JavaScript -->
|
| 503 |
-
</div>
|
| 504 |
</div>
|
| 505 |
</div>
|
| 506 |
{% endfor %}
|
|
@@ -736,6 +709,30 @@
|
|
| 736 |
this.innerText = detailsDiv.classList.contains('show') ? 'Hide Details' : 'Show Details';
|
| 737 |
});
|
| 738 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 739 |
});
|
| 740 |
|
| 741 |
// Debounce Function for Search
|
|
|
|
| 269 |
justify-content: center;
|
| 270 |
margin-bottom: 5px;
|
| 271 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
.modal-footer {
|
| 273 |
display: flex;
|
| 274 |
align-items: center;
|
|
|
|
| 323 |
border-radius: 8px;
|
| 324 |
padding: 10px;
|
| 325 |
margin: 10px 15px;
|
| 326 |
+
display: none;
|
| 327 |
}
|
| 328 |
.item-details.show {
|
| 329 |
+
display: block;
|
| 330 |
}
|
| 331 |
.item-details h6 {
|
| 332 |
font-size: 0.9rem;
|
|
|
|
| 357 |
.toggle-details:hover {
|
| 358 |
text-decoration: underline;
|
| 359 |
}
|
| 360 |
+
/* New Styles for Category Buttons */
|
| 361 |
+
.category-buttons {
|
| 362 |
+
display: flex;
|
| 363 |
+
flex-wrap: wrap;
|
| 364 |
+
gap: 10px;
|
| 365 |
+
justify-content: center;
|
| 366 |
+
margin-top: 10px;
|
| 367 |
+
}
|
| 368 |
+
.category-button {
|
| 369 |
+
background-color: #fff;
|
| 370 |
+
border: 2px solid #0FAA39;
|
| 371 |
+
color: #0FAA39;
|
| 372 |
+
padding: 5px 15px;
|
| 373 |
+
border-radius: 20px;
|
| 374 |
+
font-size: 0.9rem;
|
| 375 |
+
cursor: pointer;
|
| 376 |
+
transition: background-color 0.3s, color 0.3s;
|
| 377 |
+
}
|
| 378 |
+
.category-button.selected {
|
| 379 |
+
background-color: #0FAA39;
|
| 380 |
+
color: #fff;
|
| 381 |
+
border-color: #0FAA39;
|
| 382 |
+
}
|
| 383 |
+
.category-button:hover {
|
| 384 |
+
background-color: #e6f4ea;
|
| 385 |
+
}
|
| 386 |
</style>
|
| 387 |
</head>
|
| 388 |
<body>
|
|
|
|
| 404 |
</div>
|
| 405 |
</div>
|
| 406 |
|
| 407 |
+
<!-- Updated Category Selection -->
|
| 408 |
+
<form method="get" action="/menu" class="text-center mb-4" id="categoryForm">
|
| 409 |
<label class="form-label fw-bold">Select a Category:</label>
|
| 410 |
+
<div class="category-buttons">
|
| 411 |
{% for category in categories %}
|
| 412 |
+
<button type="button" class="category-button {% if selected_category == category %}selected{% endif %}" data-category="{{ category }}">{{ category }}</button>
|
|
|
|
|
|
|
| 413 |
{% endfor %}
|
| 414 |
+
<button type="button" class="category-button {% if selected_category == 'Customized Dish' %}selected{% endif %}" data-category="Customized Dish">Customized Dish</button>
|
| 415 |
</div>
|
| 416 |
+
<!-- Hidden input to store the selected category -->
|
| 417 |
+
<input type="hidden" name="category" id="selectedCategoryInput" value="{{ selected_category }}">
|
|
|
|
|
|
|
|
|
|
| 418 |
</form>
|
| 419 |
|
| 420 |
<div class="container mt-4">
|
|
|
|
| 472 |
</div>
|
| 473 |
</div>
|
| 474 |
</div>
|
|
|
|
| 475 |
<div class="toggle-details" data-item-name="{{ item.Name }}">Show Details</div>
|
| 476 |
+
<div class="item-details" id="details-{{ item.Name | replace(' ', '-') }}"></div>
|
|
|
|
|
|
|
|
|
|
| 477 |
</div>
|
| 478 |
</div>
|
| 479 |
{% endfor %}
|
|
|
|
| 709 |
this.innerText = detailsDiv.classList.contains('show') ? 'Hide Details' : 'Show Details';
|
| 710 |
});
|
| 711 |
});
|
| 712 |
+
|
| 713 |
+
// Category Button Functionality
|
| 714 |
+
const categoryButtons = document.querySelectorAll('.category-button');
|
| 715 |
+
const categoryForm = document.getElementById('categoryForm');
|
| 716 |
+
const selectedCategoryInput = document.getElementById('selectedCategoryInput');
|
| 717 |
+
|
| 718 |
+
// Set default category to "All" if none is selected
|
| 719 |
+
if (!selectedCategoryInput.value) {
|
| 720 |
+
selectedCategoryInput.value = "All";
|
| 721 |
+
document.querySelector('.category-button[data-category="All"]').classList.add('selected');
|
| 722 |
+
}
|
| 723 |
+
|
| 724 |
+
categoryButtons.forEach(button => {
|
| 725 |
+
button.addEventListener('click', function () {
|
| 726 |
+
// Remove 'selected' class from all buttons
|
| 727 |
+
categoryButtons.forEach(btn => btn.classList.remove('selected'));
|
| 728 |
+
// Add 'selected' class to the clicked button
|
| 729 |
+
this.classList.add('selected');
|
| 730 |
+
// Update the hidden input value
|
| 731 |
+
selectedCategoryInput.value = this.getAttribute('data-category');
|
| 732 |
+
// Submit the form
|
| 733 |
+
categoryForm.submit();
|
| 734 |
+
});
|
| 735 |
+
});
|
| 736 |
});
|
| 737 |
|
| 738 |
// Debounce Function for Search
|