Update templates/menu.html
Browse files- templates/menu.html +19 -5
templates/menu.html
CHANGED
@@ -472,7 +472,8 @@ form-check-input addon-option{
|
|
472 |
<div class="form-check form-check-inline">
|
473 |
<input type="radio" id="category-Veg" name="category" value="Veg"
|
474 |
class="custom-toggle"
|
475 |
-
{% if selected_category == "Veg" %}checked{% endif %}
|
|
|
476 |
<label class="form-check-label" for="category-Veg">Veg</label>
|
477 |
</div>
|
478 |
|
@@ -480,17 +481,20 @@ form-check-input addon-option{
|
|
480 |
<div class="form-check form-check-inline">
|
481 |
<input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish"
|
482 |
class="custom-toggle"
|
483 |
-
{% if selected_category == "Customized Dish" %}checked{% endif %}
|
|
|
484 |
<label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
|
485 |
</div>
|
486 |
</div>
|
487 |
|
488 |
-
<!--
|
489 |
-
<input type="hidden" name="category" value="{% if selected_category == '
|
490 |
</form>
|
491 |
|
492 |
|
493 |
|
|
|
|
|
494 |
|
495 |
<!-- Show menu items only when Customized Dish is not selected -->
|
496 |
<div class="container mt-4">
|
@@ -709,7 +713,17 @@ form-check-input addon-option{
|
|
709 |
}
|
710 |
});
|
711 |
}
|
712 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
function addToCartFromModal() {
|
714 |
const itemName = document.getElementById('modal-name').innerText;
|
715 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|
|
|
472 |
<div class="form-check form-check-inline">
|
473 |
<input type="radio" id="category-Veg" name="category" value="Veg"
|
474 |
class="custom-toggle"
|
475 |
+
{% if selected_category == "Veg" %}checked{% endif %}
|
476 |
+
onchange="toggleCategory(this)">
|
477 |
<label class="form-check-label" for="category-Veg">Veg</label>
|
478 |
</div>
|
479 |
|
|
|
481 |
<div class="form-check form-check-inline">
|
482 |
<input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish"
|
483 |
class="custom-toggle"
|
484 |
+
{% if selected_category == "Customized Dish" %}checked{% endif %}
|
485 |
+
onchange="toggleCategory(this)">
|
486 |
<label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
|
487 |
</div>
|
488 |
</div>
|
489 |
|
490 |
+
<!-- Hidden field to handle showing all items when no category is selected -->
|
491 |
+
<input type="hidden" name="category" value="{% if selected_category == '' %}All{% endif %}">
|
492 |
</form>
|
493 |
|
494 |
|
495 |
|
496 |
+
|
497 |
+
|
498 |
|
499 |
<!-- Show menu items only when Customized Dish is not selected -->
|
500 |
<div class="container mt-4">
|
|
|
713 |
}
|
714 |
});
|
715 |
}
|
716 |
+
function toggleCategory(element) {
|
717 |
+
// Check if the category is toggled off
|
718 |
+
if (element.checked) {
|
719 |
+
// If the category is Veg or Customized Dish, keep the form submit behavior as usual
|
720 |
+
this.form.submit();
|
721 |
+
} else {
|
722 |
+
// If neither Veg nor Customized Dish is selected, reset to show all
|
723 |
+
// It will show all items automatically when no specific category is selected
|
724 |
+
this.form.submit();
|
725 |
+
}
|
726 |
+
}
|
727 |
function addToCartFromModal() {
|
728 |
const itemName = document.getElementById('modal-name').innerText;
|
729 |
let itemPrice = parseFloat(document.getElementById('modal-price').innerText.replace('$', ''));
|