<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{default}">
<head>
    <link rel="stylesheet" href="/css/tank.css"/>
</head>
<body>
    <div layout:fragment="content">
        <div class="Group_create_level">
            <h1>Генератор танков</h1>
        </div>
        <form class="justify-content-around" action="#" th:action="@{/tank/{id}(id=${id})}" th:object="${supportTankDTO}" method="post">
            <div class="myModalContent">
                <label for="name" class="form-label">Название: </label>
                <input
                        type='text'
                        class="add-nation-input form-control"
                        id="name"
                        th:field="${supportTankDTO.name}"
                        required="true"
                />
                <label for="name" class="form-label">Нация: </label>
                <select id="nation" class="form-select" th:field="${supportTankDTO.nationId}" required="true">
                    <option th:each="value: ${nations}"
                            th:value="${value.id}"
                            th:text="${value.nation}">
                    </option>
                </select>
                <label for="name" class="form-label">Уровень: </label>
                <select id="level" class="form-select" th:field="${supportTankDTO.levelId}" required="true">
                    <option th:each="value: ${levels}"
                            th:value="${value.id}"
                            th:text="${value.level}">
                    </option>
                </select>
                <label for="name" class="form-label">Стоимость: </label>
                <input
                        type='text'
                        class="add-nation-input form-control"
                        id="cost"
                        th:field="${supportTankDTO.cost}"
                        required="true"
                />
                <button
                        class="modalButton"
                        type="submit"
                >
                    <span th:if="${id == null}">Добавить</span>
                    <span th:if="${id != null}">Сохранить</span>
                </button>
                <button
                        class="modalButton"
                        type="submit"
                        th:href="@{/tank}"
                >
                    Назад
                </button>
            </div>
        </form>
    </div>
</body>
</html>