Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +9 -5
templates/menu.html
CHANGED
@@ -196,6 +196,8 @@
|
|
196 |
<h6>Special Instructions</h6>
|
197 |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
198 |
</div>
|
|
|
|
|
199 |
</div>
|
200 |
<div class="modal-footer">
|
201 |
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
|
@@ -215,9 +217,10 @@
|
|
215 |
document.getElementById('modal-description').innerText = description || 'No description available.';
|
216 |
document.getElementById('addons-list').innerHTML = 'Loading add-ons...';
|
217 |
document.getElementById('modal-instructions').value = '';
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
221 |
// Fetch add-ons dynamically based on item Name
|
222 |
fetch(`/api/addons?item_name=${encodeURIComponent(name)}`)
|
223 |
.then(response => response.json())
|
@@ -248,8 +251,9 @@
|
|
248 |
const itemName = document.getElementById('modal-name').innerText; // Get item name
|
249 |
const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', '')); // Get item price
|
250 |
const itemImage = document.getElementById('modal-img').src; // Get item image
|
251 |
-
const
|
252 |
-
const
|
|
|
253 |
const selectedAddOns = Array.from(
|
254 |
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
255 |
).map(addon => ({
|
|
|
196 |
<h6>Special Instructions</h6>
|
197 |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
198 |
</div>
|
199 |
+
<span id="modal-section" data-section="" data-category="" style="display: none;"></span>
|
200 |
+
|
201 |
</div>
|
202 |
<div class="modal-footer">
|
203 |
<button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
|
|
|
217 |
document.getElementById('modal-description').innerText = description || 'No description available.';
|
218 |
document.getElementById('addons-list').innerHTML = 'Loading add-ons...';
|
219 |
document.getElementById('modal-instructions').value = '';
|
220 |
+
// Correctly set data attributes for section and category
|
221 |
+
const modalSectionEl = document.getElementById('modal-section');
|
222 |
+
modalSectionEl.setAttribute('data-section', section);
|
223 |
+
modalSectionEl.setAttribute('data-category', selectedCategory);
|
224 |
// Fetch add-ons dynamically based on item Name
|
225 |
fetch(`/api/addons?item_name=${encodeURIComponent(name)}`)
|
226 |
.then(response => response.json())
|
|
|
251 |
const itemName = document.getElementById('modal-name').innerText; // Get item name
|
252 |
const itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', '')); // Get item price
|
253 |
const itemImage = document.getElementById('modal-img').src; // Get item image
|
254 |
+
const modalSectionEl = document.getElementById('modal-section');
|
255 |
+
const section = modalSectionEl.getAttribute('data-section');
|
256 |
+
const selectedCategory = modalSectionEl.getAttribute('data-category');
|
257 |
const selectedAddOns = Array.from(
|
258 |
document.querySelectorAll('#addons-list input[type="checkbox"]:checked')
|
259 |
).map(addon => ({
|