внешний вид

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

View File

@ -24,11 +24,7 @@
<button type="submit" class="btn btn-secondary ms-2">Показать</button> <button type="submit" class="btn btn-secondary ms-2">Показать</button>
</form> </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>
<div class="mt-4" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px"> <div class="mt-4" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px">
<div class="card" style="margin-bottom: 1rem" th:each="product : ${items}"> <div class="card" style="margin-bottom: 1rem" th:each="product : ${items}">
@ -64,4 +60,22 @@
</main> </main>
</body> </body>
</html> </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> <body>
<main layout:fragment="content"> <main layout:fragment="content">
<h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1> <div class="container">
<th:block th:switch="${items.size()}"> <h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1>
<h2 th:case="0">Товары заказа отсутствуют</h2> <th:block th:switch="${items.size()}">
<th:block th:case="*"> <h2 th:case="0">Товары заказа отсутствуют</h2>
<table class="table mt-2"> <th:block th:case="*">
<caption></caption> <table class="table mt-2">
<thead> <caption></caption>
<tr> <thead>
<th scope="col" class="w-auto">Название товара</th> <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-auto">Цвет</th>
<th scope="col" class="w-10">Цена</th> <th scope="col" class="w-auto">Размер</th>
<th scope="col" class="w-10">Количество</th> <th scope="col" class="w-10">Цена</th>
</tr> <th scope="col" class="w-10">Количество</th>
</thead> </tr>
<tbody> </thead>
<tr th:each="item : ${items}"> <tbody>
<td th:text="${item.productName}"></td> <tr th:each="item : ${items}">
<td th:text="${item.productColor}"></td> <td th:text="${item.productName}"></td>
<td th:text="${item.productSize}"></td> <td th:text="${item.productColor}"></td>
<td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td> <td th:text="${item.productSize}"></td>
<td th:text="${item.count}"></td> <td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td>
</tr> <td th:text="${item.count}"></td>
</tbody> </tr>
</table> </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:block th:replace="~{ pagination :: pagination ( </div>
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<h2>Итого: [[${#numbers.formatDecimal(order.total, 1, 2)}]] руб</h2>
<button class="btn btn-secondary" onclick="history.back()">Назад</button>
</th:block>
</main> </main>
</body> </body>

View File

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

View File

@ -11,20 +11,8 @@
<h2 th:case="0">Данные отсутствуют</h2> <h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*"> <th:block th:case="*">
<div class = "container"> <div class = "container">
<h2>Товары</h2> <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"> <div class="d-flex align-items-center justify-content-between">
<a href="/admin/product/edit/" class="btn btn-secondary">Добавить товар</a> <a href="/admin/product/edit/" class="btn btn-secondary">Добавить товар</a>
<form class="search-form" th:action="@{/admin/product}" method="get" style="display: flex;"> <form class="search-form" th:action="@{/admin/product}" method="get" style="display: flex;">
@ -74,14 +62,9 @@
currentPage=${currentPage}) }" /> currentPage=${currentPage}) }" />
</th:block> </th:block>
</div> </div>
<div class="tab-pane container fade" id="stats"> <!-- <div class="tab-pane container fade" id="stats">
<ul class="list-group mb-2">
<li th:each="stat : ${stats}" class="list-group-item"> </div> -->
<strong>[[${stat.typeId}]]</strong>:
[[${#numbers.formatDecimal(stat.totalPrice, 1, 2)}]] &#8381;
</li>
</ul>
</div>
</div> </div>
</div> </div>
</th:block> </th:block>
@ -89,4 +72,36 @@
</main> </main>
</body> </body>
</html> </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> <body>
<main layout:fragment="content"> <main layout:fragment="content">
<h2>Личный кабинет</h2> <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"> <li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#orders">Заказы</a> <a class="nav-link active" data-bs-toggle="pill" href="#orders">Заказы</a>
</li> </li>
@ -33,7 +33,7 @@
</ul> </ul>
</div> </div>
</div> </div> -->
</main> </main>
</body> </body>

Binary file not shown.

View File

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

View File

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

View File

@ -24,11 +24,7 @@
<button type="submit" class="btn btn-secondary ms-2">Показать</button> <button type="submit" class="btn btn-secondary ms-2">Показать</button>
</form> </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>
<div class="mt-4" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px"> <div class="mt-4" style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px">
<div class="card" style="margin-bottom: 1rem" th:each="product : ${items}"> <div class="card" style="margin-bottom: 1rem" th:each="product : ${items}">
@ -64,4 +60,22 @@
</main> </main>
</body> </body>
</html> </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> <body>
<main layout:fragment="content"> <main layout:fragment="content">
<h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1> <div class="container">
<th:block th:switch="${items.size()}"> <h1>Заказ №[[${order.id}]], [[${#dates.format(order.date, 'HH:mm dd-MM-yyyy')}]]</h1>
<h2 th:case="0">Товары заказа отсутствуют</h2> <th:block th:switch="${items.size()}">
<th:block th:case="*"> <h2 th:case="0">Товары заказа отсутствуют</h2>
<table class="table mt-2"> <th:block th:case="*">
<caption></caption> <table class="table mt-2">
<thead> <caption></caption>
<tr> <thead>
<th scope="col" class="w-auto">Название товара</th> <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-auto">Цвет</th>
<th scope="col" class="w-10">Цена</th> <th scope="col" class="w-auto">Размер</th>
<th scope="col" class="w-10">Количество</th> <th scope="col" class="w-10">Цена</th>
</tr> <th scope="col" class="w-10">Количество</th>
</thead> </tr>
<tbody> </thead>
<tr th:each="item : ${items}"> <tbody>
<td th:text="${item.productName}"></td> <tr th:each="item : ${items}">
<td th:text="${item.productColor}"></td> <td th:text="${item.productName}"></td>
<td th:text="${item.productSize}"></td> <td th:text="${item.productColor}"></td>
<td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td> <td th:text="${item.productSize}"></td>
<td th:text="${item.count}"></td> <td th:text="${#numbers.formatDecimal(item.productPrice, 1, 2)}"></td>
</tr> <td th:text="${item.count}"></td>
</tbody> </tr>
</table> </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:block th:replace="~{ pagination :: pagination ( </div>
url='',
totalPages=${totalPages},
currentPage=${currentPage}) }" />
<h2>Итого: [[${#numbers.formatDecimal(order.total, 1, 2)}]] руб</h2>
<button class="btn btn-secondary" onclick="history.back()">Назад</button>
</th:block>
</main> </main>
</body> </body>

View File

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

View File

@ -11,20 +11,8 @@
<h2 th:case="0">Данные отсутствуют</h2> <h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*"> <th:block th:case="*">
<div class = "container"> <div class = "container">
<h2>Товары</h2> <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"> <div class="d-flex align-items-center justify-content-between">
<a href="/admin/product/edit/" class="btn btn-secondary">Добавить товар</a> <a href="/admin/product/edit/" class="btn btn-secondary">Добавить товар</a>
<form class="search-form" th:action="@{/admin/product}" method="get" style="display: flex;"> <form class="search-form" th:action="@{/admin/product}" method="get" style="display: flex;">
@ -74,14 +62,9 @@
currentPage=${currentPage}) }" /> currentPage=${currentPage}) }" />
</th:block> </th:block>
</div> </div>
<div class="tab-pane container fade" id="stats"> <!-- <div class="tab-pane container fade" id="stats">
<ul class="list-group mb-2">
<li th:each="stat : ${stats}" class="list-group-item"> </div> -->
<strong>[[${stat.typeId}]]</strong>:
[[${#numbers.formatDecimal(stat.totalPrice, 1, 2)}]] &#8381;
</li>
</ul>
</div>
</div> </div>
</div> </div>
</th:block> </th:block>
@ -89,4 +72,36 @@
</main> </main>
</body> </body>
</html> </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> <body>
<main layout:fragment="content"> <main layout:fragment="content">
<h2>Личный кабинет</h2> <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"> <li class="nav-item">
<a class="nav-link active" data-bs-toggle="pill" href="#orders">Заказы</a> <a class="nav-link active" data-bs-toggle="pill" href="#orders">Заказы</a>
</li> </li>
@ -33,7 +33,7 @@
</ul> </ul>
</div> </div>
</div> </div> -->
</main> </main>
</body> </body>