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

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";
}
@GetMapping (value = "/search/")
@GetMapping(value = "/search/")
public String searchCinema(@RequestParam String request,
Model model) {
Model model) {
List<CinemaDto> cinemas = cinemaService.findAllCinemas(request)
.stream().map(CinemaDto::new).toList();
model.addAttribute("cinemas", cinemas);
@ -62,11 +62,11 @@ public class CinemaMvcController {
return "cinema-edit";
}
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);
} else {
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);
}
return "redirect:/cinema";

View File

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

View File

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

View File

@ -5,12 +5,6 @@ body {
.green-mark {
background-color: #38a65d;
}
.willSee {
background-color: #38a65d;
}
.delete {
background-color: #e94049;
}
.icon {
width: 50px;
height: 50px;
@ -18,30 +12,10 @@ body {
hr {
height: 2px !important;
}
.description {
color: #8f9398;
}
.editIcon {
height: 2.5vh;
}
.posterChoiceToTaste {
width: 290px;
height: 437px;
}
.posterFilmPage{
width: 290px;
height: 437px;
}
a {
text-decoration: none;
}
a:hover {
color: white;
}
.current a {
color: white;
}
/* for film-page */
.table {
@ -81,6 +55,10 @@ form input {
max-width: 300px;
}
form select {
max-width: 300px;
}
table tbody tr td {
border: 0px !important;
}
@ -101,12 +79,18 @@ header {
header a {
color: #c2c2c2;
text-decoration: none;
}
header a:hover {
color: #ffffff;
color: white;
text-decoration: none;
}
.mainInput {
max-width: 200px;
a {
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>
<body>
<div layout:fragment="content_header">Фильм</div>
<div layout:fragment="content">
<h1>Фильм</h1>
<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">
<label for="name" class="form-label">Название</label>
<input type="text" class="form-control" id="name" th:field="${cinemaDto.name}" required="true">

View File

@ -5,34 +5,38 @@
<head>
</head>
<body>
<div layout:fragment="content_header">Фильмы</div>
<div layout:fragment="content">
<h1>Фильмы</h1>
<div class="d-flex justify-content-end">
<a class="btn btn-success button-fixed"
th:href="@{/cinema/edit}">
<i class="fa-solid fa-plus"></i>
</a>
<div class="d-flex justify-content-between align-items-center">
<form action="#" th:action="@{/cinema/search/}" class="d-flex">
<input class="form-control m-1" type="text" name="request" required="true"/>
<button class="btn btn-secondary m-1" type="submit"><i class="fa-solid fa-magnifying-glass"></i></button>
</form>
<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>
<form action="#" th:action="@{/cinema/search/}">
<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" />
<hr class="border border-0 bg-black"/>
<table class="table" id="tbl-items">
<tbody>
<tr th:each="cinema, iterator: ${cinemas}">
<td>
<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="pt-3 description d-flex flex-column justify-content-start align-items-center mb-3 fs-6 fw-bold">
<p class="text-start description">
<a class="text-white fs-5 fw-bold pt-3" th:text="${cinema.name}"></a>
<div class="pt-3 d-flex flex-column justify-content-start align-items-center mb-3 fs-6 fw-bold">
<p class="text-start">
<a class="text-white fs-5 fw-bold pt-3" th:text="${cinema.name}" href=""></a>
</p>
</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>
<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>
</a>
<a type="button" class="m-1 btn btn-danger"
@ -47,7 +51,7 @@
</button>
</form>
</div>
<hr class="border border-0 bg-black" />
<hr class="border border-0 bg-black"/>
</td>
</tr>
</tbody>

View File

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

View File

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

View File

@ -8,7 +8,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<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/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/font-awesome/6.1.0/css/all.min.css"/>
<link rel="stylesheet" href="/css/style.css"/>
@ -40,29 +39,19 @@
</header>
<div class="container rounded my-5 p-4 content">
<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 layout:fragment="content">
</div>
</div>
</body>
<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>
<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>
</html>

View File

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

View File

@ -5,12 +5,11 @@
<head>
</head>
<body>
<div layout:fragment="content_header">Создание заказа</div>
<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>
<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>
<select id="customer" class="form-select" th:field="${orderDto.customerId}" required="true">
<option th:each="value: ${customers}"
@ -29,29 +28,6 @@
</a>
</div>
</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>
</body>
</html>

View File

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

View File

@ -5,65 +5,66 @@
<head>
</head>
<body>
<div layout:fragment="content_header" th:text="'Сеансы заказа ' + ${id}"></div>
<div layout:fragment="content">
<h1 th:text="'Сеансы заказа ' + ${id}"></h1>
<form action="#" th:action="@{/order/{id}(id=${id})}" method="post">
<div class="mb-3">
<label for="session" class="form-label">Сеанс</label>
<select id="session" class="form-select" th:name="session" required="true">
<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>
<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>
<form action="#" th:action="@{/order/{id}(id=${id})}" method="post">
<div class="mb-3">
<label for="session" class="form-label">Сеанс</label>
<select id="session" class="form-select" th:name="session" required="true">
<option th:each="value: ${sessions}"
th:value="${value.id}"
th:text="${value.cinema.name} + ' ' + ${value.timestamp}">
</option>
</select>
</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 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>
<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>
</body>
</html>

View File

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

View File

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