Spaces:
Sleeping
Sleeping
Update templates/menu.html
Browse files- templates/menu.html +2 -78
templates/menu.html
CHANGED
@@ -691,7 +691,7 @@ form-check-input addon-option{
|
|
691 |
</div>
|
692 |
|
693 |
<!-- Modal for Item Details -->
|
694 |
-
|
695 |
<div class="modal-dialog modal-dialog-centered">
|
696 |
<div class="modal-content">
|
697 |
<div class="modal-header">
|
@@ -733,13 +733,9 @@ form-check-input addon-option{
|
|
733 |
</div>
|
734 |
</div>
|
735 |
|
736 |
-
|
737 |
-
|
738 |
<!-- JavaScript -->
|
739 |
<script>
|
740 |
-
|
741 |
-
|
742 |
-
Show item details and fetch customization options
|
743 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
744 |
document.getElementById('modal-name').innerText = name;
|
745 |
document.getElementById('modal-price').innerText = `$${price}`;
|
@@ -802,78 +798,6 @@ form-check-input addon-option{
|
|
802 |
});
|
803 |
}
|
804 |
|
805 |
-
|
806 |
-
// function showItemDetails(name, price, image, description, section, selectedCategory) {
|
807 |
-
// // Set the modal details
|
808 |
-
// document.getElementById('modal-name').innerText = name || 'Unnamed Item';
|
809 |
-
// document.getElementById('modal-price').innerText = price ? `$${price}` : 'Price not available';
|
810 |
-
// document.getElementById('modal-img').src = image || '/static/placeholder.jpg'; // Placeholder image if no image is available
|
811 |
-
// document.getElementById('modal-description').innerText = description || 'No description available.';
|
812 |
-
// document.getElementById('addons-list').innerHTML = 'Loading customization options...';
|
813 |
-
// document.getElementById('modal-instructions').value = ''; // Clear any previous custom request
|
814 |
-
|
815 |
-
// // Set hidden data attributes for section and category
|
816 |
-
// const modalSectionEl = document.getElementById('modal-section');
|
817 |
-
// modalSectionEl.setAttribute('data-section', section || 'default-section');
|
818 |
-
// modalSectionEl.setAttribute('data-category', selectedCategory || 'default-category');
|
819 |
-
|
820 |
-
// // Set the default quantity to 1
|
821 |
-
// document.getElementById('quantityInput').value = 1;
|
822 |
-
|
823 |
-
// // Fetch customization options based on the section
|
824 |
-
// fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
|
825 |
-
// .then(response => response.json())
|
826 |
-
// .then(data => {
|
827 |
-
// const addonsList = document.getElementById('addons-list');
|
828 |
-
// addonsList.innerHTML = ''; // Clear previous content
|
829 |
-
|
830 |
-
// if (!data.success || !data.addons || data.addons.length === 0) {
|
831 |
-
// addonsList.innerHTML = '<p>No customization options available.</p>';
|
832 |
-
// return;
|
833 |
-
// }
|
834 |
-
|
835 |
-
// // Display customization options inside styled divs
|
836 |
-
// data.addons.forEach(addon => {
|
837 |
-
// const sectionDiv = document.createElement('div');
|
838 |
-
// sectionDiv.classList.add('addon-section'); // Add styling class
|
839 |
-
|
840 |
-
// // Add section title
|
841 |
-
// const title = document.createElement('h6');
|
842 |
-
// title.innerText = addon.name || 'Custom Add-ons';
|
843 |
-
// sectionDiv.appendChild(title);
|
844 |
-
|
845 |
-
// // Create options list
|
846 |
-
// const optionsContainer = document.createElement('div');
|
847 |
-
// addon.options.forEach((option, index) => {
|
848 |
-
// const optionId = `addon-${addon.name.replace(/\s+/g, '')}-${index}`;
|
849 |
-
// const listItem = document.createElement('div');
|
850 |
-
// listItem.classList.add('form-check');
|
851 |
-
// listItem.innerHTML = `
|
852 |
-
// <input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
|
853 |
-
// data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
|
854 |
-
// <label class="form-check-label" for="${optionId}">
|
855 |
-
// ${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
|
856 |
-
// </label>
|
857 |
-
// `;
|
858 |
-
// optionsContainer.appendChild(listItem);
|
859 |
-
// });
|
860 |
-
// sectionDiv.appendChild(optionsContainer);
|
861 |
-
// addonsList.appendChild(sectionDiv);
|
862 |
-
// });
|
863 |
-
// })
|
864 |
-
// .catch(err => {
|
865 |
-
// console.error('Error fetching add-ons:', err);
|
866 |
-
// document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
|
867 |
-
// });
|
868 |
-
// }
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
// Handle single-select/deselect logic for checkbox groups in all modals
|
878 |
document.addEventListener('click', function(event) {
|
879 |
if (event.target.classList.contains('addon-option')) {
|
|
|
691 |
</div>
|
692 |
|
693 |
<!-- Modal for Item Details -->
|
694 |
+
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
|
695 |
<div class="modal-dialog modal-dialog-centered">
|
696 |
<div class="modal-content">
|
697 |
<div class="modal-header">
|
|
|
733 |
</div>
|
734 |
</div>
|
735 |
|
|
|
|
|
736 |
<!-- JavaScript -->
|
737 |
<script>
|
738 |
+
// Show item details and fetch customization options
|
|
|
|
|
739 |
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
740 |
document.getElementById('modal-name').innerText = name;
|
741 |
document.getElementById('modal-price').innerText = `$${price}`;
|
|
|
798 |
});
|
799 |
}
|
800 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
// Handle single-select/deselect logic for checkbox groups in all modals
|
802 |
document.addEventListener('click', function(event) {
|
803 |
if (event.target.classList.contains('addon-option')) {
|