Spaces:
Runtime error
Runtime error
Update templates/menu.html
Browse files- templates/menu.html +95 -124
templates/menu.html
CHANGED
@@ -27,7 +27,6 @@
|
|
27 |
margin: auto;
|
28 |
display: flex;
|
29 |
flex-direction: column;
|
30 |
-
position: relative;
|
31 |
}
|
32 |
.menu-image {
|
33 |
height: 200px;
|
@@ -52,27 +51,27 @@
|
|
52 |
background-color: #0FAA39;
|
53 |
border-color: #0FAA39;
|
54 |
}
|
|
|
55 |
.btn-customize {
|
56 |
font-size: 13px;
|
57 |
font-weight: bold;
|
58 |
border-radius: 5px;
|
59 |
-
background-color:
|
60 |
-
border
|
61 |
-
|
62 |
-
|
63 |
-
bottom: 10px; /* Place it at the bottom right corner of the image */
|
64 |
display: inline-flex;
|
65 |
-
justify-content: center;
|
66 |
align-items: center;
|
67 |
-
|
68 |
-
}
|
69 |
-
.btn-customize i {
|
70 |
-
margin-left: 5px;
|
71 |
}
|
72 |
-
.btn-
|
73 |
background-color: #0FAA39;
|
|
|
74 |
border-color: #0FAA39;
|
75 |
}
|
|
|
|
|
|
|
76 |
.view-cart-container {
|
77 |
position: fixed;
|
78 |
bottom: 20px;
|
@@ -100,125 +99,78 @@
|
|
100 |
</head>
|
101 |
<body>
|
102 |
|
103 |
-
<!-- Fixed Top Bar -->
|
104 |
-
<div class="fixed-top-bar">
|
105 |
-
<div class="avatar-dropdown-container">
|
106 |
-
<div class="avatar-icon">
|
107 |
-
<span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
|
108 |
-
</div>
|
109 |
-
<div class="dropdown-menu">
|
110 |
-
<a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
|
111 |
-
<a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
|
112 |
-
<a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
|
113 |
-
</div>
|
114 |
-
</div>
|
115 |
-
|
116 |
-
<div class="search-bar-container">
|
117 |
-
<input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
|
118 |
-
<i class="bi bi-search search-icon"></i>
|
119 |
-
</div>
|
120 |
-
</div>
|
121 |
-
|
122 |
-
<!-- Category Filter -->
|
123 |
-
<form method="get" action="/menu" class="text-center mb-4">
|
124 |
-
<label class="form-label fw-bold">Select a Category:</label>
|
125 |
-
<div class="form-check form-check-inline">
|
126 |
-
{% for category in categories %}
|
127 |
-
<input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
|
128 |
-
{% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
|
129 |
-
<label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
|
130 |
-
{% endfor %}
|
131 |
-
</div>
|
132 |
-
<div class="form-check">
|
133 |
-
<input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
|
134 |
-
{% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
|
135 |
-
<label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
|
136 |
-
</div>
|
137 |
-
</form>
|
138 |
-
|
139 |
-
<!-- Menu Section -->
|
140 |
<div class="container mt-4">
|
141 |
<h1 class="text-center">Menu</h1>
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
<
|
147 |
-
<
|
148 |
-
|
149 |
-
<
|
|
|
|
|
|
|
|
|
|
|
150 |
</div>
|
151 |
-
|
152 |
-
<label for="custom-dish-description" class="form-label">Dish Description</label>
|
153 |
-
<textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
|
154 |
-
</div>
|
155 |
-
<button type="submit" class="btn btn-primary">Submit</button>
|
156 |
-
</form>
|
157 |
</div>
|
158 |
-
|
159 |
-
|
160 |
-
<
|
161 |
-
|
162 |
-
|
163 |
-
<
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
|
171 |
-
Add
|
172 |
-
</button>
|
173 |
-
<!-- Customize Button -->
|
174 |
-
<button class="btn btn-customize" onclick="customizeItem('{{ item.Name }}', '{{ item.Price__c }}')">
|
175 |
-
<i class="bi bi-pencil-square"></i> Customize
|
176 |
-
</button>
|
177 |
-
</div>
|
178 |
-
</div>
|
179 |
-
</div>
|
180 |
-
{% endfor %}
|
181 |
</div>
|
182 |
-
|
183 |
-
|
184 |
</div>
|
185 |
|
186 |
-
<!-- View Cart Button -->
|
187 |
<div class="view-cart-container">
|
188 |
<a href="/cart" class="view-cart-button">
|
189 |
View Cart
|
190 |
</a>
|
191 |
</div>
|
192 |
|
193 |
-
<!-- Modal
|
194 |
-
<div class="modal fade" id="
|
195 |
<div class="modal-dialog modal-dialog-centered">
|
196 |
<div class="modal-content">
|
197 |
<div class="modal-header">
|
198 |
-
<h5 class="modal-title" id="
|
199 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
200 |
</div>
|
201 |
<div class="modal-body">
|
202 |
-
<
|
203 |
-
<
|
204 |
-
<
|
205 |
-
|
206 |
-
|
207 |
-
<
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
</div>
|
214 |
-
<
|
215 |
</div>
|
216 |
-
<div class="modal-footer
|
217 |
-
<
|
218 |
-
<button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
|
219 |
-
<input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/>
|
220 |
-
<button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
|
221 |
-
</div>
|
222 |
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
|
223 |
</div>
|
224 |
</div>
|
@@ -226,23 +178,42 @@
|
|
226 |
</div>
|
227 |
|
228 |
<script>
|
229 |
-
// Customize Item
|
230 |
-
function
|
231 |
-
|
|
|
|
|
|
|
232 |
}
|
233 |
|
234 |
-
//
|
235 |
-
function
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
</script>
|
248 |
|
|
|
27 |
margin: auto;
|
28 |
display: flex;
|
29 |
flex-direction: column;
|
|
|
30 |
}
|
31 |
.menu-image {
|
32 |
height: 200px;
|
|
|
51 |
background-color: #0FAA39;
|
52 |
border-color: #0FAA39;
|
53 |
}
|
54 |
+
/* Customize button styling */
|
55 |
.btn-customize {
|
56 |
font-size: 13px;
|
57 |
font-weight: bold;
|
58 |
border-radius: 5px;
|
59 |
+
background-color: transparent;
|
60 |
+
border: 1px solid #0FAA39;
|
61 |
+
color: #0FAA39;
|
62 |
+
padding: 5px 15px;
|
|
|
63 |
display: inline-flex;
|
|
|
64 |
align-items: center;
|
65 |
+
justify-content: center;
|
|
|
|
|
|
|
66 |
}
|
67 |
+
.btn-customize:hover {
|
68 |
background-color: #0FAA39;
|
69 |
+
color: white;
|
70 |
border-color: #0FAA39;
|
71 |
}
|
72 |
+
.btn-customize .bi-chevron-right {
|
73 |
+
margin-left: 5px;
|
74 |
+
}
|
75 |
.view-cart-container {
|
76 |
position: fixed;
|
77 |
bottom: 20px;
|
|
|
99 |
</head>
|
100 |
<body>
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
<div class="container mt-4">
|
103 |
<h1 class="text-center">Menu</h1>
|
104 |
|
105 |
+
<div class="row">
|
106 |
+
<!-- Sample Item Card -->
|
107 |
+
<div class="col-md-6 mb-4">
|
108 |
+
<div class="card menu-card">
|
109 |
+
<img src="your-image-path.jpg" class="card-img-top menu-image" alt="Item Image">
|
110 |
+
<div class="card-body">
|
111 |
+
<h5 class="card-title">Chicken Sausage</h5>
|
112 |
+
<p class="card-text">Molten Cheese Indulgence with American classic herbed chicken sausage.</p>
|
113 |
+
<button class="btn btn-primary">Add</button>
|
114 |
+
<button class="btn btn-customize" onclick="openCustomizeModal('Chicken Sausage', 288)">
|
115 |
+
Customize <i class="bi bi-chevron-right"></i>
|
116 |
+
</button>
|
117 |
</div>
|
118 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
119 |
</div>
|
120 |
+
<!-- Sample Item Card -->
|
121 |
+
<div class="col-md-6 mb-4">
|
122 |
+
<div class="card menu-card">
|
123 |
+
<img src="your-image-path.jpg" class="card-img-top menu-image" alt="Item Image">
|
124 |
+
<div class="card-body">
|
125 |
+
<h5 class="card-title">Prawn Fry</h5>
|
126 |
+
<p class="card-text">Delicious prawn fry with a spicy twist.</p>
|
127 |
+
<button class="btn btn-primary">Add</button>
|
128 |
+
<button class="btn btn-customize" onclick="openCustomizeModal('Prawn Fry', 15)">
|
129 |
+
Customize <i class="bi bi-chevron-right"></i>
|
130 |
+
</button>
|
131 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
</div>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
</div>
|
136 |
|
|
|
137 |
<div class="view-cart-container">
|
138 |
<a href="/cart" class="view-cart-button">
|
139 |
View Cart
|
140 |
</a>
|
141 |
</div>
|
142 |
|
143 |
+
<!-- Customize Modal -->
|
144 |
+
<div class="modal fade" id="customizeModal" tabindex="-1" aria-labelledby="customizeModalLabel" aria-hidden="true">
|
145 |
<div class="modal-dialog modal-dialog-centered">
|
146 |
<div class="modal-content">
|
147 |
<div class="modal-header">
|
148 |
+
<h5 class="modal-title" id="customizeModalLabel">Customize Your Item</h5>
|
149 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
150 |
</div>
|
151 |
<div class="modal-body">
|
152 |
+
<h5 id="modal-item-name"></h5>
|
153 |
+
<p>Price: $<span id="modal-item-price"></span></p>
|
154 |
+
<div id="addons-list">
|
155 |
+
<!-- Addon Options will be loaded here -->
|
156 |
+
<h6>Choose Toppings:</h6>
|
157 |
+
<div class="form-check">
|
158 |
+
<input class="form-check-input" type="checkbox" value="Extra Cheese" id="addon1">
|
159 |
+
<label class="form-check-label" for="addon1">
|
160 |
+
Extra Cheese ($2)
|
161 |
+
</label>
|
162 |
+
</div>
|
163 |
+
<div class="form-check">
|
164 |
+
<input class="form-check-input" type="checkbox" value="Olives" id="addon2">
|
165 |
+
<label class="form-check-label" for="addon2">
|
166 |
+
Olives ($1)
|
167 |
+
</label>
|
168 |
+
</div>
|
169 |
</div>
|
170 |
+
<textarea class="form-control" id="special-request" placeholder="Special Instructions (Optional)"></textarea>
|
171 |
</div>
|
172 |
+
<div class="modal-footer">
|
173 |
+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
|
|
|
|
|
|
|
174 |
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
|
175 |
</div>
|
176 |
</div>
|
|
|
178 |
</div>
|
179 |
|
180 |
<script>
|
181 |
+
// Open Customize Modal with Item Details
|
182 |
+
function openCustomizeModal(itemName, itemPrice) {
|
183 |
+
document.getElementById('modal-item-name').innerText = itemName;
|
184 |
+
document.getElementById('modal-item-price').innerText = itemPrice;
|
185 |
+
const modal = new bootstrap.Modal(document.getElementById('customizeModal'));
|
186 |
+
modal.show();
|
187 |
}
|
188 |
|
189 |
+
// Add Custom Item to Cart from Modal
|
190 |
+
function addToCartFromModal() {
|
191 |
+
const itemName = document.getElementById('modal-item-name').innerText;
|
192 |
+
const itemPrice = parseFloat(document.getElementById('modal-item-price').innerText);
|
193 |
+
const specialRequest = document.getElementById('special-request').value;
|
194 |
+
|
195 |
+
let selectedAddons = [];
|
196 |
+
if (document.getElementById('addon1').checked) {
|
197 |
+
selectedAddons.push('Extra Cheese ($2)');
|
198 |
+
}
|
199 |
+
if (document.getElementById('addon2').checked) {
|
200 |
+
selectedAddons.push('Olives ($1)');
|
201 |
+
}
|
202 |
+
|
203 |
+
const cartItem = {
|
204 |
+
itemName,
|
205 |
+
itemPrice,
|
206 |
+
addons: selectedAddons,
|
207 |
+
specialRequest
|
208 |
+
};
|
209 |
+
|
210 |
+
// You can push this cartItem into your cart data (e.g., localStorage, array, etc.)
|
211 |
+
console.log(cartItem);
|
212 |
+
alert('Item added to cart successfully!');
|
213 |
+
|
214 |
+
// Close the modal
|
215 |
+
const modal = bootstrap.Modal.getInstance(document.getElementById('customizeModal'));
|
216 |
+
modal.hide();
|
217 |
}
|
218 |
</script>
|
219 |
|