This commit is contained in:
lubiana 2024-02-12 22:03:17 +01:00
parent 203233d2ed
commit 93fa2da696
45 changed files with 2633 additions and 550 deletions

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
<link rel="stylesheet" href="/css/simple.min.css">
<link rel="stylesheet" href="/css/water.css">
{% block stylesheets %}
{% endblock %}
@ -12,6 +12,15 @@
{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
<header>
<p>
Futtern |
Henlo {{ username }} (<a href="{{ url('app_name') }}">change name</a>) |
<a href="{{ url('app_index') }}">index</a>
</p>
</header>
<main>
{% block body %}{% endblock %}
</main>
</body>
</html>

View file

@ -9,7 +9,7 @@
<tbody>
<tr>
<th>StartedByName</th>
<td>{{ food_order.startedByName }}</td>
<td>{{ food_order.startedBy }}</td>
</tr>
<tr>
<th>Id</th>
@ -21,7 +21,13 @@
</tr>
<tr>
<th>ClosedAt</th>
<td>{{ food_order.closedAt ? food_order.closedAt|date('Y-m-d H:i:s') : '' }}</td>
<td>
{% if food_order.closedAt is not null%}
{{ food_order.closedAt|date('Y-m-d H:i:s') }}
{% else %}
<a href="{{ path('app_foodorder_close', {id: food_order.id}) }}">close</a>
{% endif %}
</td>
</tr>
</tbody>
</table>
@ -41,7 +47,7 @@
{{ lel.item.menuItem.aliases|map(i => i.name)|join(' / ') }}
</td>
<td>
{{ lel.item.menuItem.price }}
{{ lel.item.menuItem.price|cents_to_eur }}
</td>
<td>
{{ lel.amount }} |
@ -65,21 +71,37 @@
{% for item in menu_items %}
<tr>
<td>
{{ item.aliases|map(i => i.name)|join(' / ') }}
{{ item.menuItemAliases|map(i => i.name)|join(' / ') }}
</td>
<td>
{{ item.price }}
{{ item.price|cents_to_eur }}
</td>
<td>
<a href="{{ path('app_foodorder_add_item', {foodOrder: food_order.id, menuItem: item.id}) }}">join</a>
{% if food_order.closedAt is null %}
<a
href="#"
data-menuitem-id="{{ 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();
<a href="{{ path('app_food_order_index') }}">back to list</a>
// Get the `data-menuitem-id` attribute of the clicked link
let menuItemId = link.getAttribute('data-menuitem-id');
<a href="{{ path('app_food_order_edit', {'id': food_order.id}) }}">edit</a>
// 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}"]` );
{{ include('food_order/_delete_form.html.twig') }}
// Open the dialog
dialog.showModal();
});
});
</script>
{% endblock %}

View file

@ -23,7 +23,7 @@
</tr>
{% else %}
<tr>
<td colspan="3">no records found</td>
<td colspan="4">no records found</td>
</tr>
{% endfor %}
</tbody>

View file

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