Алексей Крюков ab0b1cb0bf done
2024-06-03 17:05:34 +04:00

70 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
<th:block th:fragment="orders (items, totalPages, currentPage, products)">
<th:block th:switch="${items.size()}">
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*" class="w-50 mx-auto">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-10">ID</th>
<th scope="col" class="w-auto">Игры</th>
<th scope="col" class="w-10"></th>
</tr>
</thead>
<tbody>
<tr th:each="order : ${items}">
<th scope="row" th:text="${order.id}"></th>
<td>
<table class="table">
<thead>
<tr>
<th scope="col" class="w-10"></th>
<th scope="col" class="w-25"></th>
<th scope="col" class="w-auto">Название продукции</th>
<th scope="col" class="w-10">Цена</th>
</tr>
</thead>
<tbody>
<tr th:each="productId : ${order.products}">
<th:block th:each="product : ${products}">
<th:block th:if="${productId} eq ${product.id}">
<th scope="row" th:text="${productId}"></th>
<th scope="row"><img src="/kola.jpg" class="w-100">
</th>
<th scope="row" th:text="${product.name}"></th>
<th scope="row" th:text="${product.price}"></th>
</th:block>
</th:block>
</tr>
</tbody>
</table>
</td>
<td>
<form th:action="@{/delete/{id}(id=${order.id})}" method="post">
<input type="hidden" th:name="page" th:value="${page}">
<button type="submit" class="btn btn-link button-link"
onclick="return confirm('Вы уверены?')">Удалить</button>
</form>
</td>
</tr>
</tbody>
</table>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<div class="mb-2 d-flex justify-content-center">
<a class="btn btn-primary" href="/cart">Создать заказ</a>
</div>
</th:block>
</th:block>
</body>
</html>