Update templates/menu.html
Browse files- templates/menu.html +13 -164
templates/menu.html
CHANGED
|
@@ -95,14 +95,6 @@
|
|
| 95 |
justify-content: center;
|
| 96 |
gap: 6px;
|
| 97 |
}
|
| 98 |
-
.customisable-text {
|
| 99 |
-
color: #0FAA39;
|
| 100 |
-
font-size: 10px;
|
| 101 |
-
font-weight: 500;
|
| 102 |
-
margin: 0;
|
| 103 |
-
text-align: center;
|
| 104 |
-
line-height: 1;
|
| 105 |
-
}
|
| 106 |
.btn-primary {
|
| 107 |
font-size: 12px;
|
| 108 |
font-weight: bold;
|
|
@@ -233,70 +225,6 @@
|
|
| 233 |
.mic-icon.active {
|
| 234 |
color: #007bff;
|
| 235 |
}
|
| 236 |
-
.addon-section {
|
| 237 |
-
background-color: #fff;
|
| 238 |
-
border: 2px solid #ffa500;
|
| 239 |
-
border-radius: 8px;
|
| 240 |
-
padding: 12px;
|
| 241 |
-
margin-bottom: 10px;
|
| 242 |
-
}
|
| 243 |
-
.addon-section h6 {
|
| 244 |
-
margin-bottom: 10px;
|
| 245 |
-
font-size: 1.1rem;
|
| 246 |
-
font-weight: bold;
|
| 247 |
-
color: #343a40;
|
| 248 |
-
}
|
| 249 |
-
.addon-section .form-check {
|
| 250 |
-
display: inline-flex;
|
| 251 |
-
align-items: center;
|
| 252 |
-
margin-left: 10px;
|
| 253 |
-
color: #343a40;
|
| 254 |
-
}
|
| 255 |
-
.addon-section .form-check-input {
|
| 256 |
-
-webkit-appearance: none;
|
| 257 |
-
-moz-appearance: none;
|
| 258 |
-
appearance: none;
|
| 259 |
-
width: 20px;
|
| 260 |
-
height: 20px;
|
| 261 |
-
border: 2px solid #343a40;
|
| 262 |
-
border-radius: 5px;
|
| 263 |
-
background-color: #f0f0f0;
|
| 264 |
-
position: relative;
|
| 265 |
-
margin-right: 10px;
|
| 266 |
-
}
|
| 267 |
-
.addon-section .form-check-input[type="radio"] {
|
| 268 |
-
border-radius: 50%;
|
| 269 |
-
}
|
| 270 |
-
.addon-section .form-check-input:checked {
|
| 271 |
-
background-color: #006400;
|
| 272 |
-
border-color: #006400;
|
| 273 |
-
}
|
| 274 |
-
.addon-section .form-check-input:checked::before {
|
| 275 |
-
content: '\2713';
|
| 276 |
-
font-size: 14px;
|
| 277 |
-
position: absolute;
|
| 278 |
-
top: 3px;
|
| 279 |
-
left: 4px;
|
| 280 |
-
color: white;
|
| 281 |
-
}
|
| 282 |
-
.addon-section .form-check-input[type="radio"]:checked::before {
|
| 283 |
-
content: '';
|
| 284 |
-
width: 12px;
|
| 285 |
-
height: 12px;
|
| 286 |
-
border-radius: 50%;
|
| 287 |
-
background-color: #006400;
|
| 288 |
-
position: absolute;
|
| 289 |
-
top: 4px;
|
| 290 |
-
left: 4px;
|
| 291 |
-
}
|
| 292 |
-
.addon-section .form-check-label {
|
| 293 |
-
font-size: 16px;
|
| 294 |
-
margin-left: 5px;
|
| 295 |
-
margin-right: 15px;
|
| 296 |
-
cursor: pointer;
|
| 297 |
-
display: inline-block;
|
| 298 |
-
vertical-align: middle;
|
| 299 |
-
}
|
| 300 |
form.text-center.mb-4 {
|
| 301 |
display: flex;
|
| 302 |
flex-direction: column;
|
|
@@ -342,17 +270,6 @@
|
|
| 342 |
color: #6c757d;
|
| 343 |
margin-bottom: 10px;
|
| 344 |
}
|
| 345 |
-
.modal-body .nutritional-info {
|
| 346 |
-
font-size: 12px;
|
| 347 |
-
color: #6c757d;
|
| 348 |
-
margin-bottom: 10px;
|
| 349 |
-
}
|
| 350 |
-
.modal-body #modal-addons h6,
|
| 351 |
-
.modal-body #first-row h6 {
|
| 352 |
-
font-size: 14px;
|
| 353 |
-
font-weight: bold;
|
| 354 |
-
margin-bottom: 10px;
|
| 355 |
-
}
|
| 356 |
.modal-footer {
|
| 357 |
display: flex;
|
| 358 |
align-items: center;
|
|
@@ -659,15 +576,6 @@
|
|
| 659 |
font-size: 12px;
|
| 660 |
margin-bottom: 5px;
|
| 661 |
}
|
| 662 |
-
.modal-body .nutritional-info {
|
| 663 |
-
font-size: 10px;
|
| 664 |
-
margin-bottom: 5px;
|
| 665 |
-
}
|
| 666 |
-
.modal-body #modal-addons h6,
|
| 667 |
-
.modal-body #first-row h6 {
|
| 668 |
-
font-size: 12px;
|
| 669 |
-
margin-bottom: 5px;
|
| 670 |
-
}
|
| 671 |
.modal-footer {
|
| 672 |
padding: 5px;
|
| 673 |
}
|
|
@@ -698,9 +606,6 @@
|
|
| 698 |
width: 50px;
|
| 699 |
height: 25px;
|
| 700 |
}
|
| 701 |
-
.customisable-text {
|
| 702 |
-
font-size: 8px;
|
| 703 |
-
}
|
| 704 |
.button-container {
|
| 705 |
gap: 3px;
|
| 706 |
}
|
|
@@ -839,9 +744,6 @@
|
|
| 839 |
ADD
|
| 840 |
</button>
|
| 841 |
{% endif %}
|
| 842 |
-
{% if item.Section__c != 'Apetizer' and item.Section__c != 'Customized dish' and item.Section__c != 'Soft Drinks' %}
|
| 843 |
-
<span class="customisable-text">Customisable</span>
|
| 844 |
-
{% endif %}
|
| 845 |
</div>
|
| 846 |
</div>
|
| 847 |
</div>
|
|
@@ -891,10 +793,6 @@
|
|
| 891 |
<h5 id="modal-name" class="fw-bold text-center"></h5>
|
| 892 |
<p id="modal-price" class="text-muted text-center"></p>
|
| 893 |
<p id="modal-description" class="text-secondary"></p>
|
| 894 |
-
<div id="modal-addons" class="modal-addons mt-4">
|
| 895 |
-
<h6>Customization Options</h6>
|
| 896 |
-
<div id="addons-list" class="addons-container">Loading customization options...</div>
|
| 897 |
-
</div>
|
| 898 |
<div class="mt-4">
|
| 899 |
<h6>Custom Request</h6>
|
| 900 |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
|
@@ -976,8 +874,7 @@
|
|
| 976 |
let cart = JSON.parse(localStorage.getItem('cart')) || [];
|
| 977 |
const existingItem = cart.find(item =>
|
| 978 |
item.itemName === payload.itemName &&
|
| 979 |
-
item.instructions === payload.instructions
|
| 980 |
-
JSON.stringify(item.addons) === JSON.stringify(payload.addons)
|
| 981 |
);
|
| 982 |
if (existingItem) {
|
| 983 |
existingItem.quantity = payload.quantity;
|
|
@@ -988,12 +885,11 @@
|
|
| 988 |
return cart;
|
| 989 |
}
|
| 990 |
|
| 991 |
-
function removeFromCartLocalStorage(itemName, quantityToRemove, instructions
|
| 992 |
let cart = JSON.parse(localStorage.getItem('cart')) || [];
|
| 993 |
const itemIndex = cart.findIndex(item =>
|
| 994 |
item.itemName === itemName &&
|
| 995 |
-
item.instructions === instructions
|
| 996 |
-
JSON.stringify(item.addons) === JSON.stringify(addons)
|
| 997 |
);
|
| 998 |
if (itemIndex !== -1) {
|
| 999 |
if (quantityToRemove >= cart[itemIndex].quantity) {
|
|
@@ -1050,7 +946,6 @@
|
|
| 1050 |
itemImage: itemImage,
|
| 1051 |
section: section,
|
| 1052 |
category: selectedCategory,
|
| 1053 |
-
addons: [],
|
| 1054 |
instructions: '',
|
| 1055 |
quantity: quantity
|
| 1056 |
};
|
|
@@ -1109,56 +1004,11 @@
|
|
| 1109 |
const modalImg = document.getElementById('modal-img');
|
| 1110 |
modalImg.src = image || '/static/placeholder.jpg';
|
| 1111 |
document.getElementById('modal-description').innerText = description || 'No description available.';
|
| 1112 |
-
document.getElementById('addons-list').innerHTML = 'Loading customization options...';
|
| 1113 |
document.getElementById('modal-instructions').value = '';
|
| 1114 |
const modalSectionEl = document.getElementById('modal-section');
|
| 1115 |
modalSectionEl.setAttribute('data-section', section);
|
| 1116 |
modalSectionEl.setAttribute('data-category', selectedCategory);
|
| 1117 |
document.getElementById('quantityInput').value = 1;
|
| 1118 |
-
|
| 1119 |
-
fetch(`/api/addons?item_name=${encodeURIComponent(name)}&item_section=${encodeURIComponent(section)}`)
|
| 1120 |
-
.then(response => response.json())
|
| 1121 |
-
.then(data => {
|
| 1122 |
-
const addonsList = document.getElementById('addons-list');
|
| 1123 |
-
addonsList.innerHTML = '';
|
| 1124 |
-
if (!data.success || !data.addons || data.addons.length === 0) {
|
| 1125 |
-
addonsList.innerHTML = '<p>No customization options available.</p>';
|
| 1126 |
-
return;
|
| 1127 |
-
}
|
| 1128 |
-
data.addons.forEach(addon => {
|
| 1129 |
-
const sectionDiv = document.createElement('div');
|
| 1130 |
-
sectionDiv.classList.add('addon-section');
|
| 1131 |
-
const title = document.createElement('h6');
|
| 1132 |
-
title.innerText = addon.name;
|
| 1133 |
-
sectionDiv.appendChild(title);
|
| 1134 |
-
const optionsContainer = document.createElement('div');
|
| 1135 |
-
addon.options.forEach((option, index) => {
|
| 1136 |
-
const optionId = `addon-${addon.name.replace(/\s+/g, '-')}-${index}`;
|
| 1137 |
-
const formCheck = document.createElement('div');
|
| 1138 |
-
formCheck.classList.add('form-check');
|
| 1139 |
-
const input = document.createElement('input');
|
| 1140 |
-
input.classList.add('form-check-input');
|
| 1141 |
-
input.type = addon.multi_select ? 'checkbox' : 'radio';
|
| 1142 |
-
input.name = addon.multi_select ? optionId : addon.name.replace(/\s+/g, '-');
|
| 1143 |
-
input.id = optionId;
|
| 1144 |
-
input.value = option.name;
|
| 1145 |
-
input.dataset.price = option.price || 0;
|
| 1146 |
-
const label = document.createElement('label');
|
| 1147 |
-
label.classList.add('form-check-label');
|
| 1148 |
-
label.htmlFor = optionId;
|
| 1149 |
-
label.innerText = `${option.name} ${option.price ? `(+$${option.price})` : ''}`;
|
| 1150 |
-
formCheck.appendChild(input);
|
| 1151 |
-
formCheck.appendChild(label);
|
| 1152 |
-
optionsContainer.appendChild(formCheck);
|
| 1153 |
-
});
|
| 1154 |
-
sectionDiv.appendChild(optionsContainer);
|
| 1155 |
-
addonsList.appendChild(sectionDiv);
|
| 1156 |
-
});
|
| 1157 |
-
})
|
| 1158 |
-
.catch(err => {
|
| 1159 |
-
console.error('Error fetching addons:', err);
|
| 1160 |
-
document.getElementById('addons-list').innerHTML = '<p>Error loading customization options.</p>';
|
| 1161 |
-
});
|
| 1162 |
}
|
| 1163 |
|
| 1164 |
function addToCartFromModal() {
|
|
@@ -1174,14 +1024,12 @@
|
|
| 1174 |
const quantity = parseInt(document.getElementById('quantityInput').value) || 1;
|
| 1175 |
const instructions = document.getElementById('modal-instructions').value;
|
| 1176 |
|
| 1177 |
-
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
});
|
| 1184 |
-
});
|
| 1185 |
|
| 1186 |
const cartPayload = {
|
| 1187 |
itemName: itemName,
|
|
@@ -1189,7 +1037,6 @@
|
|
| 1189 |
itemImage: itemImage,
|
| 1190 |
section: section,
|
| 1191 |
category: selectedCategory,
|
| 1192 |
-
addons: addons,
|
| 1193 |
instructions: instructions,
|
| 1194 |
quantity: quantity
|
| 1195 |
};
|
|
@@ -1478,8 +1325,10 @@
|
|
| 1478 |
});
|
| 1479 |
increaseBtn.addEventListener('click', function () {
|
| 1480 |
let currentQuantity = parseInt(quantityInput.value);
|
| 1481 |
-
currentQuantity
|
| 1482 |
-
|
|
|
|
|
|
|
| 1483 |
});
|
| 1484 |
|
| 1485 |
// Soft Drinks Modal Quantity Controls
|
|
|
|
| 95 |
justify-content: center;
|
| 96 |
gap: 6px;
|
| 97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
.btn-primary {
|
| 99 |
font-size: 12px;
|
| 100 |
font-weight: bold;
|
|
|
|
| 225 |
.mic-icon.active {
|
| 226 |
color: #007bff;
|
| 227 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
form.text-center.mb-4 {
|
| 229 |
display: flex;
|
| 230 |
flex-direction: column;
|
|
|
|
| 270 |
color: #6c757d;
|
| 271 |
margin-bottom: 10px;
|
| 272 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
.modal-footer {
|
| 274 |
display: flex;
|
| 275 |
align-items: center;
|
|
|
|
| 576 |
font-size: 12px;
|
| 577 |
margin-bottom: 5px;
|
| 578 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 579 |
.modal-footer {
|
| 580 |
padding: 5px;
|
| 581 |
}
|
|
|
|
| 606 |
width: 50px;
|
| 607 |
height: 25px;
|
| 608 |
}
|
|
|
|
|
|
|
|
|
|
| 609 |
.button-container {
|
| 610 |
gap: 3px;
|
| 611 |
}
|
|
|
|
| 744 |
ADD
|
| 745 |
</button>
|
| 746 |
{% endif %}
|
|
|
|
|
|
|
|
|
|
| 747 |
</div>
|
| 748 |
</div>
|
| 749 |
</div>
|
|
|
|
| 793 |
<h5 id="modal-name" class="fw-bold text-center"></h5>
|
| 794 |
<p id="modal-price" class="text-muted text-center"></p>
|
| 795 |
<p id="modal-description" class="text-secondary"></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 796 |
<div class="mt-4">
|
| 797 |
<h6>Custom Request</h6>
|
| 798 |
<textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
|
|
|
|
| 874 |
let cart = JSON.parse(localStorage.getItem('cart')) || [];
|
| 875 |
const existingItem = cart.find(item =>
|
| 876 |
item.itemName === payload.itemName &&
|
| 877 |
+
item.instructions === payload.instructions
|
|
|
|
| 878 |
);
|
| 879 |
if (existingItem) {
|
| 880 |
existingItem.quantity = payload.quantity;
|
|
|
|
| 885 |
return cart;
|
| 886 |
}
|
| 887 |
|
| 888 |
+
function removeFromCartLocalStorage(itemName, quantityToRemove, instructions) {
|
| 889 |
let cart = JSON.parse(localStorage.getItem('cart')) || [];
|
| 890 |
const itemIndex = cart.findIndex(item =>
|
| 891 |
item.itemName === itemName &&
|
| 892 |
+
item.instructions === instructions
|
|
|
|
| 893 |
);
|
| 894 |
if (itemIndex !== -1) {
|
| 895 |
if (quantityToRemove >= cart[itemIndex].quantity) {
|
|
|
|
| 946 |
itemImage: itemImage,
|
| 947 |
section: section,
|
| 948 |
category: selectedCategory,
|
|
|
|
| 949 |
instructions: '',
|
| 950 |
quantity: quantity
|
| 951 |
};
|
|
|
|
| 1004 |
const modalImg = document.getElementById('modal-img');
|
| 1005 |
modalImg.src = image || '/static/placeholder.jpg';
|
| 1006 |
document.getElementById('modal-description').innerText = description || 'No description available.';
|
|
|
|
| 1007 |
document.getElementById('modal-instructions').value = '';
|
| 1008 |
const modalSectionEl = document.getElementById('modal-section');
|
| 1009 |
modalSectionEl.setAttribute('data-section', section);
|
| 1010 |
modalSectionEl.setAttribute('data-category', selectedCategory);
|
| 1011 |
document.getElementById('quantityInput').value = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1012 |
}
|
| 1013 |
|
| 1014 |
function addToCartFromModal() {
|
|
|
|
| 1024 |
const quantity = parseInt(document.getElementById('quantityInput').value) || 1;
|
| 1025 |
const instructions = document.getElementById('modal-instructions').value;
|
| 1026 |
|
| 1027 |
+
if (!itemName || isNaN(itemPrice) || !section || !itemImage || quantity < 1) {
|
| 1028 |
+
console.error('Invalid cart item data:', { itemName, itemPrice, section, itemImage, quantity });
|
| 1029 |
+
alert('Invalid item data. Please try again.');
|
| 1030 |
+
isProcessingRequest = false;
|
| 1031 |
+
return;
|
| 1032 |
+
}
|
|
|
|
|
|
|
| 1033 |
|
| 1034 |
const cartPayload = {
|
| 1035 |
itemName: itemName,
|
|
|
|
| 1037 |
itemImage: itemImage,
|
| 1038 |
section: section,
|
| 1039 |
category: selectedCategory,
|
|
|
|
| 1040 |
instructions: instructions,
|
| 1041 |
quantity: quantity
|
| 1042 |
};
|
|
|
|
| 1325 |
});
|
| 1326 |
increaseBtn.addEventListener('click', function () {
|
| 1327 |
let currentQuantity = parseInt(quantityInput.value);
|
| 1328 |
+
if (currentQuantity < 500) {
|
| 1329 |
+
currentQuantity++;
|
| 1330 |
+
quantityInput.value = currentQuantity;
|
| 1331 |
+
}
|
| 1332 |
});
|
| 1333 |
|
| 1334 |
// Soft Drinks Modal Quantity Controls
|