<!DOCTYPE html>
<html lang="fr" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block
            th:include="fragments.html :: head(#{materialType.editing.title(${materialTypeDto.name})}, 'form')"></th:block>
</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 class="materialCode" th:text="#{materialType.editing.title(${materialTypeDto.name})}"></h1>

    <form th:action="@{/materialType/editor}" th:object="${materialTypeDto}" class="requireAuth" method="POST">
        <input type="hidden" th:field="*{oldName}"/>
        <input type="hidden" th:field="*{oldPrefix}"/>

        <div class="content">
            <div class="formWrap">
                <div class="formColumn">
                    <div>
                        <label th:for="${#ids.next('id')}" th:text="#{keyword.id} + ':'"></label>
                    </div>
                    <div>
                        <label th:for="${#ids.next('name')}" th:text="#{materialType.name} + ':'"></label>
                    </div>
                    <div>
                        <label th:for="${#ids.next('prefix')}"
                               th:text="#{materialType.prefix} + ' (3 ' + #{keyword.characters} + '):'"></label>
                    </div>
                    <div>
                        <label th:for="${#ids.next('usePercentages')}"
                               th:text="#{materialType.usePercents} + ':'"></label>
                    </div>
                </div>
                <div class="formColumn">
                    <div>
                        <input type="number" th:field="*{id}" required readonly/>
                    </div>
                    <div>
                        <input type="text" th:field="*{name}" required/>
                    </div>
                    <div>
                        <input type="text" minlength="3" maxlength="3" th:field="*{prefix}" required/>
                    </div>
                    <div>
                        <input type="checkbox" th:field="*{usePercentages}"
                               th:checked="${materialTypeDto.usePercentages}"/>
                    </div>
                </div>
            </div>
            <div th:include="fragments.html :: formEndButtons"></div>
        </div>
    </form>
</section>
<!-- Fragment du pied de page -->
<footer th:include="fragments.html :: footer(null, true)"></footer>

</body>
</html>
