Spaces:
Runtime error
Runtime error
Update templates/menu.html
Browse files- templates/menu.html +38 -117
templates/menu.html
CHANGED
|
@@ -875,7 +875,7 @@
|
|
| 875 |
</a>
|
| 876 |
</div>
|
| 877 |
|
| 878 |
-
|
| 879 |
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
|
| 880 |
<div class="modal-dialog modal-dialog-centered">
|
| 881 |
<div class="modal-content">
|
|
@@ -897,6 +897,10 @@
|
|
| 897 |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
| 898 |
</div>
|
| 899 |
<span id="modal-section" data-section="" data-category="" style="display: none;"></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 900 |
</div>
|
| 901 |
<div class="modal-footer d-flex align-items-center justify-content-between">
|
| 902 |
<div class="d-flex align-items-center gap-2">
|
|
@@ -939,125 +943,42 @@
|
|
| 939 |
|
| 940 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
| 941 |
<script>
|
| 942 |
-
|
| 943 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 944 |
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
{% endfor %}
|
| 951 |
-
];
|
| 952 |
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
|
| 965 |
-
|
| 966 |
-
|
| 967 |
-
|
| 968 |
|
| 969 |
-
const menuItemDetails = {
|
| 970 |
-
"Veg Manchurian": {
|
| 971 |
-
ingredients: "Cauliflower, Onion, Ginger, Garlic, Soy Sauce, Cornflour, Green Chilies, Capsicum, Spring Onion",
|
| 972 |
-
nutritionalInfo: { calories: 250, protein: 5, carbs: 35, fats: 12, fiber: 3, sugar: 2 },
|
| 973 |
-
allergens: "Soy, Gluten"
|
| 974 |
-
},
|
| 975 |
-
"Veg Biryani": {
|
| 976 |
-
ingredients: "Basmati Rice, Mixed Vegetables (Carrot, Peas, Potato, Cauliflower), Ginger, Garlic, Biryani Masala, Mint Leaves, Curd, Onion, Ghee",
|
| 977 |
-
nutritionalInfo: { calories: 300, protein: 6, carbs: 50, fats: 12, fiber: 5, sugar: 3 },
|
| 978 |
-
allergens: "Dairy"
|
| 979 |
-
},
|
| 980 |
-
"Sukka Gosht (Goat)": {
|
| 981 |
-
ingredients: "Goat Meat, Ginger-Garlic Paste, Green Chilies, Onion, Tomatoes, Garam Masala, Coriander Powder, Cumin Powder, Fresh Coriander",
|
| 982 |
-
nutritionalInfo: { calories: 450, protein: 35, carbs: 10, fats: 30, fiber: 2, sugar: 1 },
|
| 983 |
-
allergens: "None"
|
| 984 |
-
},
|
| 985 |
-
"Samosa": {
|
| 986 |
-
ingredients: "Potatoes, Peas, Onion, Ginger, Cumin Seeds, Garam Masala, Wheat Flour (for dough), Oil (for frying)",
|
| 987 |
-
nutritionalInfo: { calories: 150, protein: 3, carbs: 25, fats: 7, fiber: 2, sugar: 1 },
|
| 988 |
-
allergens: "Gluten"
|
| 989 |
-
},
|
| 990 |
-
"Roti": {
|
| 991 |
-
ingredients: "Whole Wheat Flour, Water, Salt",
|
| 992 |
-
nutritionalInfo: { calories: 150, protein: 4, carbs: 30, fats: 1, fiber: 3, sugar: 0 },
|
| 993 |
-
allergens: "Gluten"
|
| 994 |
-
},
|
| 995 |
-
"Prawn Fry": {
|
| 996 |
-
ingredients: "Prawns, Garlic, Ginger, Chili Powder, Coriander Powder, Cumin Powder, Lemon Juice, Oil",
|
| 997 |
-
nutritionalInfo: { calories: 350, protein: 25, carbs: 10, fats: 20, fiber: 1, sugar: 1 },
|
| 998 |
-
allergens: "Shellfish"
|
| 999 |
-
},
|
| 1000 |
-
"Paneer Butter Masala": {
|
| 1001 |
-
ingredients: "Paneer, Butter, Cream, Tomato Puree, Onion, Ginger, Garlic, Garam Masala",
|
| 1002 |
-
nutritionalInfo: { calories: 400, protein: 15, carbs: 20, fats: 25, fiber: 2, sugar: 3 },
|
| 1003 |
-
allergens: "Dairy"
|
| 1004 |
-
},
|
| 1005 |
-
"Paneer Biryani": {
|
| 1006 |
-
ingredients: "Paneer, Basmati Rice, Mixed Vegetables (Carrot, Peas, Potato), Onion, Tomatoes, Biryani Masala, Mint Leaves, Curd",
|
| 1007 |
-
nutritionalInfo: { calories: 350, protein: 12, carbs: 55, fats: 15, fiber: 4, sugar: 3 },
|
| 1008 |
-
allergens: "Dairy"
|
| 1009 |
-
},
|
| 1010 |
-
"Onion Pakoda": {
|
| 1011 |
-
ingredients: "Onion, Chickpea Flour (Besan), Rice Flour, Green Chilies, Cumin Seeds, Ginger, Turmeric Powder, Oil (for frying)",
|
| 1012 |
-
nutritionalInfo: { calories: 200, protein: 5, carbs: 30, fats: 8, fiber: 3, sugar: 2 },
|
| 1013 |
-
allergens: "Gluten (if cross-contamination)"
|
| 1014 |
-
},
|
| 1015 |
-
"Mutton Biryani": {
|
| 1016 |
-
ingredients: "Mutton, Basmati Rice, Onion, Tomatoes, Ginger-Garlic Paste, Biryani Masala, Mint Leaves, Yogurt, Ghee",
|
| 1017 |
-
nutritionalInfo: { calories: 500, protein: 30, carbs: 50, fats: 25, fiber: 4, sugar: 3 },
|
| 1018 |
-
allergens: "Dairy"
|
| 1019 |
-
},
|
| 1020 |
-
"Fish Curry": {
|
| 1021 |
-
ingredients: "Fish (any firm fish like Salmon or King Fish), Onion, Tomato, Ginger-Garlic Paste, Curry Leaves, Coconut Milk, Tamarind, Mustard Seeds",
|
| 1022 |
-
nutritionalInfo: { calories: 300, protein: 25, carbs: 10, fats: 20, fiber: 2, sugar: 1 },
|
| 1023 |
-
allergens: "Fish"
|
| 1024 |
-
},
|
| 1025 |
-
"Fiery Mango Glaze Chicken": {
|
| 1026 |
-
ingredients: "Chicken, Mango Puree, Chili Sauce, Soy Sauce, Honey, Garlic, Ginger, Lemon Juice",
|
| 1027 |
-
nutritionalInfo: { calories: 350, protein: 30, carbs: 15, fats: 18, fiber: 1, sugar: 5 },
|
| 1028 |
-
allergens: "Soy"
|
| 1029 |
-
},
|
| 1030 |
-
"Chilli Gobi": {
|
| 1031 |
-
ingredients: "Cauliflower, Onion, Green Chilies, Soy Sauce, Cornflour, Garlic, Ginger, Cumin Powder",
|
| 1032 |
-
nutritionalInfo: { calories: 250, protein: 6, carbs: 35, fats: 12, fiber: 3, sugar: 2 },
|
| 1033 |
-
allergens: "Soy, Gluten"
|
| 1034 |
-
},
|
| 1035 |
-
"Chilli Chicken": {
|
| 1036 |
-
ingredients: "Chicken, Bell Pepper, Onion, Green Chilies, Soy Sauce, Cornflour, Garlic, Ginger",
|
| 1037 |
-
nutritionalInfo: { calories: 400, protein: 35, carbs: 20, fats: 18, fiber: 2, sugar: 2 },
|
| 1038 |
-
allergens: "Soy, Gluten"
|
| 1039 |
-
},
|
| 1040 |
-
"Chicken Manchurian": {
|
| 1041 |
-
ingredients: "Chicken, Onion, Garlic, Ginger, Soy Sauce, Cornflour, Green Chilies, Capsicum",
|
| 1042 |
-
nutritionalInfo: { calories: 350, protein: 25, carbs: 20, fats: 18, fiber: 2, sugar: 2 },
|
| 1043 |
-
allergens: "Soy, Gluten"
|
| 1044 |
-
},
|
| 1045 |
-
"Chicken Curry": {
|
| 1046 |
-
ingredients: "Chicken, Onion, Tomatoes, Ginger-Garlic Paste, Garam Masala, Coconut Milk, Coriander Leaves",
|
| 1047 |
-
nutritionalInfo: { calories: 350, protein: 28, carbs: 15, fats: 12, fiber: 4, sugar: 2 },
|
| 1048 |
-
allergens: "None"
|
| 1049 |
-
},
|
| 1050 |
-
"Chicken Biryani": {
|
| 1051 |
-
ingredients: "Chicken, Basmati Rice, Onion, Tomatoes, Ginger-Garlic Paste, Biryani Masala, Mint Leaves, Curd",
|
| 1052 |
-
nutritionalInfo: { calories: 500, protein: 35, carbs: 60, fats: 20, fiber: 5, sugar: 3 },
|
| 1053 |
-
allergens: "Dairy"
|
| 1054 |
-
},
|
| 1055 |
-
"Channa Masala": {
|
| 1056 |
-
ingredients: "Chickpeas, Onion, Tomatoes, Ginger-Garlic Paste, Garam Masala, Coriander Powder, Cumin Seeds, Lemon Juice",
|
| 1057 |
-
nutritionalInfo: { calories: 250, protein: 10, carbs: 45, fats: 5, fiber: 6, sugar: 2 },
|
| 1058 |
-
allergens: "None"
|
| 1059 |
-
}
|
| 1060 |
-
};
|
| 1061 |
|
| 1062 |
function addToCartLocalStorage(payload) {
|
| 1063 |
let cart = JSON.parse(localStorage.getItem('cart')) || [];
|
|
|
|
| 875 |
</a>
|
| 876 |
</div>
|
| 877 |
|
| 878 |
+
<!-- Modal for Item Details -->
|
| 879 |
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
|
| 880 |
<div class="modal-dialog modal-dialog-centered">
|
| 881 |
<div class="modal-content">
|
|
|
|
| 897 |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
| 898 |
</div>
|
| 899 |
<span id="modal-section" data-section="" data-category="" style="display: none;"></span>
|
| 900 |
+
<!-- Nutritional Info, Ingredients, and Allergens Display -->
|
| 901 |
+
<div id="modal-ingredients" class="nutritional-info"></div>
|
| 902 |
+
<div id="modal-nutritional-info" class="nutritional-info"></div>
|
| 903 |
+
<div id="modal-allergens" class="nutritional-info"></div>
|
| 904 |
</div>
|
| 905 |
<div class="modal-footer d-flex align-items-center justify-content-between">
|
| 906 |
<div class="d-flex align-items-center gap-2">
|
|
|
|
| 943 |
|
| 944 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
| 945 |
<script>
|
| 946 |
+
// Function to update ingredients, nutritional info, and allergens dynamically
|
| 947 |
+
function showItemDetails(name, price, image, description, section, selectedCategory) {
|
| 948 |
+
document.getElementById('modal-name').innerText = name;
|
| 949 |
+
document.getElementById('modal-price').innerText = `$${price}`;
|
| 950 |
+
const modalImg = document.getElementById('modal-img');
|
| 951 |
+
modalImg.src = image || '/static/placeholder.jpg';
|
| 952 |
+
document.getElementById('modal-description').innerText = description || 'No description available.';
|
| 953 |
+
document.getElementById('addons-list').innerHTML = 'Loading customization options...';
|
| 954 |
+
document.getElementById('modal-instructions').value = '';
|
| 955 |
+
const modalSectionEl = document.getElementById('modal-section');
|
| 956 |
+
modalSectionEl.setAttribute('data-section', section);
|
| 957 |
+
modalSectionEl.setAttribute('data-category', selectedCategory);
|
| 958 |
+
document.getElementById('quantityInput').value = 1;
|
| 959 |
|
| 960 |
+
fetch(`/api/menu-item-details?item_name=${encodeURIComponent(name)}§ion=${encodeURIComponent(section)}`)
|
| 961 |
+
.then(response => response.json())
|
| 962 |
+
.then(data => {
|
| 963 |
+
if (data.success) {
|
| 964 |
+
const itemDetails = data.itemDetails;
|
|
|
|
|
|
|
| 965 |
|
| 966 |
+
// Update Ingredients, Nutritional Info, and Allergens dynamically
|
| 967 |
+
document.getElementById('modal-ingredients').innerHTML = `<h6>Ingredients:</h6><p>${itemDetails.ingredients || 'Not Available'}</p>`;
|
| 968 |
+
document.getElementById('modal-nutritional-info').innerHTML = `
|
| 969 |
+
<h6>Nutritional Info:</h6>
|
| 970 |
+
<p>Calories: ${itemDetails.nutritionalInfo.calories || 'Not Available'}</p>
|
| 971 |
+
<p>Carbs: ${itemDetails.nutritionalInfo.carbs || 'Not Available'}</p>
|
| 972 |
+
<p>Protein: ${itemDetails.nutritionalInfo.protein || 'Not Available'}</p>
|
| 973 |
+
<p>Fats: ${itemDetails.nutritionalInfo.fats || 'Not Available'}</p>`;
|
| 974 |
+
document.getElementById('modal-allergens').innerHTML = `<h6>Allergens:</h6><p>${itemDetails.allergens || 'Not Available'}</p>`;
|
| 975 |
+
}
|
| 976 |
+
})
|
| 977 |
+
.catch(err => {
|
| 978 |
+
console.error('Error fetching item details:', err);
|
| 979 |
+
});
|
| 980 |
+
}
|
| 981 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 982 |
|
| 983 |
function addToCartLocalStorage(payload) {
|
| 984 |
let cart = JSON.parse(localStorage.getItem('cart')) || [];
|