106 lines
4 KiB
Twig
106 lines
4 KiB
Twig
{% extends 'base.html.twig' %}
|
|
|
|
{% block title %}FoodOrder{% endblock %}
|
|
|
|
{% block body %}
|
|
<h1 class="mb-4">FoodOrder</h1>
|
|
|
|
<table class="table table-bordered table-striped w-auto">
|
|
<tbody>
|
|
<tr>
|
|
<th>Vendor</th>
|
|
<td>{{ food_order.foodVendor.name }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Vendorphone</th>
|
|
<td>{{ food_order.foodVendor.phone }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Created By</th>
|
|
<td>{{ food_order.createdBy }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>CreatedAt</th>
|
|
<td>{{ food_order.createdAt ? food_order.createdAt|date('Y-m-d H:i:s', 'Europe/Berlin') : '' }}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>ClosedAt</th>
|
|
<td>{{ food_order.closedAt ? food_order.closedAt|date('Y-m-d H:i:s', 'Europe/Berlin') : '' }}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="mb-3 d-flex gap-2">
|
|
<a class="btn btn-secondary" href="{{ path('app_food_order_index') }}">back to list</a>
|
|
{% if(food_order.isClosed) %}
|
|
<a class="btn btn-warning" href="{{ path('app_food_order_open', {'id': food_order.id}) }}">reopen</a>
|
|
{% else %}
|
|
<a class="btn btn-success" href="{{ path('app_food_order_close', {'id': food_order.id}) }}">close</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<h2 class="mt-5">Items</h2>
|
|
{% if (food_order.isClosed and form) %}
|
|
{{ form_start(form) }}
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>By</th>
|
|
<th>item</th>
|
|
<th>extras</th>
|
|
<th>price</th>
|
|
<th>is paid</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for itemForm in form.orderItems %}
|
|
<tr>
|
|
<td>{{ field_value(itemForm.createdBy) }}</td>
|
|
<td>{{ field_value(itemForm.name) }}</td>
|
|
<td>{{ field_value(itemForm.extras) }}</td>
|
|
<td>{{ form_widget(itemForm.priceCents) }}</td>
|
|
<td>{{ form_widget(itemForm.isPaid) }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
<tr>
|
|
<td colspan="4"></td>
|
|
<td>{{ form_row(form.save) }} {{ form_row(form._token) }}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{ form_end(form, {render_rest: false}) }}
|
|
{% else %}
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Index</th>
|
|
<th>username</th>
|
|
<th>name</th>
|
|
<th>extras</th>
|
|
<th>actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in food_order.orderItemsSortedByName %}
|
|
<tr>
|
|
<td>{{ loop.index }}</td>
|
|
<td>{{ item.createdBy }}</td>
|
|
<td>{{ item.name }}</td>
|
|
<td>{{ item.extras }}</td>
|
|
<td>
|
|
{% if(food_order.isClosed) %}
|
|
{% else %}
|
|
<a class="btn btn-sm btn-outline-primary me-1" href="{{ path('app_order_item_edit', {'id': item.id}) }}">edit</a>
|
|
<a class="btn btn-sm btn-outline-secondary me-1" href="{{ path('app_order_item_copy', {'id': item.id}) }}">copy</a>
|
|
<a class="btn btn-sm btn-outline-danger" href="{{ path('app_order_item_delete', {'id': item.id}) }}">remove</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% endif %}
|
|
<a class="btn btn-primary mt-2" href="{{ path('app_order_item_new', {'foodOrder': food_order.id}) }}">New Item</a>
|
|
|
|
{% endblock %}
|