внешний вид

This commit is contained in:
a.puchkina 2024-06-07 00:30:03 +04:00
parent a914eda4e9
commit f44212ad1f
27 changed files with 262 additions and 204 deletions

View File

@ -28,8 +28,8 @@
</button>
<div class="collapse navbar-collapse" id="main-navbar">
<ul class="navbar-nav me-auto link" th:with="activeLink=${#objects.nullSafe(servletPath, '')}">
<a class="nav-link my-a" href="/profile"
th:classappend="${activeLink.startsWith('/profile') ? 'active' : ''}">
<a class="nav-link my-a" href="/orders"
th:classappend="${activeLink.startsWith('/orders') ? 'active' : ''}">
Личный кабинет
</a>
<th:block sec:authorize="hasRole('ADMIN')">

View File

@ -24,10 +24,6 @@
<button type="submit" class="btn btn-secondary ms-2">Показать</button>
</form>
<form class="search-form" th:action="@{/}" method="get" style="display: flex;">
<input type="text" th:name="query" th:value="${query}" placeholder="Введите название" />
<button class="btn btn-secondary ms-2" type="submit">Поиск</button>
</form>
</div>
<div class="mt-4" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px">
@ -65,3 +61,21 @@
</body>
</html>
<!-- <form class="search-form" th:action="@{/}" method="get" style="display: flex;">
<input type="text" th:name="query" th:value="${query}" placeholder="Введите название" />
<button class="btn btn-secondary ms-2" type="submit">Поиск</button>
</form> -->

View File

