Spaces:
Runtime error
Runtime error
Update templates/menu.html
Browse files- templates/menu.html +22 -26
templates/menu.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
| 19 |
|
| 20 |
.container {
|
| 21 |
max-width: 900px;
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
.menu-card {
|
|
@@ -47,12 +48,12 @@
|
|
| 47 |
}
|
| 48 |
|
| 49 |
.btn-primary {
|
| 50 |
-
font-size:
|
| 51 |
font-weight: bold;
|
| 52 |
border-radius: 5px;
|
| 53 |
width: 100px;
|
| 54 |
background-color: #0FAA39; /* Updated button background color */
|
| 55 |
-
border-color: #
|
| 56 |
}
|
| 57 |
|
| 58 |
.btn-primary:hover {
|
|
@@ -312,14 +313,16 @@ form.text-center.mb-4 {
|
|
| 312 |
font-size: 16px;
|
| 313 |
margin-left: 8px; /* Space between the radio button and the label */
|
| 314 |
}
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
-
|
| 321 |
.modal-footer .form-control {
|
| 322 |
margin-right: 10px; /* Add a little space between the quantity input and the buttons */
|
|
|
|
| 323 |
}
|
| 324 |
.cart-container {
|
| 325 |
display: flex;
|
|
@@ -330,10 +333,12 @@ form.text-center.mb-4 {
|
|
| 330 |
.quantity-box {
|
| 331 |
display: flex;
|
| 332 |
align-items: center;
|
|
|
|
| 333 |
border: 1px solid #ccc;
|
| 334 |
-
border-radius:
|
| 335 |
overflow: hidden;
|
| 336 |
height: 40px;
|
|
|
|
| 337 |
}
|
| 338 |
|
| 339 |
.quantity-box button {
|
|
@@ -342,16 +347,18 @@ form.text-center.mb-4 {
|
|
| 342 |
padding: 5px 10px;
|
| 343 |
cursor: pointer;
|
| 344 |
height: 100%;
|
|
|
|
| 345 |
}
|
| 346 |
|
| 347 |
.quantity-box input {
|
| 348 |
width: 40px;
|
| 349 |
text-align: center;
|
| 350 |
border: none;
|
| 351 |
-
font-size:
|
| 352 |
height: 100%;
|
|
|
|
|
|
|
| 353 |
}
|
| 354 |
-
|
| 355 |
.add-to-cart-btn {
|
| 356 |
background: green;
|
| 357 |
color: white;
|
|
@@ -365,8 +372,9 @@ form.text-center.mb-4 {
|
|
| 365 |
align-items: center;
|
| 366 |
justify-content: center;
|
| 367 |
white-space: nowrap;
|
|
|
|
|
|
|
| 368 |
}
|
| 369 |
-
|
| 370 |
</style>
|
| 371 |
</head>
|
| 372 |
<body>
|
|
@@ -501,9 +509,9 @@ form.text-center.mb-4 {
|
|
| 501 |
<button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
|
| 502 |
</div>
|
| 503 |
|
| 504 |
-
<div>
|
| 505 |
-
|
| 506 |
-
</div>
|
| 507 |
|
| 508 |
</div>
|
| 509 |
</div>
|
|
@@ -531,18 +539,6 @@ function updateTotalAmount(itemId) {
|
|
| 531 |
// Update the individual total amount display
|
| 532 |
document.getElementById("totalAmountDisplay-" + itemId).innerText = `$${totalAmount.toFixed(2)}`;
|
| 533 |
}
|
| 534 |
-
|
| 535 |
-
function addToCartFromModal(itemId) {
|
| 536 |
-
let quantity = parseInt(document.getElementById("quantity-" + itemId).value);
|
| 537 |
-
let itemName = document.getElementById("name-" + itemId).innerText; // Get item name dynamically
|
| 538 |
-
let price = parseFloat(document.getElementById("price-" + itemId).innerText); // Get price dynamically
|
| 539 |
-
let totalAmount = price * quantity;
|
| 540 |
-
|
| 541 |
-
// Update the "Add to Cart" button with the correct total amount
|
| 542 |
-
document.getElementById("addToCartBtn-" + itemId).innerHTML = `Add to Cart $${totalAmount.toFixed(2)}`;
|
| 543 |
-
|
| 544 |
-
alert(`Added ${quantity} x ${itemName} ($${totalAmount.toFixed(2)}) to cart!`);
|
| 545 |
-
}
|
| 546 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
| 547 |
document.getElementById('modal-name').innerText = name;
|
| 548 |
document.getElementById('modal-price').innerText = `$${price}`;
|
|
|
|
| 19 |
|
| 20 |
.container {
|
| 21 |
max-width: 900px;
|
| 22 |
+
/*margin-top: 10px; /* Adjust spacing to control space between filter and menu */
|
| 23 |
}
|
| 24 |
|
| 25 |
.menu-card {
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
.btn-primary {
|
| 51 |
+
font-size: 13px;
|
| 52 |
font-weight: bold;
|
| 53 |
border-radius: 5px;
|
| 54 |
width: 100px;
|
| 55 |
background-color: #0FAA39; /* Updated button background color */
|
| 56 |
+
border-color: #0FAA39;
|
| 57 |
}
|
| 58 |
|
| 59 |
.btn-primary:hover {
|
|
|
|
| 313 |
font-size: 16px;
|
| 314 |
margin-left: 8px; /* Space between the radio button and the label */
|
| 315 |
}
|
| 316 |
+
.modal-footer .d-flex {
|
| 317 |
+
display: flex; /* Use flexbox */
|
| 318 |
+
align-items: center; /* Vertically align the items */
|
| 319 |
+
justify-content: flex-start; /* Align at the start */
|
| 320 |
+
width: 100%;
|
| 321 |
+
padding-left: 0;
|
| 322 |
}
|
|
|
|
| 323 |
.modal-footer .form-control {
|
| 324 |
margin-right: 10px; /* Add a little space between the quantity input and the buttons */
|
| 325 |
+
align-items:top;
|
| 326 |
}
|
| 327 |
.cart-container {
|
| 328 |
display: flex;
|
|
|
|
| 333 |
.quantity-box {
|
| 334 |
display: flex;
|
| 335 |
align-items: center;
|
| 336 |
+
justify-content: space-between; /* Space between buttons and input */
|
| 337 |
border: 1px solid #ccc;
|
| 338 |
+
border-radius: 20px; /* Rounded corners */
|
| 339 |
overflow: hidden;
|
| 340 |
height: 40px;
|
| 341 |
+
width: 120px; /* Set width of the entire quantity box */
|
| 342 |
}
|
| 343 |
|
| 344 |
.quantity-box button {
|
|
|
|
| 347 |
padding: 5px 10px;
|
| 348 |
cursor: pointer;
|
| 349 |
height: 100%;
|
| 350 |
+
font-size: 18px;
|
| 351 |
}
|
| 352 |
|
| 353 |
.quantity-box input {
|
| 354 |
width: 40px;
|
| 355 |
text-align: center;
|
| 356 |
border: none;
|
| 357 |
+
font-size: 18px;
|
| 358 |
height: 100%;
|
| 359 |
+
background-color: #fff;
|
| 360 |
+
color: #333;
|
| 361 |
}
|
|
|
|
| 362 |
.add-to-cart-btn {
|
| 363 |
background: green;
|
| 364 |
color: white;
|
|
|
|
| 372 |
align-items: center;
|
| 373 |
justify-content: center;
|
| 374 |
white-space: nowrap;
|
| 375 |
+
margin-left: 10px; /* Space between quantity box and button */
|
| 376 |
+
align-self: flex-start; /* Align the button at the top */
|
| 377 |
}
|
|
|
|
| 378 |
</style>
|
| 379 |
</head>
|
| 380 |
<body>
|
|
|
|
| 509 |
<button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
|
| 510 |
</div>
|
| 511 |
|
| 512 |
+
<div class="modal-footer">
|
| 513 |
+
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
|
| 514 |
+
</div>
|
| 515 |
|
| 516 |
</div>
|
| 517 |
</div>
|
|
|
|
| 539 |
// Update the individual total amount display
|
| 540 |
document.getElementById("totalAmountDisplay-" + itemId).innerText = `$${totalAmount.toFixed(2)}`;
|
| 541 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 542 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
| 543 |
document.getElementById('modal-name').innerText = name;
|
| 544 |
document.getElementById('modal-price').innerText = `$${price}`;
|