Отчёт.

This commit is contained in:
Programmist73 2023-05-26 18:44:06 +04:00
parent 6d178b58aa
commit d75c758ee1
5 changed files with 111 additions and 203 deletions

View File

@ -38,27 +38,5 @@
</div> </div>
</form> </form>
</div> </div>
<!--<div layout:fragment="content">
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
<form action="#" th:action="@{/student/{id}(id=${id})}" th:object="${studentDto}" method="post">
<div class="mb-3">
<label for="firstName" class="form-label">Имя</label>
<input type="text" class="form-control" id="firstName" th:field="${studentDto.firstName}" required="true">
</div>
<div class="mb-3">
<label for="lastName" class="form-label">Фамилия</label>
<input type="text" class="form-control" id="lastName" th:field="${studentDto.lastName}" 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="@{/student}">
Назад
</a>
</div>
</form>
</div>-->
</body> </body>
</html> </html>

View File

@ -8,39 +8,17 @@
<link rel="stylesheet" href="/css/modal-nation.css"/> <link rel="stylesheet" href="/css/modal-nation.css"/>
</head> </head>
<body> <body>
<div layout:fragment="content"> <div layout:fragment="content">
<form action="#" th:action="@{/nation/{id}(id=${id})}" th:object="${fullNationDTO}" method="get"> <form action="#" th:action="@{/nation/{id}(id=${id})}" th:object="${fullNationDTO}" method="get">
<div th:each="tank, iterator: ${fullNationDTO.tanks}"> <div th:each="tank, iterator: ${fullNationDTO.tanks}">
<div class="nation-card"> <div class="nation-card">
<p class="nation-attribute" th:text="'Номер: ' + ${tank.id}"/> <p class="nation-attribute" th:text="'Номер: ' + ${tank.id}"/>
<p class="nation-attribute" th:text="'Название: ' + ${tank.name}"/> <p class="nation-attribute" th:text="'Название: ' + ${tank.name}"/>
<p class="nation-attribute" th:text="'Стоимость: ' + ${tank.cost}"/> <p class="nation-attribute" th:text="'Стоимость: ' + ${tank.cost}"/>
<p class="nation-attribute" th:text="'Уровень: ' + ${tank.level.level}"/> <p class="nation-attribute" th:text="'Уровень: ' + ${tank.level.level}"/>
</div>
</div> </div>
</div> </form>
</form> </div>
</div>
<!--<div layout:fragment="content">
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
<form action="#" th:action="@{/student/{id}(id=${id})}" th:object="${studentDto}" method="post">
<div class="mb-3">
<label for="firstName" class="form-label">Имя</label>
<input type="text" class="form-control" id="firstName" th:field="${studentDto.firstName}" required="true">
</div>
<div class="mb-3">
<label for="lastName" class="form-label">Фамилия</label>
<input type="text" class="form-control" id="lastName" th:field="${studentDto.lastName}" 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="@{/student}">
Назад
</a>
</div>
</form>
</div>-->
</body> </body>
</html> </html>

View File

@ -9,75 +9,47 @@
<script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script> <script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
</head> </head>
<body> <body>
<div layout:fragment="content"> <div layout:fragment="content">
<div class="Group_create_level"> <div class="Group_create_level">
<h1>Генератор наций</h1> <h1>Генератор наций</h1>
<h2> <h2>
<a class="add-level-button text-dark" type="button" <a class="add-level-button text-dark" type="button"
th:href="@{/nation/edit/}"> th:href="@{/nation/edit/}">
Создать нацию Создать нацию
</a> </a>
</h2> </h2>
</div> </div>
<div> <div>
<h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px"> <h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px">
Список существующих наций: Список существующих наций:
</h1> </h1>
</div> </div>
<div th:each="nation, iterator: ${nations}"> <div th:each="nation, iterator: ${nations}">
<div class="nation-card"> <div class="nation-card">
<p class="nation-attribute" th:text="'Номер: ' + ${nation.id}"/> <p class="nation-attribute" th:text="'Номер: ' + ${nation.id}"/>
<p class="nation-attribute" th:text="'Нация: ' + ${nation.nation}"/> <p class="nation-attribute" th:text="'Нация: ' + ${nation.nation}"/>
<div class='nation-button-group'> <div class='nation-button-group'>
<form th:action="@{/nation/edit/{id}(id=${nation.id})}" method="get"> <form th:action="@{/nation/edit/{id}(id=${nation.id})}" method="get">
<button class="nation-button" type="submit" <button class="nation-button" type="submit"
th:id="'edit-' + ${nation.id}" th:id="'edit-' + ${nation.id}"
> >
Редактировать Редактировать
</button> </button>
</form> </form>
<form th:action="@{/nation/delete/{id}(id=${nation.id})}" method="post"> <form th:action="@{/nation/delete/{id}(id=${nation.id})}" method="post">
<button th:id="'remove-' + ${nation.id}" class="nation-button" type="submit"> <button th:id="'remove-' + ${nation.id}" class="nation-button" type="submit">
Удалить Удалить
</button> </button>
</form> </form>
<form th:action="@{/nation/editTank/{id}(id=${nation.id})}" method="get"> <form th:action="@{/nation/editTank/{id}(id=${nation.id})}" method="get">
<button th:id="'edit-tank-' + ${nation.id}" class="nation-button" type="submit"> <button th:id="'edit-tank-' + ${nation.id}" class="nation-button" type="submit">
Список танков Список танков
</button> </button>
</form> </form>
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="table-responsive">
<table class="table">
<tbody>
<tr th:each="nation, iterator: ${nations}">
<th scope="row" th:text="${iterator.index} + 1"/>
<td th:text="${nation.id}"/>
<td th:text="${nation.nation}" style="width: 60%"/>
<td style="width: 10%">
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-warning button-fixed button-sm"
th:href="@{/nation/edit/{id}(id=${nation.id})}">
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
</a>
<button type="button" class="btn btn-danger button-fixed button-sm"
th:attr="onclick=|confirm('Удалить нацию?') && document.getElementById('remove-${nation.id}').click()|">
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
</button>
</div>
<form th:action="@{/nation/delete/{id}(id=${nation.id})}" method="post">
<button th:id="'remove-' + ${nation.id}" type="submit" style="display: none">
Удалить
</button>
</form>
</td>
</tr>
</tbody>
</table>
</div> -->
</div>
</body> </body>
<th:block layout:fragment="scripts"> <th:block layout:fragment="scripts">
</th:block> </th:block>

