Update templates/menu.html
Browse files- templates/menu.html +48 -7
templates/menu.html
CHANGED
@@ -242,9 +242,10 @@
|
|
242 |
color: #343a40;
|
243 |
}
|
244 |
.addon-section .form-check {
|
245 |
-
display:
|
246 |
align-items: center;
|
247 |
margin-left: 10px;
|
|
|
248 |
color: #343a40;
|
249 |
}
|
250 |
.addon-section .form-check-input {
|
@@ -274,7 +275,6 @@
|
|
274 |
.addon-section .form-check-label {
|
275 |
font-size: 16px;
|
276 |
margin-left: 5px;
|
277 |
-
margin-right: 15px;
|
278 |
cursor: pointer;
|
279 |
display: inline-block;
|
280 |
vertical-align: middle;
|
@@ -618,6 +618,10 @@
|
|
618 |
padding: 8px;
|
619 |
margin-bottom: 5px;
|
620 |
}
|
|
|
|
|
|
|
|
|
621 |
.addon-section .form-check-input {
|
622 |
width: 16px;
|
623 |
height: 16px;
|
@@ -625,7 +629,6 @@
|
|
625 |
}
|
626 |
.addon-section .form-check-label {
|
627 |
font-size: 12px;
|
628 |
-
margin-right: 10px;
|
629 |
}
|
630 |
}
|
631 |
</style>
|
@@ -772,6 +775,27 @@
|
|
772 |
<h6>Type</h6>
|
773 |
<div id="type-options"></div>
|
774 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
</div>
|
776 |
|
777 |
<div id="modal-addons" class="modal-addons mt-4">
|
@@ -1084,12 +1108,14 @@
|
|
1084 |
|
1085 |
const prepStyleOptions = document.getElementById('prep-style-options');
|
1086 |
const typeOptions = document.getElementById('type-options');
|
|
|
1087 |
const firstRow = document.getElementById('first-row');
|
1088 |
const firstRowTitle = document.getElementById('first-row-title');
|
1089 |
const addonsTitle = document.getElementById('addons-title');
|
1090 |
|
1091 |
prepStyleOptions.innerHTML = '';
|
1092 |
typeOptions.innerHTML = '';
|
|
|
1093 |
|
1094 |
if (section.toLowerCase() === 'starters') {
|
1095 |
firstRow.style.display = 'block';
|
@@ -1188,6 +1214,7 @@
|
|
1188 |
data.addons.forEach(addon => {
|
1189 |
if (section.toLowerCase() === 'starters' &&
|
1190 |
(addon.name.toLowerCase() === "type" ||
|
|
|
1191 |
addon.name.toLowerCase() === "choose preparation style")) {
|
1192 |
return;
|
1193 |
}
|
@@ -1207,7 +1234,7 @@
|
|
1207 |
listItem.classList.add('form-check');
|
1208 |
|
1209 |
listItem.innerHTML = `
|
1210 |
-
<input type="checkbox" class="form-check-input addon-option" id="${optionId}" value="${option}"
|
1211 |
data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
|
1212 |
<label class="form-check-label" for="${optionId}">
|
1213 |
${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
|
@@ -1226,6 +1253,7 @@
|
|
1226 |
];
|
1227 |
|
1228 |
const desiredOrder = [
|
|
|
1229 |
"Choose Preparation Style",
|
1230 |
"Select Dip/Sauce",
|
1231 |
"Extra Add-ons",
|
@@ -1259,7 +1287,7 @@
|
|
1259 |
}
|
1260 |
|
1261 |
document.addEventListener('click', function(event) {
|
1262 |
-
if (event.target.classList.contains('addon-option')) {
|
1263 |
handleAddonClick(event.target);
|
1264 |
}
|
1265 |
});
|
@@ -1268,7 +1296,15 @@
|
|
1268 |
const groupName = checkbox.getAttribute('data-group');
|
1269 |
const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides", "Select Dip/Sauce", "Extra Add-ons", "Make it a Combo", "Beverages", "Sauces"].includes(groupName);
|
1270 |
|
1271 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1272 |
const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
|
1273 |
checkboxes.forEach(otherCheckbox => {
|
1274 |
if (otherCheckbox !== checkbox) {
|
@@ -1354,7 +1390,12 @@
|
|
1354 |
name: option.getAttribute('data-name') || 'Default Type',
|
1355 |
price: 0
|
1356 |
}));
|
1357 |
-
|
|
|
|
|
|
|
|
|
|
|
1358 |
}
|
1359 |
|
1360 |
const quantity = parseInt(document.getElementById('quantityInput').value) || 1;
|
|
|
242 |
color: #343a40;
|
243 |
}
|
244 |
.addon-section .form-check {
|
245 |
+
display: flex;
|
246 |
align-items: center;
|
247 |
margin-left: 10px;
|
248 |
+
margin-bottom: 8px;
|
249 |
color: #343a40;
|
250 |
}
|
251 |
.addon-section .form-check-input {
|
|
|
275 |
.addon-section .form-check-label {
|
276 |
font-size: 16px;
|
277 |
margin-left: 5px;
|
|
|
278 |
cursor: pointer;
|
279 |
display: inline-block;
|
280 |
vertical-align: middle;
|
|
|
618 |
padding: 8px;
|
619 |
margin-bottom: 5px;
|
620 |
}
|
621 |
+
.addon-section .form-check {
|
622 |
+
margin-left: 0;
|
623 |
+
margin-bottom: 5px;
|
624 |
+
}
|
625 |
.addon-section .form-check-input {
|
626 |
width: 16px;
|
627 |
height: 16px;
|
|
|
629 |
}
|
630 |
.addon-section .form-check-label {
|
631 |
font-size: 12px;
|
|
|
632 |
}
|
633 |
}
|
634 |
</style>
|
|
|
775 |
<h6>Type</h6>
|
776 |
<div id="type-options"></div>
|
777 |
</div>
|
778 |
+
<div class="addon-section">
|
779 |
+
<h6>Select Spice Level</h6>
|
780 |
+
<div id="spice-level-options">
|
781 |
+
<div class="form-check">
|
782 |
+
<input type="checkbox" class="form-check-input spice-level-option" id="spice-mild" value="Mild" data-name="Mild" data-group="Spice Level">
|
783 |
+
<label class="form-check-label" for="spice-mild">Mild</label>
|
784 |
+
</div>
|
785 |
+
<div class="form-check">
|
786 |
+
<input type="checkbox" class="form-check-input spice-level-option" id="spice-medium" value="Medium" data-name="Medium" data-group="Spice Level">
|
787 |
+
<label class="form-check-label" for="spice-medium">Medium</label>
|
788 |
+
</div>
|
789 |
+
<div class="form-check">
|
790 |
+
<input type="checkbox" class="form-check-input spice-level-option" id="spice-spicy" value="Spicy" data-name="Spicy" data-group="Spice Level">
|
791 |
+
<label class="form-check-label" for="spice-spicy">Spicy</label>
|
792 |
+
</div>
|
793 |
+
<div class="form-check">
|
794 |
+
<input type="checkbox" class="form-check-input spice-level-option" id="spice-extra-spicy" value="Extra Spicy" data-name="Extra Spicy" data-group="Spice Level">
|
795 |
+
<label class="form-check-label" for="spice-extra-spicy">Extra Spicy</label>
|
796 |
+
</div>
|
797 |
+
</div>
|
798 |
+
</div>
|
799 |
</div>
|
800 |
|
801 |
<div id="modal-addons" class="modal-addons mt-4">
|
|
|
1108 |
|
1109 |
const prepStyleOptions = document.getElementById('prep-style-options');
|
1110 |
const typeOptions = document.getElementById('type-options');
|
1111 |
+
const spiceLevelOptions = document.getElementById('spice-level-options');
|
1112 |
const firstRow = document.getElementById('first-row');
|
1113 |
const firstRowTitle = document.getElementById('first-row-title');
|
1114 |
const addonsTitle = document.getElementById('addons-title');
|
1115 |
|
1116 |
prepStyleOptions.innerHTML = '';
|
1117 |
typeOptions.innerHTML = '';
|
1118 |
+
spiceLevelOptions.innerHTML = '';
|
1119 |
|
1120 |
if (section.toLowerCase() === 'starters') {
|
1121 |
firstRow.style.display = 'block';
|
|
|
1214 |
data.addons.forEach(addon => {
|
1215 |
if (section.toLowerCase() === 'starters' &&
|
1216 |
(addon.name.toLowerCase() === "type" ||
|
1217 |
+
addon.name.toLowerCase() === "spice level" ||
|
1218 |
addon.name.toLowerCase() === "choose preparation style")) {
|
1219 |
return;
|
1220 |
}
|
|
|
1234 |
listItem.classList.add('form-check');
|
1235 |
|
1236 |
listItem.innerHTML = `
|
1237 |
+
<input type="checkbox" class="form-check-input ${addon.name.toLowerCase() === 'spice level' ? 'spice-level-option' : 'addon-option'}" id="${optionId}" value="${option}"
|
1238 |
data-name="${option}" data-group="${addon.name}" data-price="${addon.extra_charge ? addon.extra_charge_amount : 0}">
|
1239 |
<label class="form-check-label" for="${optionId}">
|
1240 |
${option} ${addon.extra_charge ? `($${addon.extra_charge_amount})` : ''}
|
|
|
1253 |
];
|
1254 |
|
1255 |
const desiredOrder = [
|
1256 |
+
"Spice Level",
|
1257 |
"Choose Preparation Style",
|
1258 |
"Select Dip/Sauce",
|
1259 |
"Extra Add-ons",
|
|
|
1287 |
}
|
1288 |
|
1289 |
document.addEventListener('click', function(event) {
|
1290 |
+
if (event.target.classList.contains('spice-level-option') || event.target.classList.contains('addon-option')) {
|
1291 |
handleAddonClick(event.target);
|
1292 |
}
|
1293 |
});
|
|
|
1296 |
const groupName = checkbox.getAttribute('data-group');
|
1297 |
const isMultiSelectGroup = ["Extra Toppings", "Choose Raita/Sides", "Select Dip/Sauce", "Extra Add-ons", "Make it a Combo", "Beverages", "Sauces"].includes(groupName);
|
1298 |
|
1299 |
+
if (groupName.toLowerCase() === "spice level") {
|
1300 |
+
const allSpiceLevelCheckboxes = document.querySelectorAll('.spice-level-option');
|
1301 |
+
allSpiceLevelCheckboxes.forEach(otherCheckbox => {
|
1302 |
+
if (otherCheckbox !== checkbox) {
|
1303 |
+
otherCheckbox.checked = false;
|
1304 |
+
}
|
1305 |
+
});
|
1306 |
+
}
|
1307 |
+
else if (!isMultiSelectGroup) {
|
1308 |
const checkboxes = document.querySelectorAll(`.addon-option[data-group="${groupName}"]`);
|
1309 |
checkboxes.forEach(otherCheckbox => {
|
1310 |
if (otherCheckbox !== checkbox) {
|
|
|
1390 |
name: option.getAttribute('data-name') || 'Default Type',
|
1391 |
price: 0
|
1392 |
}));
|
1393 |
+
const spiceLevelOption = document.querySelector('#spice-level-options input[type="checkbox"].spice-level-option:checked');
|
1394 |
+
const spiceLevelOptions = spiceLevelOption ? [{
|
1395 |
+
name: spiceLevelOption.getAttribute('data-name') || 'Default Spice Level',
|
1396 |
+
price: 0
|
1397 |
+
}] : [];
|
1398 |
+
selectedAddOns = [...selectedAddOns, ...prepStyleOptions, ...typeOptions, ...spiceLevelOptions];
|
1399 |
}
|
1400 |
|
1401 |
const quantity = parseInt(document.getElementById('quantityInput').value) || 1;
|