Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +27 -559
templates/menu.html
CHANGED
@@ -57,6 +57,9 @@
|
|
57 |
background-color: #0FAA39; /* Green button color */
|
58 |
border-color: #0FAA39;
|
59 |
text-transform: uppercase; /* Added to ensure button text is uppercase */
|
|
|
|
|
|
|
60 |
}
|
61 |
.btn-primary:hover {
|
62 |
background-color: #0FAA39;
|
@@ -91,76 +94,6 @@
|
|
91 |
background-color: #109835; /* Slightly darker shade for hover effect */
|
92 |
text-decoration: none;
|
93 |
}
|
94 |
-
.avatar-dropdown-container {
|
95 |
-
position: relative;
|
96 |
-
}
|
97 |
-
.avatar-icon {
|
98 |
-
width: 40px;
|
99 |
-
height: 40px;
|
100 |
-
border-radius: 50%;
|
101 |
-
background-color: #5bbfc1;
|
102 |
-
cursor: pointer;
|
103 |
-
display: flex;
|
104 |
-
align-items: center;
|
105 |
-
justify-content: center;
|
106 |
-
color: white;
|
107 |
-
font-size: 20px;
|
108 |
-
font-weight: bold;
|
109 |
-
}
|
110 |
-
.dropdown-menu {
|
111 |
-
position: absolute;
|
112 |
-
right: 0;
|
113 |
-
top: 100%;
|
114 |
-
background-color: #fff;
|
115 |
-
border-radius: 5px;
|
116 |
-
width: 200px; /* Adjust width as needed */
|
117 |
-
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
118 |
-
display: none;
|
119 |
-
}
|
120 |
-
.avatar-dropdown-container:hover .dropdown-menu {
|
121 |
-
display: block;
|
122 |
-
}
|
123 |
-
.avatar-dropdown-container {
|
124 |
-
position: absolute;
|
125 |
-
right: 20px; /* Adjust the value as needed to position it properly */
|
126 |
-
top: 50%; /* Adjust top to place it within the header */
|
127 |
-
transform: translateY(-50%); /* Correct the alignment to be perfectly centered */
|
128 |
-
display: flex;
|
129 |
-
align-items: right;
|
130 |
-
justify-content: center;
|
131 |
-
}
|
132 |
-
.dropdown-menu .dropdown-item {
|
133 |
-
padding: 10px 15px;
|
134 |
-
text-decoration: none;
|
135 |
-
color: #333;
|
136 |
-
border-bottom: 1px solid #ddd;
|
137 |
-
display: block; /* Make each item stack vertically */
|
138 |
-
}
|
139 |
-
.dropdown-menu .dropdown-item:last-child {
|
140 |
-
border-bottom: none; /* Remove the bottom border from the last item */
|
141 |
-
}
|
142 |
-
.dropdown-menu .dropdown-item:hover {
|
143 |
-
background-color: #f1f1f1;
|
144 |
-
}
|
145 |
-
.fixed-search-container {
|
146 |
-
position: absolute;
|
147 |
-
top: 90px; /* Move it slightly lower */
|
148 |
-
left: 50%;
|
149 |
-
transform: translateX(-50%);
|
150 |
-
width: 80%;
|
151 |
-
max-width: 600px;
|
152 |
-
z-index: 999; /* Keep it above content */
|
153 |
-
background-color: white;
|
154 |
-
padding: 10px;
|
155 |
-
border-radius: 25px;
|
156 |
-
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
157 |
-
}
|
158 |
-
/* Ensure the category filter dropdown does not overlap */
|
159 |
-
form.text-center.mb-4 {
|
160 |
-
margin-top: 10px; /* No margin at the top */
|
161 |
-
margin-bottom: 0px; /* Small space at the bottom */
|
162 |
-
}
|
163 |
-
/* Ensure the container has enough margin so nothing is overlapped */
|
164 |
.container {
|
165 |
margin-top: 10px; /* Adjust spacing based on navbar and search bar */
|
166 |
padding-top: 0 !important; /* Ensure no padding is added by default */
|
@@ -170,322 +103,37 @@
|
|
170 |
padding-top: 0 !important; /* Removed padding */
|
171 |
font-weight: semi-bold; /* Make the "Menu" text bold */
|
172 |
}
|
173 |
-
.fixed-top-bar {
|
174 |
-
/* Remove the fixed positioning */
|
175 |
-
position: relative; /* Change from fixed to relative */
|
176 |
-
top: 0;
|
177 |
-
left: 0;
|
178 |
-
width: 100%;
|
179 |
-
height: 54px;
|
180 |
-
background-color: #FF6B35;
|
181 |
-
color: white;
|
182 |
-
padding: 15px;
|
183 |
-
display: flex;
|
184 |
-
justify-content: space-between;
|
185 |
-
align-items: center; /* Vertically align items */
|
186 |
-
z-index: 1000; /* Make sure it's still above other content */
|
187 |
-
}
|
188 |
-
.search-bar-container {
|
189 |
-
padding: 10px;
|
190 |
-
position: absolute;
|
191 |
-
left: 20px;
|
192 |
-
top: 50%;
|
193 |
-
transform: translateY(-50%);
|
194 |
-
display: flex;
|
195 |
-
justify-content: flex-start;
|
196 |
-
align-items: center;
|
197 |
-
width: 300px; /* Adjust width as needed */
|
198 |
-
}
|
199 |
-
.search-bar-container input {
|
200 |
-
width: 85%;
|
201 |
-
padding: 8px 10px 8px 30px; /* Add padding for the icon */
|
202 |
-
font-size: 16px;
|
203 |
-
border-radius: 10px;
|
204 |
-
border: none;
|
205 |
-
}
|
206 |
-
.search-icon {
|
207 |
-
position: absolute;
|
208 |
-
left: 15px; /* Position the icon inside the input box */
|
209 |
-
font-size: 20px;
|
210 |
-
color: #888; /* Icon color */
|
211 |
-
}
|
212 |
-
/* Style for customization sections */
|
213 |
-
.addon-section {
|
214 |
-
background-color: #fff; /* Light gray background */
|
215 |
-
border: 2px solid #6c757d; /* Border color */
|
216 |
-
border-radius: 8px;
|
217 |
-
padding: 12px;
|
218 |
-
margin-bottom: 10px; /* Spacing between sections */
|
219 |
-
}
|
220 |
-
/* Customization section title */
|
221 |
-
.addon-section h6 {
|
222 |
-
margin-bottom: 10px;
|
223 |
-
font-size: 1.1rem;
|
224 |
-
font-weight: bold;
|
225 |
-
color: #343a40; /* Darker title text */
|
226 |
-
}
|
227 |
-
/* Style for add-on checkboxes */
|
228 |
-
.addon-section .form-check {
|
229 |
-
display: inline-flex; /* Display checkboxes horizontally */
|
230 |
-
align-items: center; /* Align checkboxes and labels */
|
231 |
-
margin-left: 10px; /* Space between checkboxes */
|
232 |
-
color: #343a40; /* Darker text color */
|
233 |
-
}
|
234 |
-
/* Customize the default checkbox */
|
235 |
-
.addon-section .form-check-input {
|
236 |
-
-webkit-appearance: none; /* Remove default checkbox styling in Webkit browsers (e.g. Chrome, Safari) */
|
237 |
-
-moz-appearance: none; /* Remove default checkbox styling in Firefox */
|
238 |
-
appearance: none; /* Remove default checkbox styling in all browsers */
|
239 |
-
width: 20px;
|
240 |
-
height: 20px;
|
241 |
-
border: 2px solid #343a40; /* Darker border color */
|
242 |
-
border-radius: 5px; /* Rounded corners */
|
243 |
-
background-color: #f0f0f0; /* Lighter gray background when unchecked */
|
244 |
-
position: relative;
|
245 |
-
margin-right: 10px; /* Add space between the checkbox and label */
|
246 |
-
}
|
247 |
-
/* Checked state for the custom checkbox */
|
248 |
-
.addon-section .form-check-input:checked {
|
249 |
-
background-color: #006400; /* Dark green background when checked */
|
250 |
-
border-color: #006400; /* Dark green border when checked */
|
251 |
-
}
|
252 |
-
/* Add the check mark when checkbox is checked */
|
253 |
-
.addon-section .form-check-input:checked::before {
|
254 |
-
content: ''; /* Unicode check mark */
|
255 |
-
font-size: 14px;
|
256 |
-
position: absolute;
|
257 |
-
top: 3px;
|
258 |
-
left: 4px;
|
259 |
-
color: white; /* White color for the check mark */
|
260 |
-
}
|
261 |
-
/* Hover effect for the checkboxes */
|
262 |
-
.addon-section .form-check-input:hover {
|
263 |
-
/* background-color: #006400; /* Slightly darker background on hover */
|
264 |
-
}
|
265 |
-
/* Focus effect on custom checkbox */
|
266 |
-
.addon-section .form-check-input:focus {
|
267 |
-
outline: none;
|
268 |
-
box-shadow: 0 0 0 2px #006400; /* Green focus outline */
|
269 |
-
}
|
270 |
-
/* Custom checkbox label styles */
|
271 |
-
.addon-section .form-check-label {
|
272 |
-
font-size: 16px;
|
273 |
-
margin-left: 5px;
|
274 |
-
cursor: pointer;
|
275 |
-
display: inline-block; /* Ensure label aligns correctly with checkbox */
|
276 |
-
vertical-align: middle; /* Align text vertically with the checkbox */
|
277 |
-
}
|
278 |
-
/* Fix alignment of text and checkbox */
|
279 |
-
.addon-section .form-check input[type="checkbox"],
|
280 |
-
.addon-section .form-check label {
|
281 |
-
display: inline-block;
|
282 |
-
/* vertical-align: middle; /* Align text and checkboxes vertically */
|
283 |
-
}
|
284 |
-
/* Category Filter with Custom Radio Buttons */
|
285 |
-
form.text-center.mb-4 {
|
286 |
-
display: flex;
|
287 |
-
flex-direction: column;
|
288 |
-
align-items: center;
|
289 |
-
justify-content: center;
|
290 |
-
margin-bottom: 5px; /* Reduce bottom margin */
|
291 |
-
}
|
292 |
-
.form-check {
|
293 |
-
display: inline-block;
|
294 |
-
margin-right: 5px; /* Reduced space between radio button and label */
|
295 |
-
margin-bottom: 0; /* Remove bottom margin */
|
296 |
-
margin-top: 10px; /* Adds space between categories and Customized Dish */
|
297 |
-
vertical-align: middle; /* Align radio buttons vertically */
|
298 |
-
}
|
299 |
-
.form-check-inline {
|
300 |
-
display: inline-block;
|
301 |
-
margin-right: 5px; /* Decrease space between each radio button */
|
302 |
-
}
|
303 |
-
.form-check-label {
|
304 |
-
display: inline-block;
|
305 |
-
font-size: 16px;
|
306 |
-
margin-left: 5px; /* Spacing between radio button and label */
|
307 |
-
vertical-align: middle; /* Align label vertically */
|
308 |
-
}
|
309 |
-
form-check-input addon-option {
|
310 |
-
color: #333d47;
|
311 |
-
}
|
312 |
-
.custom-radio {
|
313 |
-
appearance: none;
|
314 |
-
-webkit-appearance: none;
|
315 |
-
-moz-appearance: none;
|
316 |
-
width: 20px;
|
317 |
-
height: 20px;
|
318 |
-
border: 3px solid #4CAF50; /* Green border */
|
319 |
-
border-radius: 50%;
|
320 |
-
margin-right: -5px; /* Reduced spacing between button and label */
|
321 |
-
outline: none;
|
322 |
-
cursor: pointer;
|
323 |
-
position: relative;
|
324 |
-
display: inline-block;
|
325 |
-
vertical-align: middle; /* Align vertically with text */
|
326 |
-
}
|
327 |
-
.custom-radio:checked {
|
328 |
-
background-color: #4CAF50; /* Green color when checked */
|
329 |
-
border-color: #4CAF50; /* Matching border color */
|
330 |
-
}
|
331 |
-
.custom-radio:checked::after {
|
332 |
-
content: '';
|
333 |
-
position: relative;
|
334 |
-
top: 5px;
|
335 |
-
left: 5px;
|
336 |
-
border-radius: 50%;
|
337 |
-
}
|
338 |
-
.custom-radio:hover {
|
339 |
-
border-color: #388E3C;
|
340 |
-
}
|
341 |
-
/* Optional: Style the labels */
|
342 |
-
.form-check-label {
|
343 |
-
font-size: 16px;
|
344 |
-
margin-left: 8px; /* Space between the radio button and the label */
|
345 |
-
}
|
346 |
-
.cart-container {
|
347 |
-
display: flex;
|
348 |
-
align-items: center;
|
349 |
-
gap: 10px;
|
350 |
-
}
|
351 |
-
.modal-footer {
|
352 |
-
display: flex;
|
353 |
-
align-items: center;
|
354 |
-
justify-content: space-between; /* Space between quantity and Add to Cart button */
|
355 |
-
padding: 10px;
|
356 |
-
}
|
357 |
-
.modal-footer .d-flex {
|
358 |
-
display: flex;
|
359 |
-
align-items: center;
|
360 |
-
gap: 10px; /* Space between quantity buttons */
|
361 |
-
}
|
362 |
-
.modal-footer .btn {
|
363 |
-
height: 40px; /* Set consistent button height */
|
364 |
-
padding: 0 15px; /* Adjust padding to fit inside the buttons */
|
365 |
-
}
|
366 |
-
.modal-footer .form-control {
|
367 |
-
width: 50px; /* Fixed width for quantity input */
|
368 |
-
height: 40px; /* Match the height of buttons */
|
369 |
-
text-align: center; /* Center the value inside the input */
|
370 |
-
}
|
371 |
-
.modal-footer .btn-primary {
|
372 |
-
background-color: #0FAA39; /* Green background for Add to Cart button */
|
373 |
-
border-color: #0FAA39; /* Border color to match button background */
|
374 |
-
font-weight: bold; /* Bold text */
|
375 |
-
padding: 10px 20px; /* Adjust padding to make the button look better */
|
376 |
-
height: 40px; /* Match the height with quantity buttons */
|
377 |
-
display: flex;
|
378 |
-
justify-content: center;
|
379 |
-
align-items: center;
|
380 |
-
width: auto; /* Auto width to adjust to button text */
|
381 |
-
}
|
382 |
-
.modal-footer .btn-outline-secondary {
|
383 |
-
height: 40px; /* Ensure quantity buttons are the same size */
|
384 |
-
width: 40px; /* Make sure the buttons are square */
|
385 |
-
}
|
386 |
-
@media (max-width: 576px) {
|
387 |
-
/* Responsive adjustments for smaller screens */
|
388 |
-
.modal-dialog {
|
389 |
-
max-width: 98%; /* Adjust modal width for smaller screens */
|
390 |
-
}
|
391 |
-
.modal-footer .btn {
|
392 |
-
height: 35px; /* Smaller buttons for small screens */
|
393 |
-
}
|
394 |
-
.modal-footer .form-control {
|
395 |
-
width: 40px; /* Adjust input size for smaller screens */
|
396 |
-
height: 35px;
|
397 |
-
}
|
398 |
-
}
|
399 |
</style>
|
400 |
</head>
|
401 |
<body>
|
402 |
|
403 |
-
<div class="fixed-top-bar">
|
404 |
-
<!-- Avatar and Dropdown -->
|
405 |
-
<div class="avatar-dropdown-container">
|
406 |
-
<div class="avatar-icon">
|
407 |
-
<span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
|
408 |
-
</div>
|
409 |
-
<div class="dropdown-menu">
|
410 |
-
<a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
|
411 |
-
<a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
|
412 |
-
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
413 |
-
</div>
|
414 |
-
</div>
|
415 |
-
|
416 |
-
<!-- Search Bar Section -->
|
417 |
-
<div class="search-bar-container">
|
418 |
-
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
|
419 |
-
<i class="bi bi-search search-icon"></i> <!-- Search icon inside the input -->
|
420 |
-
</div>
|
421 |
-
</div>
|
422 |
-
|
423 |
-
<!-- Category Filter with Custom Radio Buttons -->
|
424 |
-
<form method="get" action="/menu" class="text-center mb-4">
|
425 |
-
<label class="form-label fw-bold">Select a Category:</label>
|
426 |
-
<div class="form-check form-check-inline">
|
427 |
-
{% for category in categories %}
|
428 |
-
<input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
|
429 |
-
{% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
|
430 |
-
<label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
|
431 |
-
{% endfor %}
|
432 |
-
</div>
|
433 |
-
<!-- Separate Customized Dish radio button in a new div to align it properly -->
|
434 |
-
<div class="form-check">
|
435 |
-
<input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
|
436 |
-
{% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
|
437 |
-
<label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
|
438 |
-
</div>
|
439 |
-
</form>
|
440 |
-
|
441 |
-
<!-- Show menu items only when Customized Dish is not selected -->
|
442 |
<div class="container mt-4">
|
443 |
<h1 class="text-center">Menu</h1>
|
444 |
|
445 |
-
<!--
|
446 |
-
{%
|
447 |
-
<
|
448 |
-
|
449 |
-
|
450 |
-
<div class="mb-
|
451 |
-
<
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
<!-- Menu Sections -->
|
464 |
-
{% for section, items in ordered_menu.items() %}
|
465 |
-
<h3>{{ section }}</h3>
|
466 |
-
<div class="row">
|
467 |
-
{% for item in items %}
|
468 |
-
<div class="col-md-6 mb-4">
|
469 |
-
<div class="card menu-card">
|
470 |
-
<img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
|
471 |
-
<div class="card-body">
|
472 |
-
<h5 class="card-title">{{ item.Name }}</h5>
|
473 |
-
<p class="card-text">${{ item.Price__c }}</p>
|
474 |
-
<!-- Replaced the button with the new "ADD" button -->
|
475 |
-
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
|
476 |
-
onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
|
477 |
-
ADD
|
478 |
-
</button>
|
479 |
-
<!-- Added the Customisable text below the button -->
|
480 |
-
<div class="customisable-text">Customisable</div>
|
481 |
-
</div>
|
482 |
</div>
|
483 |
</div>
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
{% endif %}
|
489 |
</div>
|
490 |
|
491 |
<!-- View Cart Button -->
|
@@ -555,7 +203,7 @@
|
|
555 |
|
556 |
// Set the default quantity to 1
|
557 |
document.getElementById('quantityInput').value = 1;
|
558 |
-
|
559 |
// Fetch customization options based on the section
|
560 |
fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
|
561 |
.then(response => response.json())
|
@@ -625,189 +273,9 @@
|
|
625 |
});
|
626 |
}
|
627 |
}
|
628 |
-
|
629 |
-
function filterMenu() {
|
630 |
-
let input = document.getElementById('searchBar').value.toLowerCase(); // Get the value from search bar
|
631 |
-
let sections = document.querySelectorAll('h3'); // Select section headers
|
632 |
-
let items = document.querySelectorAll('.menu-card'); // Select all items
|
633 |
-
let matchedSections = new Set(); // Store matched sections
|
634 |
-
|
635 |
-
// Hide all items initially
|
636 |
-
items.forEach(item => {
|
637 |
-
let itemName = item.querySelector('.card-title').innerText.toLowerCase(); // Get item name
|
638 |
-
let itemSection = item.closest('.row').previousElementSibling.innerText.toLowerCase(); // Get section name
|
639 |
-
|
640 |
-
// If the search matches item name or section, show the item
|
641 |
-
if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
|
642 |
-
item.style.display = 'block'; // Show item if it matches search
|
643 |
-
matchedSections.add(item.closest('.row')); // Add section to matched list
|
644 |
-
} else {
|
645 |
-
item.style.display = 'none'; // Hide item if not matched
|
646 |
-
}
|
647 |
-
});
|
648 |
-
|
649 |
-
// Show or hide sections based on matched items
|
650 |
-
sections.forEach(section => {
|
651 |
-
let sectionRow = section.nextElementSibling; // The row containing items
|
652 |
-
if (matchedSections.has(sectionRow)) {
|
653 |
-
section.style.display = 'block'; // Show section header
|
654 |
-
sectionRow.style.display = 'flex'; // Show section items
|
655 |
-
} else {
|
656 |
-
section.style.display = 'none'; // Hide section header
|
657 |
-
sectionRow.style.display = 'none'; // Hide section items
|
658 |
-
}
|
659 |
-
});
|
660 |
-
}
|
661 |
-
|
662 |
-
function addToCartFromModal() {
|
663 |
-
const itemName = document.getElementById('modal-name').innerText;
|
664 |
-
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
665 |
-
|
666 |
-
// Validate item price
|
667 |
-
if (isNaN(itemPrice)) {
|
668 |
-
alert('Invalid price for the item. Please check the item details.');
|
669 |
-
return;
|
670 |
-
}
|
671 |
-
|
672 |
-
const itemImage = document.getElementById('modal-img').src;
|
673 |
-
console.log(itemName, itemPrice, itemImage); // Log values for debugging
|
674 |
-
const modalSectionEl = document.getElementById('modal-section');
|
675 |
-
const section = modalSectionEl.getAttribute('data-section');
|
676 |
-
const selectedCategory = modalSectionEl.getAttribute('data-category');
|
677 |
-
if (!itemName || !itemPrice || !section || !itemImage) {
|
678 |
-
console.error('Missing data for cart item:', { itemName, itemPrice, section, itemImage});
|
679 |
-
return;
|
680 |
-
}
|
681 |
-
|
682 |
-
// Collect selected add-ons
|
683 |
-
let selectedAddOns = Array.from(
|
684 |
-
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
685 |
-
).map(addon => ({
|
686 |
-
name: addon.getAttribute('data-name') || 'Default Name', // Fallback Name
|
687 |
-
price: parseFloat(addon.getAttribute('data-price') || 0)
|
688 |
-
}));
|
689 |
-
|
690 |
-
// Get the selected quantity
|
691 |
-
const quantity = parseInt(document.getElementById('quantityInput').value) || 1; // Default to 1 if invalid
|
692 |
-
|
693 |
-
const instructions = document.getElementById('modal-instructions').value;
|
694 |
-
|
695 |
-
// Prepare data for the cart
|
696 |
-
const cartPayload = {
|
697 |
-
itemName: itemName,
|
698 |
-
itemPrice: itemPrice,
|
699 |
-
itemImage: itemImage,
|
700 |
-
section: section,
|
701 |
-
category: selectedCategory,
|
702 |
-
addons: selectedAddOns,
|
703 |
-
instructions: instructions,
|
704 |
-
quantity: quantity // Include the quantity
|
705 |
-
};
|
706 |
-
|
707 |
-
// Send the cart data to the server
|
708 |
-
fetch('/cart/add', {
|
709 |
-
method: 'POST',
|
710 |
-
headers: {
|
711 |
-
'Content-Type': 'application/json',
|
712 |
-
},
|
713 |
-
body: JSON.stringify(cartPayload)
|
714 |
-
})
|
715 |
-
.then(response => response.json())
|
716 |
-
.then(data => {
|
717 |
-
if (data.success) {
|
718 |
-
alert('Item added to cart successfully!');
|
719 |
-
updateCartUI(data.cart); // Update cart UI after adding an item
|
720 |
-
const modal = document.getElementById('itemModal');
|
721 |
-
const modalInstance = bootstrap.Modal.getInstance(modal);
|
722 |
-
modalInstance.hide();
|
723 |
-
} else {
|
724 |
-
alert(data.error || 'Failed to add item to cart.');
|
725 |
-
}
|
726 |
-
})
|
727 |
-
.catch(err => {
|
728 |
-
console.error('Error adding item to cart:', err);
|
729 |
-
alert('An error occurred while adding the item to the cart.');
|
730 |
-
});
|
731 |
-
}
|
732 |
-
|
733 |
-
function updateCartUI(cart) {
|
734 |
-
if (!Array.isArray(cart)) {
|
735 |
-
console.error('Invalid cart data:', cart);
|
736 |
-
return;
|
737 |
-
}
|
738 |
-
const cartIcon = document.getElementById('cart-icon');
|
739 |
-
cartIcon.innerText = cart.length; // Assuming cart is an array of items
|
740 |
-
}
|
741 |
-
|
742 |
-
function updateCartDisplay(cart) {
|
743 |
-
if (!Array.isArray(cart)) {
|
744 |
-
console.error('Invalid cart data:', cart);
|
745 |
-
return;
|
746 |
-
}
|
747 |
-
// Optional: Update quantity on the cart page
|
748 |
-
const cartCountElement = document.getElementById('cart-count');
|
749 |
-
cartCountElement.innerText = cart.reduce((total, item)=> total+item.quantity,0); // Update cart item count //Sum of all quantities
|
750 |
-
|
751 |
-
// Optionally, show a small success notification that the item was added
|
752 |
-
const successNotification = document.createElement('div');
|
753 |
-
successNotification.classList.add('success-notification');
|
754 |
-
successNotification.innerText = 'Item added to cart!';
|
755 |
-
document.body.appendChild(successNotification);
|
756 |
-
setTimeout(() => {
|
757 |
-
successNotification.remove(); // Remove success notification after a few seconds
|
758 |
-
}, 2000);
|
759 |
-
}
|
760 |
-
|
761 |
-
document.addEventListener('DOMContentLoaded', function () {
|
762 |
-
// Get references to the quantity buttons and the input field
|
763 |
-
const decreaseBtn = document.getElementById('decreaseQuantity');
|
764 |
-
const increaseBtn = document.getElementById('increaseQuantity');
|
765 |
-
const quantityInput = document.getElementById('quantityInput');
|
766 |
-
|
767 |
-
// Add event listener to decrease button
|
768 |
-
decreaseBtn.addEventListener('click', function () {
|
769 |
-
let currentQuantity = parseInt(quantityInput.value);
|
770 |
-
if (currentQuantity > 1) {
|
771 |
-
currentQuantity--;
|
772 |
-
quantityInput.value = currentQuantity;
|
773 |
-
}
|
774 |
-
});
|
775 |
-
|
776 |
-
// Add event listener to increase button
|
777 |
-
increaseBtn.addEventListener('click', function () {
|
778 |
-
let currentQuantity = parseInt(quantityInput.value);
|
779 |
-
currentQuantity++;
|
780 |
-
quantityInput.value = currentQuantity;
|
781 |
-
});
|
782 |
-
});
|
783 |
-
|
784 |
-
// Function to round reward points to a single digit
|
785 |
-
function roundRewardPoints() {
|
786 |
-
// Get the reward points element
|
787 |
-
let rewardPointsElement = document.getElementById('reward-points');
|
788 |
-
|
789 |
-
// Check if the element exists in the DOM
|
790 |
-
if (rewardPointsElement) {
|
791 |
-
let rewardPointsText = rewardPointsElement.innerText.trim(); // Get and trim the value to remove any extra spaces
|
792 |
-
|
793 |
-
// Check if the innerText is a valid number
|
794 |
-
let rewardPoints = parseFloat(rewardPointsText);
|
795 |
-
|
796 |
-
// If it's a valid number, round it to 1 decimal place
|
797 |
-
if (!isNaN(rewardPoints)) {
|
798 |
-
rewardPointsElement.innerText = rewardPoints.toFixed(1); // Round to 1 decimal place
|
799 |
-
} else {
|
800 |
-
console.error("Reward points value is not a valid number:", rewardPointsText);
|
801 |
-
}
|
802 |
-
} else {
|
803 |
-
console.error("Reward points element is missing.");
|
804 |
-
}
|
805 |
-
}
|
806 |
-
// Run the function when the page loads
|
807 |
-
window.onload = roundRewardPoints;
|
808 |
</script>
|
809 |
|
810 |
<!-- Bootstrap JS -->
|
811 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
|
812 |
</body>
|
813 |
-
</html>
|
|
|
57 |
background-color: #0FAA39; /* Green button color */
|
58 |
border-color: #0FAA39;
|
59 |
text-transform: uppercase; /* Added to ensure button text is uppercase */
|
60 |
+
position: absolute; /* To position the button */
|
61 |
+
bottom: 10px; /* Bottom padding */
|
62 |
+
right: 10px; /* Right padding */
|
63 |
}
|
64 |
.btn-primary:hover {
|
65 |
background-color: #0FAA39;
|
|
|
94 |
background-color: #109835; /* Slightly darker shade for hover effect */
|
95 |
text-decoration: none;
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
.container {
|
98 |
margin-top: 10px; /* Adjust spacing based on navbar and search bar */
|
99 |
padding-top: 0 !important; /* Ensure no padding is added by default */
|
|
|
103 |
padding-top: 0 !important; /* Removed padding */
|
104 |
font-weight: semi-bold; /* Make the "Menu" text bold */
|
105 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
</style>
|
107 |
</head>
|
108 |
<body>
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
<div class="container mt-4">
|
111 |
<h1 class="text-center">Menu</h1>
|
112 |
|
113 |
+
<!-- Menu Sections -->
|
114 |
+
{% for section, items in ordered_menu.items() %}
|
115 |
+
<h3>{{ section }}</h3>
|
116 |
+
<div class="row">
|
117 |
+
{% for item in items %}
|
118 |
+
<div class="col-md-6 mb-4">
|
119 |
+
<div class="card menu-card">
|
120 |
+
<img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
|
121 |
+
<div class="card-body">
|
122 |
+
<h5 class="card-title">{{ item.Name }}</h5>
|
123 |
+
<p class="card-text">${{ item.Price__c }}</p>
|
124 |
+
<!-- Replaced the button with the new "ADD" button -->
|
125 |
+
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal"
|
126 |
+
onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}', '{{ selected_category }}')">
|
127 |
+
ADD
|
128 |
+
</button>
|
129 |
+
<!-- Added the Customisable text below the button -->
|
130 |
+
<div class="customisable-text">Customisable</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
</div>
|
132 |
</div>
|
133 |
+
</div>
|
134 |
+
{% endfor %}
|
135 |
+
</div>
|
136 |
+
{% endfor %}
|
|
|
137 |
</div>
|
138 |
|
139 |
<!-- View Cart Button -->
|
|
|
203 |
|
204 |
// Set the default quantity to 1
|
205 |
document.getElementById('quantityInput').value = 1;
|
206 |
+
|
207 |
// Fetch customization options based on the section
|
208 |
fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
|
209 |
.then(response => response.json())
|
|
|
273 |
});
|
274 |
}
|
275 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
</script>
|
277 |
|
278 |
<!-- Bootstrap JS -->
|
279 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
|
280 |
</body>
|
281 |
+
</html>
|