View File

@ -9,89 +9,69 @@
<script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script> <script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
</head> </head>
<body> <body>
<div layout:fragment="content"> <div layout:fragment="content">
<div class="Group_create_level"> <div class="Group_create_level">
<h1>Генератор танков</h1> <h1>Генератор танков</h1>
<h2> <h2>
<a class="add-tank-button text-dark" type="button" <a class="add-tank-button text-dark" type="button"
th:href="@{/tank/edit/}"> th:href="@{/tank/edit/}">
Создать танк Создать танк
</a> </a>
</h2> </h2>
<form id="filterForm" th:action="@{/tank/filteredList}" th:object="${sortDTO}" method="get"> <form id="filterForm" th:action="@{/tank/filteredList}" th:object="${sortDTO}" method="get">
<button class="tank-button" type="submit" <button class="tank-button" type="submit"
th:id="filterStart" th:id="filterStart"
> >
Фильтрация Фильтрация
</button> </button>
<select id="nation" class="form-select" required="true" th:field="*{nation}"> <select id="nation" class="form-select" required="true" th:field="*{nation}">
<option th:each="value: ${nations}" <option th:each="value: ${nations}"
th:value="${value.nation}" th:value="${value.nation}"
th:text="${value.nation}"> th:text="${value.nation}">
</option> </option>
</select> </select>
<select id="firstLevel" class="form-select" required="true" th:field="*{firstLevel}"> <select id="firstLevel" class="form-select" required="true" th:field="*{firstLevel}">
<option th:each="value: ${levels}" <option th:each="value: ${levels}"
th:value="${value.level}" th:value="${value.level}"
th:text="${value.level}"> th:text="${value.level}">
</option> </option>
</select> </select>
<select id="secondLevel" class="form-select" required="true" th:field="*{secondLevel}"> <select id="secondLevel" class="form-select" required="true" th:field="*{secondLevel}">
<option th:each="value: ${levels}" <option th:each="value: ${levels}"
th:value="${value.level}" th:value="${value.level}"
th:text="${value.level}"> th:text="${value.level}">
</option> </option>
</select> </select>
</form> </form>
</div> </div>
<div> <div>
<h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px"> <h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px">
Список существующих танков: Список существующих танков:
</h1> </h1>
</div> </div>
<div th:each="tank, iterator: ${tanks}"> <div th:each="tank, iterator: ${tanks}">
<div class="tank-card"> <div class="tank-card">
<p class="tank-attribute" th:text="'Номер: ' + ${tank.id}"/> <p class="tank-attribute" th:text="'Номер: ' + ${tank.id}"/>
<p class="tank-attribute" th:text="'Название: ' + ${tank.name}"/> <p class="tank-attribute" th:text="'Название: ' + ${tank.name}"/>
<p class="tank-attribute" th:text="'Нация: ' + ${tank.nation.getNation()}"/> <p class="tank-attribute" th:text="'Нация: ' + ${tank.nation.getNation()}"/>
<p class="tank-attribute" th:text="'Уровень: ' + ${tank.level.getLevel()}"/> <p class="tank-attribute" th:text="'Уровень: ' + ${tank.level.getLevel()}"/>
<p class="tank-attribute" th:text="'Стоимость: ' + ${tank.cost}"/> <p class="tank-attribute" th:text="'Стоимость: ' + ${tank.cost}"/>
<div class='tank-button-group'> <div class='tank-button-group'>
<form th:action="@{/tank/edit/{id}(id=${tank.id})}" method="get"> <form th:action="@{/tank/edit/{id}(id=${tank.id})}" method="get">
<button class="tank-button" type="submit" <button class="tank-button" type="submit"
th:id="'edit-' + ${tank.id}" th:id="'edit-' + ${tank.id}"
> >
Редактировать Редактировать
</button> </button>
</form> </form>
<form th:action="@{/tank/delete/{id}(id=${tank.id})}" method="post"> <form th:action="@{/tank/delete/{id}(id=${tank.id})}" method="post">
<button th:id="'remove-' + ${tank.id}" class="tank-button" type="submit"> <button th:id="'remove-' + ${tank.id}" class="tank-button" type="submit">
Удалить Удалить
</button> </button>
</form> </form>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
</body> </body>
<script> </html>
$(document).ready(function() {
$('#filterStart').on('click', function() {
$.ajax({
url: "http://localhost:8080/api/tank/filteredList/?nation='
+escape(document.forms['filterForm'].elements['nation'].value)&
+escape(document.forms['filterForm'].elements['firstLevel'].value)&
+escape(document.forms['filterForm'].elements['secondLevel'].value)"
}).then(function (data) {
});
});
});
</script>
</html>
<!--
-->
<!--th:action="@{/tank/filteredList/{nation}(nation=${document.elements['nation'].value}){firstLevel}(firstLevel=${document.elements['firstLevel'].value}){secondLevel}(secondLevel=${document.elements['secondLevel'].value})}"-->