<!DOCTYPE html>
<html lang="fr" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="fragments.html :: head(#{materialType.delete.title}, null)"></th:block>

    <style>
        table {
            margin: auto;
            text-align: left;
        }

        td {
            min-width: 100px;
        }
    </style>
</head>
<body>

<!-- Fragment de l'entête -->
<header th:include="fragments.html :: header(false)"></header>
<!-- Corps de la page -->
<section>
    <div th:include="fragments.html :: messages"></div>
    <h1 th:text="#{materialType.delete.title}"></h1>

    <form th:action="@{/materialType/remover/}" class="requireAuth-remover" method="POST">
        <table th:if="${!materialTypes.empty}" id="materialTypesList">
            <tr>
                <th th:text="#{material.type}"></th>
                <th></th>
            </tr>
            <tr th:each="materialType : ${materialTypes}">
                <td class="materialTypeName" th:data-materialTypeId="${materialType.id}"
                    th:text="${materialType.name}"></td>
                <td>
                    <button class="remover" th:data-code="${materialType.name}"
                            th:data-entityId="${materialType.id}"
                            type="button" th:text="#{keyword.delete}"></button>
                </td>
            </tr>
        </table>
    </form>
    <th:block th:if="${materialTypes.isEmpty()}">
        <b class="error" th:text="#{materialType.error.anyFound}"></b>
    </th:block>
</section>
<!-- Fragment du pied de page -->
<footer th:include="fragments.html :: footer('/materialType/remover', true)"></footer>

</body>
</html>
