Отчёт.

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>
</form>
</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>
</html>

View File

@ -8,39 +8,17 @@
<link rel="stylesheet" href="/css/modal-nation.css"/>
</head>
<body>
<div layout:fragment="content">
<form action="#" th:action="@{/nation/{id}(id=${id})}" th:object="${fullNationDTO}" method="get">
<div th:each="tank, iterator: ${fullNationDTO.tanks}">
<div class="nation-card">
<p class="nation-attribute" th:text="'Номер: ' + ${tank.id}"/>
<p class="nation-attribute" th:text="'Название: ' + ${tank.name}"/>
<p class="nation-attribute" th:text="'Стоимость: ' + ${tank.cost}"/>
<p class="nation-attribute" th:text="'Уровень: ' + ${tank.level.level}"/>
<div layout:fragment="content">
<form action="#" th:action="@{/nation/{id}(id=${id})}" th:object="${fullNationDTO}" method="get">
<div th:each="tank, iterator: ${fullNationDTO.tanks}">
<div class="nation-card">
<p class="nation-attribute" th:text="'Номер: ' + ${tank.id}"/>
<p class="nation-attribute" th:text="'Название: ' + ${tank.name}"/>
<p class="nation-attribute" th:text="'Стоимость: ' + ${tank.cost}"/>
<p class="nation-attribute" th:text="'Уровень: ' + ${tank.level.level}"/>
</div>
</div>
</div>
</form>
</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>-->
</form>
</div>
</body>
</html>

View File

@ -9,75 +9,47 @@
<script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<div layout:fragment="content">
<div class="Group_create_level">
<h1>Генератор наций</h1>
<h2>
<a class="add-level-button text-dark" type="button"
th:href="@{/nation/edit/}">
Создать нацию
</a>
</h2>
</div>
<div>
<h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px">
Список существующих наций:
</h1>
</div>
<div th:each="nation, iterator: ${nations}">
<div class="nation-card">
<p class="nation-attribute" th:text="'Номер: ' + ${nation.id}"/>
<p class="nation-attribute" th:text="'Нация: ' + ${nation.nation}"/>
<div class='nation-button-group'>
<form th:action="@{/nation/edit/{id}(id=${nation.id})}" method="get">
<button class="nation-button" type="submit"
th:id="'edit-' + ${nation.id}"
>
Редактировать
</button>
</form>
<form th:action="@{/nation/delete/{id}(id=${nation.id})}" method="post">
<button th:id="'remove-' + ${nation.id}" class="nation-button" type="submit">
Удалить
</button>
</form>
<form th:action="@{/nation/editTank/{id}(id=${nation.id})}" method="get">
<button th:id="'edit-tank-' + ${nation.id}" class="nation-button" type="submit">
Список танков
</button>
</form>
<div layout:fragment="content">
<div class="Group_create_level">
<h1>Генератор наций</h1>
<h2>
<a class="add-level-button text-dark" type="button"
th:href="@{/nation/edit/}">
Создать нацию
</a>
</h2>
</div>
<div>
<h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px">
Список существующих наций:
</h1>
</div>
<div th:each="nation, iterator: ${nations}">
<div class="nation-card">
<p class="nation-attribute" th:text="'Номер: ' + ${nation.id}"/>
<p class="nation-attribute" th:text="'Нация: ' + ${nation.nation}"/>
<div class='nation-button-group'>
<form th:action="@{/nation/edit/{id}(id=${nation.id})}" method="get">
<button class="nation-button" type="submit"
th:id="'edit-' + ${nation.id}"
>
Редактировать
</button>
</form>
<form th:action="@{/nation/delete/{id}(id=${nation.id})}" method="post">
<button th:id="'remove-' + ${nation.id}" class="nation-button" type="submit">
Удалить
</button>
</form>
<form th:action="@{/nation/editTank/{id}(id=${nation.id})}" method="get">
<button th:id="'edit-tank-' + ${nation.id}" class="nation-button" type="submit">
Список танков
</button>
</form>
</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>
<th:block layout:fragment="scripts">
</th:block>

View File

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