<!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/style.css"/>
    <link rel="stylesheet" href="/css/client.css"/>
    <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="@{/client/edit/}">
                Создать клиента
            </a>
        </h2>
    </div>
    <div>
        <h1 style="text-align: center; font-family: courier, monospace; background: #FF652F; border-radius: 10px">
            Список существующих клиентов:
        </h1>
    </div>
    <div th:each="client, iterator: ${clients}">
        <div class="client-card">
            <p class="client-attribute" th:text="'Номер: ' + ${client.id}"/>
            <p class="client-attribute" th:text="'Никнейм: ' + ${client.nickName}"/>
            <p class="client-attribute" th:text="'Баланс: ' + ${client.balance}"/>
            <div class='client-button-group'>
                <form th:action="@{/client/edit/{id}(id=${client.id})}" method="get">
                    <button class="client-button" type="submit"
                            th:id="'edit-' + ${client.id}"
                    >
                        Редактировать
                    </button>
                </form>
                <form th:action="@{/client/delete/{id}(id=${client.id})}" method="post">
                    <button th:id="'remove-' + ${client.id}" class="client-button" type="submit">
                        Удалить
                    </button>
                </form>
                <form th:action="@{/client/tanksOfClient/{id}(id=${client.id})}" method="get">
                    <button th:id="'list-tank-' + ${client.id}" class="client-button" type="submit">
                        Список танков
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
<th:block layout:fragment="scripts">
</th:block>
</html>