futtern/templates/order_item/new.html.twig
lubiana 45029e0a4c
All checks were successful
/ ls (pull_request) Successful in 33s
/ ls (push) Successful in 29s
add option to select previous menuitems
2024-06-26 20:12:27 +02:00

30 lines
820 B
Twig

{% extends 'base.html.twig' %}
{% block title %}New OrderItem{% endblock %}
{% block body %}
<h1>Create new OrderItem</h1>
{{ include('order_item/_form.html.twig') }}
<div>
<b>click a button to select a given menuitem</b>
</div>
<div>
{% for menuItem in menuItems %}
<button data-menu-item>{{ menuItem.name }}</button>
{% endfor %}
</div>
<hr />
<a class="button" href="{{ path('app_food_order_show', { 'id': food_order.id}) }}">back to list</a>
<script>
document.querySelectorAll('[data-menu-item]').forEach(function(element) {
element.addEventListener('click', function(e) {
document.getElementById('order_item_name').value = e.target.textContent
});
});
</script>
{% endblock %}