nagasurendra commited on
Commit
3e71efa
·
verified ·
1 Parent(s): 7ff7aed

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. 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
- document.getElementById('modal-section').innerText = section || 'No section available'; // Show section
219
- document.getElementById('modal-section').setAttribute('data-section', section);
220
- document.getElementById('modal-section').setAttribute('data-category', selectedCategory);
 
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 section = document.getElementById('modal-section').getAttribute('data-section');
252
- const selectedCategory = document.getElementById('modal-section').getAttribute('data-category');
 
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 => ({