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

<!-- Fragment de l'entête -->
<header th:include="fragments.html :: header(false)"></header>
<!-- Corps de la page -->
<section>
    <div id="researchBoxContainer">
        <input id="researchBox" class="noStyle" type="text" th:placeholder="#{keyword.search}"
               onkeyup="performSearch(this.value)"/>
    </div>

    <div th:include="fragments.html :: messages"></div>

    <h1 th:text="#{recipe.delete.title}"></h1>

    <div class="content recipesContainer">
        <form th:action="@{/recipe/remover/}" class="requireAuth-remover" method="POST">
            <div class="companyTab" th:if="${!recipeMap.empty}" th:each="company : ${recipeMap.keySet()}"
                 th:data-companyId="${company.id}">
                <h2 class="companyTabTitle" th:text="${company.name}"></h2>
                <table style="display:none" th:id="'recipes_' + ${company.id}" class="recipesList"
                       th:if="${!recipeMap.get(company).empty}">
                    <tr>
                        <th th:text="#{recipe.color}"></th>
                        <th th:text="#{recipe.description}"></th>
                        <th th:text="#{recipe.sample}"></th>
                        <th></th>
                        <th></th>
                    </tr>
                    <tr class="recipeRow" th:each="recipe : ${recipeMap.get(company)}"
                        th:data-approbationDate="${recipe.approbationDate}" th:data-recipeId="${recipe.id}">
                        <td class="descriptionCell" th:text="${recipe.name}"></td>
                        <td class="descriptionCell recipeDescription" th:text="${recipe.description}"></td>
                        <td class="descriptionCell" th:text="'#' + ${recipe.sample}"></td>
                        <td>
                            <button class="remover" th:data-code="${recipe.name}"
                                    th:data-entityid="${recipe.id}" type="button"
                                    th:text="#{keyword.delete}"></button>
                        </td>
                        <td class="iconsColumn">
                        </td>
                    </tr>
                </table>
            </div>
        </form>

        <b th:if="${recipeMap.empty}" class="error" th:text="#{recipe.error.anyFound}"></b>
    </div>
</section>
<!-- Fragment du pied de page -->
<footer th:include="fragments.html :: footer(null, true)"></footer>

<script th:include="fragments.html :: iconsPath"></script>
<script th:src="@{|${baseUrl}/js/recipeResearch.js|}"></script>
<script th:src="@{|${baseUrl}/js/recipeList.js|}"></script>
</body>
</html>
