86 lines
4.5 KiB
HTML
86 lines
4.5 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="ru" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{default}">
|
||
|
|
||
|
<head>
|
||
|
<title>Корзина</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<main layout:fragment="content">
|
||
|
<div class="d-flex flex-column align-items-center">
|
||
|
<div class="mb-2 col-12 col-md-8 col-lg-6 d-flex align-items-center">
|
||
|
<strong class="flex-fill">Корзина</strong>
|
||
|
<form action="#" th:action="@{/cart/clear}" method="post">
|
||
|
<button type="submit" class="btn btn-danger button-fixed-width"
|
||
|
onclick="return confirm('Вы уверены?')">
|
||
|
<i class="bi bi-x-lg"></i> Очистить
|
||
|
</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
<div class="card col-12 col-md-8 col-lg-6 align-items-center" th:each="cartItem : ${cart}">
|
||
|
<div class="card-body col-12 p-2 d-flex flex-row align-items-center justify-content-center">
|
||
|
<div class="col-9">
|
||
|
[[${cartItem.typeName}]] [[${#numbers.formatDecimal(cartItem.price, 1, 2)}]] *
|
||
|
[[${cartItem.count}]]
|
||
|
=
|
||
|
[[${#numbers.formatDecimal(cartItem.price * cartItem.count, 1, 2)}]]
|
||
|
</div>
|
||
|
<div class="col-3 d-flex justify-content-end">
|
||
|
<form action="#"
|
||
|
th:action="@{/cart/increase?type={type}&price={price}(type=${cartItem.type},price=${cartItem.price})}"
|
||
|
method="post">
|
||
|
<button type="submit" class="btn btn-primary">
|
||
|
<i class="bi bi-plus-lg"></i>
|
||
|
</button>
|
||
|
</form>
|
||
|
<form action="#"
|
||
|
th:action="@{/cart/decrease?type={type}&price={price}(type=${cartItem.type},price=${cartItem.price})}"
|
||
|
method="post">
|
||
|
<button class="btn btn-danger">
|
||
|
<i class="bi bi-dash-lg"></i>
|
||
|
</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class=" mb-2 col-12 col-md-8 col-lg-6 d-flex justify-content-end">
|
||
|
<strong>Итого: [[${#numbers.formatDecimal(totalCart, 1, 2)}]] ₽</strong>
|
||
|
</div>
|
||
|
<div class="mb-2 col-12 col-md-8 col-lg-6 d-flex justify-content-center"
|
||
|
th:if="${not #lists.isEmpty(cart)}">
|
||
|
<form action="#" th:action="@{/cart/save}" method="post">
|
||
|
<button type="submit" class="btn btn-primary" onclick="return confirm('Вы уверены?')">
|
||
|
Оформить заказ
|
||
|
</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="mb-2">
|
||
|
<form action=" #" th:action="@{/cart}" th:object="${order}" method="post">
|
||
|
<div class="mb-2">
|
||
|
<label for="type" class="form-label">Товары</label>
|
||
|
<select th:field="*{type}" id="type" class="form-select">
|
||
|
<option selected value="">Укажите тип товара</option>
|
||
|
<option th:each="type : ${types}" th:value="${type.id}">[[${type.name}]]</option>
|
||
|
</select>
|
||
|
<div th:if="${#fields.hasErrors('type')}" th:errors="*{type}" class="invalid-feedback"></div>
|
||
|
</div>
|
||
|
<div class="mb-2">
|
||
|
<label for="price" class="form-label">Цена</label>
|
||
|
<input type="number" th:field="*{price}" id="price" class="form-control" step="0.50">
|
||
|
<div th:if="${#fields.hasErrors('price')}" th:errors="*{price}" class="invalid-feedback"></div>
|
||
|
</div>
|
||
|
<div class="mb-2">
|
||
|
<label for="count" class="form-label">Количество</label>
|
||
|
<input type="number" th:field="*{count}" id="count" class="form-control" value="0" step="1">
|
||
|
<div th:if="${#fields.hasErrors('count')}" th:errors="*{count}" class="invalid-feedback"></div>
|
||
|
</div>
|
||
|
<button type="submit" class="btn btn-primary">Добавить в корзину</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</main>
|
||
|
</body>
|
||
|
|
||
|
</html>
|
||
|
|
||
|
</html>
|