спасибо коля за картинку

This commit is contained in:
dasha 2023-04-22 13:53:26 +04:00
parent 2d2394bce5
commit 9ce26952ae
16 changed files with 191 additions and 233 deletions

View File

@ -42,9 +42,9 @@ public class CinemaMvcController {
return "cinema-edit"; return "cinema-edit";
} }
@GetMapping (value = "/search/") @GetMapping(value = "/search/")
public String searchCinema(@RequestParam String request, public String searchCinema(@RequestParam String request,
Model model) { Model model) {
List<CinemaDto> cinemas = cinemaService.findAllCinemas(request) List<CinemaDto> cinemas = cinemaService.findAllCinemas(request)
.stream().map(CinemaDto::new).toList(); .stream().map(CinemaDto::new).toList();
model.addAttribute("cinemas", cinemas); model.addAttribute("cinemas", cinemas);
@ -62,11 +62,11 @@ public class CinemaMvcController {
return "cinema-edit"; return "cinema-edit";
} }
if (id == null || id <= 0) { if (id == null || id <= 0) {
cinemaDto.setImage("data:image/jpeg;base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes())); cinemaDto.setImage("data:" + multipartFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes()));
cinemaService.addCinema(cinemaDto); cinemaService.addCinema(cinemaDto);
} else { } else {
cinemaDto.setId(id); cinemaDto.setId(id);
cinemaDto.setImage("data:image/jpeg;base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes())); cinemaDto.setImage("data:" + multipartFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes()));
cinemaService.updateCinema(cinemaDto); cinemaService.updateCinema(cinemaDto);
} }
return "redirect:/cinema"; return "redirect:/cinema";

View File

@ -25,7 +25,7 @@ public class CustomerMvcController {
return "customer"; return "customer";
} }
@GetMapping(value = {"/edit", "/edit/{id}"}) @GetMapping(value = {"/edit", "/edit/{id}"})
public String editCustomer(@PathVariable(required = false) Long id, public String editCustomer(@PathVariable(required = false) Long id,
Model model) { Model model) {
if (id == null || id <= 0) { if (id == null || id <= 0) {

View File

@ -24,14 +24,13 @@ public class SessionMvcController {
@GetMapping @GetMapping
public String getSessions(Model model) { public String getSessions(Model model) {
model.addAttribute("sessions", model.addAttribute("sessions", sessionService.findAllSessions().stream()
sessionService.findAllSessions().stream() .map(SessionDto::new)
.map(SessionDto::new) .toList());
.toList());
return "session"; return "session";
} }
@GetMapping(value = {"/edit", "/edit/{id}"}) @GetMapping(value = {"/edit", "/edit/{id}"})
public String editSession(@PathVariable(required = false) Long id, public String editSession(@PathVariable(required = false) Long id,
Model model) { Model model) {
if (id == null || id <= 0) { if (id == null || id <= 0) {
@ -61,7 +60,7 @@ public class SessionMvcController {
return "redirect:/session"; return "redirect:/session";
} }
@PostMapping(value = "/") @PostMapping(value = "/")
public String saveSession(@RequestParam("price") String price, public String saveSession(@RequestParam("price") String price,
@RequestParam("timestamp") LocalDateTime timestamp, @RequestParam("timestamp") LocalDateTime timestamp,
@RequestParam("cinemaid") Long cinemaId, @RequestParam("cinemaid") Long cinemaId,

View File

@ -5,12 +5,6 @@ body {
.green-mark { .green-mark {
background-color: #38a65d; background-color: #38a65d;
} }
.willSee {
background-color: #38a65d;
}
.delete {
background-color: #e94049;
}
.icon { .icon {
width: 50px; width: 50px;
height: 50px; height: 50px;
@ -18,30 +12,10 @@ body {
hr { hr {
height: 2px !important; height: 2px !important;
} }
.description {
color: #8f9398;
}
.editIcon {
height: 2.5vh;
}
.posterChoiceToTaste {
width: 290px;
height: 437px;
}
.posterFilmPage{ .posterFilmPage{
width: 290px; width: 290px;
height: 437px; height: 437px;
} }
a {
text-decoration: none;
}
a:hover {
color: white;
}
.current a {
color: white;
}
/* for film-page */ /* for film-page */
.table { .table {
@ -81,6 +55,10 @@ form input {
max-width: 300px; max-width: 300px;
} }
form select {
max-width: 300px;
}
table tbody tr td { table tbody tr td {
border: 0px !important; border: 0px !important;
} }
@ -101,12 +79,18 @@ header {
header a { header a {
color: #c2c2c2; color: #c2c2c2;
text-decoration: none;
} }
header a:hover { header a:hover {
color: #ffffff; color: white;
text-decoration: none;
} }
.mainInput { a {
max-width: 200px; text-decoration: none;
}
a:hover {
text-decoration: underline;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -5,10 +5,11 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header">Фильм</div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Фильм</h1>
<div th:text="${errors}" class="margin-bottom alert-danger"></div> <div th:text="${errors}" class="margin-bottom alert-danger"></div>
<form action="#" th:action="@{/cinema/{id}(id=${id})}" th:object="${cinemaDto}" enctype="multipart/form-data" method="post"> <form action="#" th:action="@{/cinema/{id}(id=${id})}" th:object="${cinemaDto}" enctype="multipart/form-data"
method="post">
<div class="mb-3"> <div class="mb-3">
<label for="name" class="form-label">Название</label> <label for="name" class="form-label">Название</label>
<input type="text" class="form-control" id="name" th:field="${cinemaDto.name}" required="true"> <input type="text" class="form-control" id="name" th:field="${cinemaDto.name}" required="true">

View File

@ -5,34 +5,38 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header">Фильмы</div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Фильмы</h1> <div class="d-flex justify-content-between align-items-center">
<div class="d-flex justify-content-end"> <form action="#" th:action="@{/cinema/search/}" class="d-flex">
<a class="btn btn-success button-fixed" <input class="form-control m-1" type="text" name="request" required="true"/>
th:href="@{/cinema/edit}"> <button class="btn btn-secondary m-1" type="submit"><i class="fa-solid fa-magnifying-glass"></i></button>
<i class="fa-solid fa-plus"></i> </form>
</a> <div class="d-flex justify-content-end">
<a type="button" class="btn btn-success m-1"
th:href="@{/cinema/edit}">
<i class="fa-solid fa-plus"></i>
</a>
</div>
</div> </div>
<form action="#" th:action="@{/cinema/search/}"> <hr class="border border-0 bg-black"/>
<input class="form-control mainInput" type="text" name="request" search="true" rounded="true" required="true" />
<button class="border border-0 p-0 ms-2" type="submit"><img class="icon" src="/search.jpg" alt="Поиск" /></button>
</form>
<hr class="border border-0 bg-black" />
<table class="table" id="tbl-items"> <table class="table" id="tbl-items">
<tbody> <tbody>
<tr th:each="cinema, iterator: ${cinemas}"> <tr th:each="cinema, iterator: ${cinemas}">
<td> <td>
<img class="posterItem me-3" th:src="${cinema.image}" alt="${cinema.name}" align="left"/> <img class="posterItem me-3" th:src="${cinema.image}" alt="${cinema.name}" align="left"/>
<div class="d-flex flex-row flex-wrap flex-grow-1 align-items-center"> <div class="d-flex flex-row flex-wrap flex-grow-1 align-items-center">
<div class="pt-3 description d-flex flex-column justify-content-start align-items-center mb-3 fs-6 fw-bold"> <div class="pt-3 d-flex flex-column justify-content-start align-items-center mb-3 fs-6 fw-bold">
<p class="text-start description"> <p class="text-start">
<a class="text-white fs-5 fw-bold pt-3" th:text="${cinema.name}"></a> <a class="text-white fs-5 fw-bold pt-3" th:text="${cinema.name}" href=""></a>
</p> </p>
</div> </div>
<div id="rightPanel" class="d-flex flex-wrap justify-content-end text-white fw-bold fs-4 flex-grow-1"> <div id="rightPanel"
class="d-flex flex-wrap justify-content-end text-white fw-bold fs-4 flex-grow-1">
<div class="rounded p-1 mx-2 green-mark">9.2</div> <div class="rounded p-1 mx-2 green-mark">9.2</div>
<div> <div>
<a type="button" class="m-1 btn btn-primary" th:href="@{/cinema/edit/{id}(id=${cinema.id})}"> <a type="button" class="m-1 btn btn-primary"
th:href="@{/cinema/edit/{id}(id=${cinema.id})}">
<i class="fa fa-pencil"></i> <i class="fa fa-pencil"></i>
</a> </a>
<a type="button" class="m-1 btn btn-danger" <a type="button" class="m-1 btn btn-danger"
@ -47,7 +51,7 @@
</button> </button>
</form> </form>
</div> </div>
<hr class="border border-0 bg-black" /> <hr class="border border-0 bg-black"/>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -5,28 +5,28 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header">Пользователь</div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Пользователь</h1> <div th:text="${errors}" class="margin-bottom alert-danger"></div>
<div th:text="${errors}" class="margin-bottom alert-danger"></div> <form action="#" th:action="@{/customer/{id}(id=${id})}" th:object="${customerDto}" method="post">
<form action="#" th:action="@{/customer/{id}(id=${id})}" th:object="${customerDto}" method="post"> <div class="mb-3">
<div class="mb-3"> <label for="login" class="form-label">Логин</label>
<label for="login" class="form-label">Логин</label> <input type="text" class="form-control" id="login" th:field="${customerDto.login}" required="true">
<input type="text" class="form-control" id="login" th:field="${customerDto.login}" required="true"> </div>
</div> <div class="mb-3">
<div class="mb-3"> <label for="password" class="form-label">Пароль</label>
<label for="password" class="form-label">Пароль</label> <input type="text" class="form-control" id="password" th:field="${customerDto.password}" required="true">
<input type="text" class="form-control" id="password" th:field="${customerDto.password}" required="true"> </div>
</div> <div class="mb-3">
<div class="mb-3"> <button type="submit" class="btn btn-primary button-fixed">
<button type="submit" class="btn btn-primary button-fixed"> <span th:if="${id == null}">Добавить</span>
<span th:if="${id == null}">Добавить</span> <span th:if="${id != null}">Обновить</span>
<span th:if="${id != null}">Обновить</span> </button>
</button> <a class="btn btn-secondary button-fixed" th:href="@{/customer}">
<a class="btn btn-secondary button-fixed" th:href="@{/customer}"> Назад
Назад </a>
</a> </div>
</div> </form>
</form>
</div> </div>
</body> </body>
</html> </html>

View File

@ -5,8 +5,8 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header">Пользователи</div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Пользователи</h1>
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
<a class="btn btn-success button-fixed" <a class="btn btn-success button-fixed"
th:href="@{/customer/edit}"> th:href="@{/customer/edit}">

View File

@ -8,7 +8,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/> <meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="icon" href="/favicon.svg"> <link rel="icon" href="/favicon.svg">
<script type="text/javascript" src="/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script> <script type="text/javascript" src="/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css"/> <link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/webjars/font-awesome/6.1.0/css/all.min.css"/> <link rel="stylesheet" href="/webjars/font-awesome/6.1.0/css/all.min.css"/>
<link rel="stylesheet" href="/css/style.css"/> <link rel="stylesheet" href="/css/style.css"/>
@ -40,29 +39,19 @@
</header> </header>
<div class="container rounded my-5 p-4 content"> <div class="container rounded my-5 p-4 content">
<div class="content_header rounded-top p-2 mb-2"> <div class="content_header rounded-top p-2 mb-2">
<h1 class="fs-1 fw-bold text-white ms-5">Киносайт</h1> <h1 class="fs-1 fw-bold text-white ms-5">
<div layout:fragment="content_header">
</div>
</h1>
</div> </div>
<div layout:fragment="content"> <div layout:fragment="content">
</div> </div>
</div> </div>
</body> </body>
<th:block layout:fragment="scripts"> <th:block layout:fragment="scripts">
<script>
$(function () {
var location = window.location.href;
var cur_url = '/' + location.split('/').pop();
$('.menu li').each(function () {
var link = $(this).find('a').attr('href');
if (cur_url == link) {
$(this).addClass('current');
}
});
});
</script>
</th:block> </th:block>
<footer class="d-flex align-items-center fw-bold fs-4 p-2 ps-5">2022 г. <footer class="d-flex align-items-center fw-bold fs-4 p-2 ps-5">2022 г.
<nav class="d-flex justify-content-center flex-grow-1"><a href="https://vk.com/id0" target="_blank"><img class="icon" src="/vk.jpg" alt="VK" /></a></nav> <nav class="d-flex justify-content-center flex-grow-1"><a href="https://vk.com/id0" target="_blank"><img
class="icon" src="/vk.jpg" alt="VK"/></a></nav>
</footer> </footer>
</html> </html>

View File

@ -5,6 +5,7 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header" th:text="'Главная'"></div>
<div layout:fragment="content"> <div layout:fragment="content">
<div>It's works!</div> <div>It's works!</div>
<a href="123">ERROR</a> <a href="123">ERROR</a>

View File

@ -5,12 +5,11 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header">Создание заказа</div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1 th:if="${id == null}">Создание заказа</h1>
<h1 th:if="${id != null}">Добавление сеансов в заказ</h1>
<div th:text="${errors}" class="margin-bottom alert-danger"></div> <div th:text="${errors}" class="margin-bottom alert-danger"></div>
<form action="#" th:action="@{/order/{id}(id=${id})}" th:object="${orderDto}" method="post" th:if="${id == null}"> <form action="#" th:action="@{/order/{id}(id=${id})}" th:object="${orderDto}" method="post" th:if="${id == null}">
<div class="mb-3" > <div class="mb-3">
<label for="customer" class="form-label">Пользователь</label> <label for="customer" class="form-label">Пользователь</label>
<select id="customer" class="form-select" th:field="${orderDto.customerId}" required="true"> <select id="customer" class="form-select" th:field="${orderDto.customerId}" required="true">
<option th:each="value: ${customers}" <option th:each="value: ${customers}"
@ -29,29 +28,6 @@
</a> </a>
</div> </div>
</form> </form>
<form action="#" th:action="@{/order/{id}(id=${id})}" th:object="${orderSessionDto}" method="post" th:if="${id != null}">
<div class="mb-3">
<label for="session" class="form-label">Сеанс</label>
<select id="session" class="form-select" required="true" th:name="session">
<option th:each="value: ${sessions}"
th:value="${value.id}"
th:text="${value.cinema.name} + ' ' + ${value.timestamp}">
</option>
</select>
</div>
<div class="mb-3" >
<label for="count" class="form-label">Количество</label>
<input type="number" class="form-control" min="1" id="count" th:name="count" th:field="${orderSessionDto.count}" required="true">
</div>
<div class="mb-3">
<button type="submit" class="btn btn-primary button-fixed">
<span>Добавить</span>
</button>
<a class="btn btn-secondary button-fixed" th:href="@{/order}">
Назад
</a>
</div>
</form>
</div> </div>
</body> </body>
</html> </html>

View File

@ -5,8 +5,8 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header">Заказы</div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Заказы</h1>
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
<a class="btn btn-success button-fixed" <a class="btn btn-success button-fixed"
th:href="@{/order/edit}"> th:href="@{/order/edit}">

View File

@ -5,65 +5,66 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header" th:text="'Сеансы заказа ' + ${id}"></div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1 th:text="'Сеансы заказа ' + ${id}"></h1> <form action="#" th:action="@{/order/{id}(id=${id})}" method="post">
<form action="#" th:action="@{/order/{id}(id=${id})}" method="post"> <div class="mb-3">
<div class="mb-3"> <label for="session" class="form-label">Сеанс</label>
<label for="session" class="form-label">Сеанс</label> <select id="session" class="form-select" th:name="session" required="true">
<select id="session" class="form-select" th:name="session" required="true"> <option th:each="value: ${sessions}"
<option th:each="value: ${sessions}" th:value="${value.id}"
th:value="${value.id}" th:text="${value.cinema.name} + ' ' + ${value.timestamp}">
th:text="${value.cinema.name} + ' ' + ${value.timestamp}"> </option>
</option> </select>
</select>
</div>
<div class="mb-3">
<label for="count" class="form-label">Количество</label>
<input type="number" class="form-control" min="1" id="count" th:name="count" th:field="${orderSessionDto.count}" required="true">
</div>
<div class="mb-3">
<button type="submit" class="btn btn-primary button-fixed">
<span>Добавить</span>
</button>
<a class="btn btn-secondary button-fixed" th:href="@{/order}">
Назад
</a>
</div>
</form>
<table class="table text-white" id="tbl-items">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Price</th>
<th scope="col">Cinema</th>
<th scope="col">Timestamp</th>
<th scope="col">Count</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr th:each="item, iterator: ${orderSessions}">
<td th:text="${item.key.id}"/>
<td th:text="${item.key.price}"/>
<td th:text="${item.key.cinema.name}"/>
<td th:text="${item.key.timestamp}"/>
<td th:text="${item.value}"/>
<td>
<div>
<a type="button" class="m-1 btn btn-danger"
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${item.key.id}').click()|">
<i class="fa fa-trash"></i>
</a>
</div> </div>
<form th:action="@{'/order/' + ${id} + '?session=' + ${item.key.id}}" method="post"> <div class="mb-3">
<button th:id="'remove-' + ${item.key.id}" type="submit" style="display: none"> <label for="count" class="form-label">Количество</label>
Удалить <input type="number" class="form-control" min="1" id="count" th:name="count"
</button> th:field="${orderSessionDto.count}" required="true">
</form> </div>
</td> <div class="mb-3">
</tr> <button type="submit" class="btn btn-primary button-fixed">
</tbody> <span>Добавить</span>
</table> </button>
<a class="btn btn-secondary button-fixed" th:href="@{/order}">
Назад
</a>
</div>
</form>
<table class="table text-white" id="tbl-items">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Price</th>
<th scope="col">Cinema</th>
<th scope="col">Timestamp</th>
<th scope="col">Count</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr th:each="item, iterator: ${orderSessions}">
<td th:text="${item.key.id}"/>
<td th:text="${item.key.price}"/>
<td th:text="${item.key.cinema.name}"/>
<td th:text="${item.key.timestamp}"/>
<td th:text="${item.value}"/>
<td>
<div>
<a type="button" class="m-1 btn btn-danger"
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${item.key.id}').click()|">
<i class="fa fa-trash"></i>
</a>
</div>
<form th:action="@{'/order/' + ${id} + '?session=' + ${item.key.id}}" method="post">
<button th:id="'remove-' + ${item.key.id}" type="submit" style="display: none">
Удалить
</button>
</form>
</td>
</tr>
</tbody>
</table>
</div> </div>
</body> </body>
</html> </html>

View File

@ -5,13 +5,14 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header" th:text="'Сеанс'"></div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Сеанс</h1>
<div th:text="${errors}" class="margin-bottom alert-danger"></div> <div th:text="${errors}" class="margin-bottom alert-danger"></div>
<form action="#" th:action="@{/session/{id}(id=${id})}" th:object="${sessionDto}" method="post"> <form action="#" th:action="@{/session/{id}(id=${id})}" th:object="${sessionDto}" method="post">
<div class="mb-3"> <div class="mb-3">
<label for="price" class="form-label">Цена</label> <label for="price" class="form-label">Цена</label>
<input type="number" class="form-control" min="1" step="0.01" id="price" th:field="${sessionDto.price}" required="true"> <input type="number" class="form-control" min="1" step="0.01" id="price" th:field="${sessionDto.price}"
required="true">
</div> </div>
<div class="mb-3" th:if="${id == null}"> <div class="mb-3" th:if="${id == null}">
<label for="cinemaid" class="form-label">Фильм</label> <label for="cinemaid" class="form-label">Фильм</label>
@ -23,12 +24,14 @@
</select> </select>
</div> </div>
<div class="mb-3" th:if="${id == null}"> <div class="mb-3" th:if="${id == null}">
<label for="count" class="form-label">Кол-во сеансов</label> <label for="count" class="form-label">Количество сеансов</label>
<input type="number" class="form-control" min="1" id="count" th:field="${sessionDto.maxCount}" required="true"> <input type="number" class="form-control" min="1" id="count" th:field="${sessionDto.maxCount}"
required="true">
</div> </div>
<div class="mb-3" th:if="${id == null}"> <div class="mb-3" th:if="${id == null}">
<label for="date" class="form-label">Дата</label> <label for="date" class="form-label">Дата</label>
<input type="datetime-local" class="form-control" id="date" th:field="${sessionDto.timestamp}" required="true"> <input type="datetime-local" class="form-control" id="date" th:field="${sessionDto.timestamp}"
required="true">
</div> </div>
<div class="mb-3"> <div class="mb-3">
<button type="submit" class="btn btn-primary button-fixed"> <button type="submit" class="btn btn-primary button-fixed">

View File

@ -5,53 +5,53 @@
<head> <head>
</head> </head>
<body> <body>
<div layout:fragment="content_header" th:text="'Сеансы'"></div>
<div layout:fragment="content"> <div layout:fragment="content">
<h1>Сеансы</h1> <div class="d-flex justify-content-end">
<div class="d-flex justify-content-end"> <a class="btn btn-success button-fixed"
<a class="btn btn-success button-fixed" th:href="@{/session/edit}">
th:href="@{/session/edit}"> <i class="fa-solid fa-plus"></i>
<i class="fa-solid fa-plus"></i> </a>
</a> </div>
</div> <table class="table text-white" id="tbl-items">
<table class="table text-white" id="tbl-items"> <thead>
<thead> <tr>
<tr> <th scope="col">ID</th>
<th scope="col">ID</th> <th scope="col">Price</th>
<th scope="col">Price</th> <th scope="col">Cinema</th>
<th scope="col">Cinema</th> <th scope="col">Timestamp</th>
<th scope="col">Timestamp</th> <th scope="col">Capacity</th>
<th scope="col">Capacity</th> <th scope="col">MaxCount</th>
<th scope="col">MaxCount</th> <th scope="col"></th>
<th scope="col"></th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> <tr th:each="item, iterator: ${sessions}">
<tr th:each="item, iterator: ${sessions}"> <td th:text="${item.id}"/>
<td th:text="${item.id}"/> <td th:text="${item.price}"/>
<td th:text="${item.price}"/> <td th:text="${item.cinema.name}"/>
<td th:text="${item.cinema.name}"/> <td th:text="${item.timestamp}"/>
<td th:text="${item.timestamp}"/> <td th:text="${item.capacity} == null ? ${item.maxCount} : ${item.maxCount}-${item.capacity}"/>
<td th:text="${item.capacity} == null ? ${item.maxCount} : ${item.maxCount}-${item.capacity}"/> <td th:text="${item.maxCount}"/>
<td th:text="${item.maxCount}"/> <td>
<td> <div>
<div> <a type="button" class="m-1 btn btn-primary" th:href="@{/session/edit/{id}(id=${item.id})}">
<a type="button" class="m-1 btn btn-primary" th:href="@{/session/edit/{id}(id=${item.id})}"> <i class="fa fa-pencil"></i>
<i class="fa fa-pencil"></i> </a>
</a> <a type="button" class="m-1 btn btn-danger"
<a type="button" class="m-1 btn btn-danger" th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${item.id}').click()|">
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${item.id}').click()|"> <i class="fa fa-trash"></i>
<i class="fa fa-trash"></i> </a>
</a> </div>
</div> <form th:action="@{/session/delete/{id}(id=${item.id})}" method="post">
<form th:action="@{/session/delete/{id}(id=${item.id})}" method="post"> <button th:id="'remove-' + ${item.id}" type="submit" style="display: none">
<button th:id="'remove-' + ${item.id}" type="submit" style="display: none"> Удалить
Удалить </button>
</button> </form>
</form> </td>
</td> </tr>
</tr> </tbody>
</tbody> </table>
</table>
</div> </div>
</body> </body>
</html> </html>