maks was trying

This commit is contained in:
aleyckin 2023-05-25 17:26:29 +04:00
parent 8e3a414847
commit fe7076c6f4
2 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{default}">
<head>
</head>
<body>
<div layout:fragment="content">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Название</th>
<th scope="col">Адресс</th>
<th scope="col">Редактировать запись</th>
</tr>
</thead>
<tbody>
<tr th:each="selmanufacturer, iterator: ${selmanufacturers}">
<td th:text="${selmanufacturer.name}" style="width: 35%"/>
<td th:text="${selmanufacturer.address}" style="width: 35%"/>
<td style="width: 10%">
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn btn-danger button-fixed button-sm"
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${manufacturer.id}').click()|">
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
</button>
</div>
<form th:action="@{/product/filter/delete/{id}(id=${selmanufacturer.id})}" method="post">
<button th:id="'remove-' + ${manufacturer.id}" type="submit" style="display: none">
Удалить
</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<form th:action="@{/product/filter}" method="post">
<div class="input-group mb-3">
<select class="form-select" th:name="manufacturerid">
<option th:each="manufacturer, iterator: ${manufacturers}" th:value="${manufacturer.id}" th:text="${manufacturer.name}"></option>
</select>
<button class="btn btn-outline-secondary" type="submit">Добавить</button>
</div>
</form>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">Название</th>
<th scope="col">Цена</th>
<th scope="col">Фото</th>
<th scope="col">Категория</th>
<th scope="col">Редактировать запись</th>
</tr>
</thead>
<tbody>
<tr th:each="product, iterator: ${products}">
<td th:text="${product.name}" style="width: 25%"/>
<td th:text="${product.price}" style="width: 25%"/>
<td><img th:src="${product.photo}" class="img-thumbnail mw-50 mh-50"/></td>
<td th:text="${product.categoryName}" style="width: 25%"/>
<td style="width: 10%">
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-warning button-fixed button-sm"
th:href="@{/product/update/{id}(id=${product.id})}">
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
</a>
<button type="button" class="btn btn-danger button-fixed button-sm"
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${product.id}').click()|">
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
</button>
<a class="btn btn-primary button-fixed button-sm"
th:href="@{/product/{id}/manufacturers(id=${product.id})}">
<i class="fa fa-pencil" aria-hidden="true"></i> Производители
</a>
</div>
<form th:action="@{/product/delete/{id}(id=${product.id})}" method="post">
<button th:id="'remove-' + ${product.id}" type="submit" style="display: none">
Удалить
</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>

View File

@ -11,6 +11,10 @@
th:href="@{/product/update/}"> th:href="@{/product/update/}">
<i class="fa-solid fa-plus"></i> Добавить <i class="fa-solid fa-plus"></i> Добавить
</a> </a>
<a class="btn btn-success button-fixed"
th:href="@{/product/filter/}">
<i class="fa-solid fa-plus"></i> Фильтр
</a>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table">