better readable forms
All checks were successful
/ ls (pull_request) Successful in 1m38s
/ ls (push) Successful in 1m34s

This commit is contained in:
lubiana 2025-07-07 18:22:30 +02:00
parent 547b1842bf
commit 994d837de9
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
5 changed files with 29 additions and 9 deletions

View file

@ -5,6 +5,7 @@ namespace App\Form;
use App\Entity\OrderItem;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -21,6 +22,8 @@ final class OrderItemFinalize extends AbstractType
->add(child: 'extras', options: [
'disabled' => true,
])
->add(child: 'menuItem', type: HiddenType::class, options: [
])
->add(child: 'createdBy', options: [
'disabled' => true,
])

View file

@ -12,7 +12,7 @@
</head>
<body>
<header class="mb-4">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<span class="navbar-brand">Futtern</span>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
@ -57,7 +57,7 @@
</div>
</nav>
</header>
<main class="container pb-5">
<main class="container pb-5 pt-5">
{% block body %}{% endblock %}
</main>
</body>

View file

@ -56,7 +56,11 @@
{% for itemForm in form.orderItems %}
<tr>
<td>{{ field_value(itemForm.createdBy) }}</td>
<td>{{ field_value(itemForm.name) }}</td>
<td>
<a href="{{ path('app_menu_item_show', {'id': itemForm.menuItem.vars.value.id}) }}">
{{ field_value(itemForm.name) }}
</a>
</td>
<td>{{ field_value(itemForm.extras) }}</td>
<td>{{ form_widget(itemForm.priceCents) }}</td>
<td>{{ form_widget(itemForm.isPaid) }}</td>
@ -86,7 +90,9 @@
<tr>
<td>{{ loop.index }}</td>
<td>{{ item.createdBy }}</td>
<td>{{ item.name }}</td>
<td>
<a href="{{ path('app_menu_item_show', {'id': item.id}) }}">{{ item.name }}</a>
</td>
<td>{{ item.extras }}</td>
<td>
{% if(food_order.isClosed) %}

View file

@ -20,16 +20,27 @@
<section class="mb-4">
<h2>known menuitems</h2>
<ul class="list-group list-group-flush">
<table class="table table-bordered w-auto">
<thead>
<tr>
<th>name</th>
<th>price</th>
</tr>
</thead>
<tbody>
{% for item in food_vendor.menuItems %}
<li class="list-group-item">
<tr class="menu-item">
<td>
<a href="{{ path('app_menu_item_show', {'id': item.id}) }}">{{ item.name }}</a>
{% if(item.aliasOf) %}
<span class="text-muted">(alias of: {{ item.aliasOf.name }})</span>
{% endif %}
</li>
</td>
<td>{{ (item.priceCents / 100)|format_currency('EUR') }}</td>
</tr>
{% endfor %}
</ul>
</tbody>
</table>
</section>
<div class="d-flex gap-2">

View file

@ -119,7 +119,7 @@ describe(FoodVendorController::class, function (): void {
)->text();
$this->assertSame('My Title', $nameNode);
$itemNodes = $crawler->filter('ul.list-group li.list-group-item');
$itemNodes = $crawler->filter('tr.menu-item');
$this->assertCount(4, $itemNodes);
});