@ -3,39 +3,41 @@
<body>
<main layout:fragment="content">
<h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1>
<th:block th:switch="${items.size()}">
<h2 th:case="0">Товары заказа отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-auto">Название товара</th>
<th scope="col" class="w-auto">Цвет</th>
<th scope="col" class="w-auto">Размер</th>
<th scope="col" class="w-10">Цена</th>
<th scope="col" class="w-10">Количество</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.productName}"></td>
<td th:text="${item.productColor}"></td>
<td th:text="${item.productSize}"></td>
<td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td>
<td th:text="${item.count}"></td>
</tr>
</tbody>
</table>
<div class="container">
<h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1>
<th:block th:switch="${items.size()}">
<h2 th:case="0">Товары заказа отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-auto">Название товара</th>
<th scope="col" class="w-auto">Цвет</th>
<th scope="col" class="w-auto">Размер</th>
<th scope="col" class="w-10">Цена</th>
<th scope="col" class="w-10">Количество</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.productName}"></td>
<td th:text="${item.productColor}"></td>
<td th:text="${item.productSize}"></td>
<td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td>
<td th:text="${item.count}"></td>
</tr>
</tbody>
</table>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<h2>Итого: [[${#numbers.formatDecimal(order.total, 1, 2)}]] руб</h2>
<button class="btn btn-secondary" onclick="history.back()">Назад</button>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<h2>Итого: [[${#numbers.formatDecimal(order.total, 1, 2)}]] руб</h2>
<button class="btn btn-secondary" onclick="history.back()">Назад</button>
</th:block>
</div>
</main>
</body>

View File

@ -3,42 +3,44 @@
<body>
<main layout:fragment="content">
<th:block th:fragment="orders (items, totalPages, currentPage)">
<th:block th:switch="${items.size()}">
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-10">ID</th>
<th scope="col" class="w-10">Дата</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 th:text="${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}"></td>
<td>
<form th:action="@{/orders/details/{id}(id=${order.id})}" method="get">
<button type="submit" class="btn btn-link button-link">Детали</button>
</form>
</td>
</tr>
</tbody>
</table>
<div class="container">
<h2>Личный кабинет</h2>
<th:block th:fragment="orders (items, totalPages, currentPage)">
<th:block th:switch="${items.size()}">
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-10">ID</th>
<th scope="col" class="w-10">Дата</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 th:text="${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}"></td>
<td>
<form th:action="@{/orders/details/{id}(id=${order.id})}" method="get">
<button type="submit" class="btn btn-link button-link">Детали</button>
</form>
</td>
</tr>
</tbody>
</table>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<div class="mt-2 d-flex justify-content-center">
<a class="btn btn-secondary" href="/cart">Создать заказ</a>
</div>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<div class="mt-2 d-flex justify-content-center">
<a class="btn btn-secondary" href="/cart">Создать заказ</a>
</div>
</th:block>
</th:block>
</div>
</main>
</body>
</html>

View File

@ -11,20 +11,8 @@
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<div class = "container">
<h2>Товары</h2>
<ul class="nav nav-underline justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#products">Позиции</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="pill" href="#stats">Статистика</a>
</li>
</ul>
<div class="tab-content mt-2">
<div class="tab-pane container active" id="products">
<div class="d-flex align-items-center justify-content-between">
<a href="/admin/product/edit/" class="btn btn-secondary">Добавить товар</a>
<form class="search-form" th:action="@{/admin/product}" method="get" style="display: flex;">
@ -74,14 +62,9 @@
currentPage=${currentPage}) }" />
</th:block>
</div>
<div class="tab-pane container fade" id="stats">
<ul class="list-group mb-2">
<li th:each="stat : ${stats}" class="list-group-item">
<strong>[[${stat.typeId}]]</strong>:
[[${#numbers.formatDecimal(stat.totalPrice, 1, 2)}]] &#8381;
</li>
</ul>
</div>
<!-- <div class="tab-pane container fade" id="stats">
</div> -->
</div>
</div>
</th:block>
@ -90,3 +73,35 @@
</body>
</html>
<!-- <ul class="nav nav-underline justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#products">Позиции</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="pill" href="#stats">Статистика</a>
</li>
</ul>
<div class="tab-content mt-2">
<div class="tab-pane container active" id="products"> -->

View File

@ -8,7 +8,7 @@
<body>
<main layout:fragment="content">
<h2>Личный кабинет</h2>
<ul class="nav nav-underline justify-content-center" role="tablist">
<!-- <ul class="nav nav-underline justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#orders">Заказы</a>
</li>
@ -33,7 +33,7 @@
</ul>
</div>
</div>
</div> -->
</main>
</body>

Binary file not shown.

View File

@ -110,10 +110,6 @@ public class ProductController {
@GetMapping("/edit/")
public String create(Model model) {
model.addAttribute(PRODUCT_ATTRIBUTE, new ProductDto());
/*model.addAttribute("stats",
productService.getTotal().stream()
.map(this::toGroupedDto)
.toList()); */
model.addAttribute("types",
typeService.getAll().stream()
.map(this::toTypeDto)
@ -139,10 +135,6 @@ public class ProductController {
if (id <= 0) {
throw new IllegalArgumentException();
}
/*model.addAttribute("stats",
productService.getTotal().stream()
.map(this::toGroupedDto)
.toList()); */
model.addAttribute("types",
typeService.getAll().stream()
.map(this::toTypeDto)

View File

@ -28,8 +28,8 @@
</button>
<div class="collapse navbar-collapse" id="main-navbar">
<ul class="navbar-nav me-auto link" th:with="activeLink=${#objects.nullSafe(servletPath, '')}">
<a class="nav-link my-a" href="/profile"
th:classappend="${activeLink.startsWith('/profile') ? 'active' : ''}">
<a class="nav-link my-a" href="/orders"
th:classappend="${activeLink.startsWith('/orders') ? 'active' : ''}">
Личный кабинет
</a>
<th:block sec:authorize="hasRole('ADMIN')">

View File

@ -24,10 +24,6 @@
<button type="submit" class="btn btn-secondary ms-2">Показать</button>
</form>
<form class="search-form" th:action="@{/}" method="get" style="display: flex;">
<input type="text" th:name="query" th:value="${query}" placeholder="Введите название" />
<button class="btn btn-secondary ms-2" type="submit">Поиск</button>
</form>
</div>
<div class="mt-4" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px">
@ -65,3 +61,21 @@
</body>
</html>
<!-- <form class="search-form" th:action="@{/}" method="get" style="display: flex;">
<input type="text" th:name="query" th:value="${query}" placeholder="Введите название" />
<button class="btn btn-secondary ms-2" type="submit">Поиск</button>
</form> -->

View File

@ -3,39 +3,41 @@
<body>
<main layout:fragment="content">
<h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1>
<th:block th:switch="${items.size()}">
<h2 th:case="0">Товары заказа отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-auto">Название товара</th>
<th scope="col" class="w-auto">Цвет</th>
<th scope="col" class="w-auto">Размер</th>
<th scope="col" class="w-10">Цена</th>
<th scope="col" class="w-10">Количество</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.productName}"></td>
<td th:text="${item.productColor}"></td>
<td th:text="${item.productSize}"></td>
<td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td>
<td th:text="${item.count}"></td>
</tr>
</tbody>
</table>
<div class="container">
<h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1>
<th:block th:switch="${items.size()}">
<h2 th:case="0">Товары заказа отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-auto">Название товара</th>
<th scope="col" class="w-auto">Цвет</th>
<th scope="col" class="w-auto">Размер</th>
<th scope="col" class="w-10">Цена</th>
<th scope="col" class="w-10">Количество</th>
</tr>
</thead>
<tbody>
<tr th:each="item : ${items}">
<td th:text="${item.productName}"></td>
<td th:text="${item.productColor}"></td>
<td th:text="${item.productSize}"></td>
<td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td>
<td th:text="${item.count}"></td>
</tr>
</tbody>
</table>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<h2>Итого: [[${#numbers.formatDecimal(order.total, 1, 2)}]] руб</h2>
<button class="btn btn-secondary" onclick="history.back()">Назад</button>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<h2>Итого: [[${#numbers.formatDecimal(order.total, 1, 2)}]] руб</h2>
<button class="btn btn-secondary" onclick="history.back()">Назад</button>
</th:block>
</div>
</main>
</body>

View File

@ -3,42 +3,44 @@
<body>
<main layout:fragment="content">
<th:block th:fragment="orders (items, totalPages, currentPage)">
<th:block th:switch="${items.size()}">
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-10">ID</th>
<th scope="col" class="w-10">Дата</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 th:text="${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}"></td>
<td>
<form th:action="@{/orders/details/{id}(id=${order.id})}" method="get">
<button type="submit" class="btn btn-link button-link">Детали</button>
</form>
</td>
</tr>
</tbody>
</table>
<div class="container">
<h2>Личный кабинет</h2>
<th:block th:fragment="orders (items, totalPages, currentPage)">
<th:block th:switch="${items.size()}">
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<table class="table mt-2">
<caption></caption>
<thead>
<tr>
<th scope="col" class="w-10">ID</th>
<th scope="col" class="w-10">Дата</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 th:text="${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}"></td>
<td>
<form th:action="@{/orders/details/{id}(id=${order.id})}" method="get">
<button type="submit" class="btn btn-link button-link">Детали</button>
</form>
</td>
</tr>
</tbody>
</table>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<div class="mt-2 d-flex justify-content-center">
<a class="btn btn-secondary" href="/cart">Создать заказ</a>
</div>
</th:block>
<th:block th:replace="~{ pagination :: pagination (
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<div class="mt-2 d-flex justify-content-center">
<a class="btn btn-secondary" href="/cart">Создать заказ</a>
</div>
</th:block>
</th:block>
</div>
</main>
</body>
</html>

View File

@ -11,20 +11,8 @@
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<div class = "container">
<h2>Товары</h2>
<ul class="nav nav-underline justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#products">Позиции</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="pill" href="#stats">Статистика</a>
</li>
</ul>
<div class="tab-content mt-2">
<div class="tab-pane container active" id="products">
<div class="d-flex align-items-center justify-content-between">
<a href="/admin/product/edit/" class="btn btn-secondary">Добавить товар</a>
<form class="search-form" th:action="@{/admin/product}" method="get" style="display: flex;">
@ -74,14 +62,9 @@
currentPage=${currentPage}) }" />
</th:block>
</div>
<div class="tab-pane container fade" id="stats">
<ul class="list-group mb-2">
<li th:each="stat : ${stats}" class="list-group-item">
<strong>[[${stat.typeId}]]</strong>:
[[${#numbers.formatDecimal(stat.totalPrice, 1, 2)}]] &#8381;
</li>
</ul>
</div>
<!-- <div class="tab-pane container fade" id="stats">
</div> -->
</div>
</div>
</th:block>
@ -90,3 +73,35 @@
</body>
</html>
<!-- <ul class="nav nav-underline justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#products">Позиции</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="pill" href="#stats">Статистика</a>
</li>
</ul>
<div class="tab-content mt-2">
<div class="tab-pane container active" id="products"> -->

View File

@ -8,7 +8,7 @@
<body>
<main layout:fragment="content">
<h2>Личный кабинет</h2>
<ul class="nav nav-underline justify-content-center" role="tablist">
<!-- <ul class="nav nav-underline justify-content-center" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#orders">Заказы</a>
</li>
@ -33,7 +33,7 @@
</ul>
</div>
</div>
</div> -->
</main>
</body>