Update templates/menu.html
Browse files- templates/menu.html +44 -3
templates/menu.html
CHANGED
@@ -959,7 +959,7 @@
|
|
959 |
ADD
|
960 |
</button>
|
961 |
{% endif %}
|
962 |
-
{% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' and item.Section__c !='Soft Drinks' %}
|
963 |
<span class="customisable-text">Customisable</span>
|
964 |
{% endif %}
|
965 |
</div>
|
@@ -1534,7 +1534,6 @@
|
|
1534 |
alert('Please fill in both the dish name and description.');
|
1535 |
return;
|
1536 |
}
|
1537 |
-
// Optional: Add AJAX submission to provide feedback
|
1538 |
event.preventDefault();
|
1539 |
fetch('/customdish/generate_custom_dish', {
|
1540 |
method: 'POST',
|
@@ -1853,4 +1852,46 @@
|
|
1853 |
itemImage: itemImage,
|
1854 |
section: section,
|
1855 |
category: selectedCategory,
|
1856 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
959 |
ADD
|
960 |
</button>
|
961 |
{% endif %}
|
962 |
+
{% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' and item.Section__c != 'Soft Drinks' %}
|
963 |
<span class="customisable-text">Customisable</span>
|
964 |
{% endif %}
|
965 |
</div>
|
|
|
1534 |
alert('Please fill in both the dish name and description.');
|
1535 |
return;
|
1536 |
}
|
|
|
1537 |
event.preventDefault();
|
1538 |
fetch('/customdish/generate_custom_dish', {
|
1539 |
method: 'POST',
|
|
|
1852 |
itemImage: itemImage,
|
1853 |
section: section,
|
1854 |
category: selectedCategory,
|
1855 |
+
addons: selectedAddOns,
|
1856 |
+
instructions: instructions,
|
1857 |
+
quantity: quantity
|
1858 |
+
};
|
1859 |
+
|
1860 |
+
fetch('/cart/add', {
|
1861 |
+
method: 'POST',
|
1862 |
+
headers: {
|
1863 |
+
'Content-Type': 'application/json',
|
1864 |
+
},
|
1865 |
+
body: JSON.stringify(cartPayload)
|
1866 |
+
})
|
1867 |
+
.then(response => response.json())
|
1868 |
+
.then(data => {
|
1869 |
+
if (data.success) {
|
1870 |
+
alert('Item added to cart successfully!');
|
1871 |
+
updateCartUI(data.cart);
|
1872 |
+
const modal = document.getElementById('itemModal');
|
1873 |
+
const modalInstance = bootstrap.Modal.getInstance(modal);
|
1874 |
+
modalInstance.hide();
|
1875 |
+
} else {
|
1876 |
+
console.error('Failed to add item to cart:', data.error);
|
1877 |
+
alert(data.error || 'Failed to add item to cart.');
|
1878 |
+
const cart = addToCartLocalStorage(cartPayload);
|
1879 |
+
updateCartUI(cart);
|
1880 |
+
const modal = document.getElementById('itemModal');
|
1881 |
+
const modalInstance = bootstrap.Modal.getInstance(modal);
|
1882 |
+
modalInstance.hide();
|
1883 |
+
}
|
1884 |
+
})
|
1885 |
+
.catch(err => {
|
1886 |
+
console.error('Error adding item to cart:', err);
|
1887 |
+
alert('Error adding item to cart. Using local storage as fallback.');
|
1888 |
+
const cart = addToCartLocalStorage(cartPayload);
|
1889 |
+
updateCartUI(cart);
|
1890 |
+
const modal = document.getElementById('itemModal');
|
1891 |
+
const modalInstance = bootstrap.Modal.getInstance(modal);
|
1892 |
+
modalInstance.hide();
|
1893 |
+
});
|
1894 |
+
}
|
1895 |
+
</script>
|
1896 |
+
</body>
|
1897 |
+
</html>
|