Spaces:
Runtime error
Runtime error
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Menu</title> | |
<!-- Bootstrap CSS --> | |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | |
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet"> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
background-color: #fdf4e3; | |
margin: 0; | |
padding: 0; | |
display: flex; | |
flex-direction: column; | |
} | |
.container { | |
max-width: 900px; | |
} | |
.menu-card { | |
max-width: 350px; | |
border-radius: 15px; | |
overflow: hidden; | |
background-color: #fff; | |
margin: auto; | |
display: flex; | |
flex-direction: column; | |
position: relative; | |
} | |
.menu-image { | |
height: 200px; | |
width: 100%; | |
object-fit: fill; | |
border-radius: 15px 15px 0 0; | |
} | |
.card-title { | |
font-size: 1.2rem; | |
font-weight: bold; | |
margin: 10px 0; | |
} | |
.card-text { | |
font-size: 1rem; | |
color: #6c757d; | |
} | |
.btn-primary { | |
font-size: 13px; | |
font-weight: bold; | |
border-radius: 5px; | |
width: 100px; | |
background-color: #0FAA39; | |
border-color: #0FAA39; | |
} | |
.btn-customize { | |
font-size: 13px; | |
font-weight: bold; | |
border-radius: 5px; | |
background-color: #0FAA39; | |
border-color: #0FAA39; | |
position: absolute; | |
right: 10px; /* Align the Customize button to the right */ | |
bottom: 10px; /* Place it at the bottom right corner of the image */ | |
display: inline-flex; | |
justify-content: center; | |
align-items: center; | |
padding: 5px 15px; | |
} | |
.btn-customize i { | |
margin-left: 5px; | |
} | |
.btn-primary:hover, .btn-customize:hover { | |
background-color: #0FAA39; | |
border-color: #0FAA39; | |
} | |
.view-cart-container { | |
position: fixed; | |
bottom: 20px; | |
right: 20px; | |
z-index: 999; | |
} | |
.view-cart-button { | |
background-color: #0FAA39; | |
color: #fff; | |
padding: 10px 20px; | |
border-radius: 30px; | |
font-size: 1rem; | |
font-weight: bold; | |
text-decoration: none; | |
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
.view-cart-button:hover { | |
background-color: #109835; | |
text-decoration: none; | |
} | |
</style> | |
</head> | |
<body> | |
<!-- Fixed Top Bar --> | |
<div class="fixed-top-bar"> | |
<div class="avatar-dropdown-container"> | |
<div class="avatar-icon"> | |
<span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name --> | |
</div> | |
<div class="dropdown-menu"> | |
<a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a> | |
<a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a> | |
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a> | |
</div> | |
</div> | |
<div class="search-bar-container"> | |
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()"> | |
<i class="bi bi-search search-icon"></i> | |
</div> | |
</div> | |
<!-- Category Filter --> | |
<form method="get" action="/menu" class="text-center mb-4"> | |
<label class="form-label fw-bold">Select a Category:</label> | |
<div class="form-check form-check-inline"> | |
{% for category in categories %} | |
<input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio" | |
{% if selected_category == category %}checked{% endif %} onchange="this.form.submit()"> | |
<label class="form-check-label" for="category-{{ category }}">{{ category }}</label> | |
{% endfor %} | |
</div> | |
<div class="form-check"> | |
<input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio" | |
{% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()"> | |
<label class="form-check-label" for="category-CustomizedDish">Customized Dish</label> | |
</div> | |
</form> | |
<!-- Menu Section --> | |
<div class="container mt-4"> | |
<h1 class="text-center">Menu</h1> | |
{% if selected_category == "Customized Dish" %} | |
<div id="custom-dish-form" class="mt-4"> | |
<h3>Create Your Custom Dish</h3> | |
<form method="POST" action="/generate_custom_dish"> | |
<div class="mb-3"> | |
<label for="custom-dish-name" class="form-label">Dish Name</label> | |
<input type="text" class="form-control" id="custom-dish-name" name="name" required> | |
</div> | |
<div class="mb-3"> | |
<label for="custom-dish-description" class="form-label">Dish Description</label> | |
<textarea class="form-control" id="custom-dish-description" name="description" required></textarea> | |
</div> | |
<button type="submit" class="btn btn-primary">Submit</button> | |
</form> | |
</div> | |
{% else %} | |
{% for section, items in ordered_menu.items() %} | |
<h3>{{ section }}</h3> | |
<div class="row"> | |
{% for item in items %} | |
<div class="col-md-6 mb-4"> | |
<div class="card menu-card"> | |
<img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';"> | |
<div class="card-body"> | |
<h5 class="card-title">{{ item.Name }}</h5> | |
<p class="card-text">${{ item.Price__c }}</p> | |
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal" | |
onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')"> | |
Add | |
</button> | |
<!-- Customize Button --> | |
<button class="btn btn-customize" onclick="customizeItem('{{ item.Name }}', '{{ item.Price__c }}')"> | |
<i class="bi bi-pencil-square"></i> Customize | |
</button> | |
</div> | |
</div> | |
</div> | |
{% endfor %} | |
</div> | |
{% endfor %} | |
{% endif %} | |
</div> | |
<!-- View Cart Button --> | |
<div class="view-cart-container"> | |
<a href="/cart" class="view-cart-button"> | |
View Cart | |
</a> | |
</div> | |
<!-- Modal for Item Details --> | |
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true"> | |
<div class="modal-dialog modal-dialog-centered"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h5 class="modal-title" id="itemModalLabel">Item Details</h5> | |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | |
</div> | |
<div class="modal-body"> | |
<img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;"> | |
<h5 id="modal-name" class="fw-bold text-center"></h5> | |
<p id="modal-price" class="text-muted text-center"></p> | |
<p id="modal-description" class="text-secondary"></p> | |
<div id="modal-addons" class="modal-addons mt-4"> | |
<h6>Customization Options</h6> | |
<div id="addons-list" class="addons-container">Loading customization options...</div> | |
</div> | |
<div class="mt-4"> | |
<h6>Custom Request</h6> | |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea> | |
</div> | |
<span id="modal-section" data-section="" data-category="" style="display: none;"></span> | |
</div> | |
<div class="modal-footer d-flex align-items-center justify-content-between"> | |
<div class="d-flex align-items-center gap-2"> | |
<button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button> | |
<input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/> | |
<button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button> | |
</div> | |
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
// Customize Item Action | |
function customizeItem(itemName, itemPrice) { | |
alert(`Customizing your ${itemName} for $${itemPrice}`); | |
} | |
// Handle Search Filtering (optional) | |
function filterMenu() { | |
let input = document.getElementById('searchBar').value.toLowerCase(); | |
let items = document.querySelectorAll('.menu-card'); | |
items.forEach(item => { | |
let itemName = item.querySelector('.card-title').innerText.toLowerCase(); | |
if (itemName.includes(input)) { | |
item.style.display = 'block'; | |
} else { | |
item.style.display = 'none'; | |
} | |
}); | |
} | |
</script> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | |
</body> | |
</html> | |