<!DOCTYPE html>
<html lang="fr" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="fragments.html :: head(#{material.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="#{material.delete.title}"></h1>

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

</body>
</html>
