rework entities

This commit is contained in:
lubiana 2024-02-13 21:43:30 +01:00
parent d128fa4c57
commit ac248697ff
11 changed files with 110 additions and 158 deletions

View file

@ -18,6 +18,7 @@
Henlo {{ username }} (<a href="{{ url('app_name') }}">change name</a>) |
<a href="{{ url('app_index') }}">index</a>
</p>
<hr />
</header>
<main>
{% block body %}{% endblock %}

View file

@ -0,0 +1,6 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ include('_form.html.twig') }}
{% endblock %}

View file

@ -44,7 +44,7 @@
<tr>
<td>
{{ lel.item.menuItem.aliases|map(i => i.name)|join(' / ') }}
{{ lel.item.menuItem.menuItemAliases|map(i => i.name)|join(' / ') }}
</td>
<td>
{{ lel.item.menuItem.price|cents_to_eur }}
@ -58,7 +58,6 @@
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
<table class="table">
<thead>
@ -79,29 +78,17 @@
<td>
{% if food_order.closedAt is null %}
<a
href="#"
data-menuitem-id="{{ item.id }}"
href="{{ path(
'app_foodorder_add_item',
{
foodOrder: food_order.id,
menuItem: item.id
}
) }}"
>add</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
<script>
document.querySelectorAll('a[data-menuitem-id]').forEach((link) => {
link.addEventListener('click', (event) => {
// Prevent the default action of the link
event.preventDefault();
// Get the `data-menuitem-id` attribute of the clicked link
let menuItemId = link.getAttribute('data-menuitem-id');
// Select the corresponding dialog with the same `data-menuitem-id`. Assuming each dialog's id is the same as `data-menuitem-id`, please update the code to use proper id or class as needed.
let dialog = document.querySelector(`dialog[data-menuitem-id="${menuItemId}"]` );
// Open the dialog
dialog.showModal();
});
});
</script>
{% endblock %}

View file

@ -16,7 +16,7 @@
<tbody>
{% for order in orders %}
<tr>
<td>{{ order.startedByName }}</td>
<td>{{ order.startedBy }}</td>
<td>{{ order.vendor.name }}</td>
<td>{{ order.startedAt|date("Y-m-d H:i") }}</td>
<td><a href="{{ path('app_food_order_show', {'id': order.id}) }}">show</a></td>