<!DOCTYPE html>
<html lang="fr" th:replace="~{modele-page :: layout('Modifier votre article' , ~{::#link}, ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="container-main" class="container mt-5">
        <h1 th:text="#{edit.article.title}"></h1>
        <form th:action="@{/article/edit}" method="post" th:object="${article}">
<!--            Titre article-->
            <div class="mb-3">
                <input type="hidden" id="id" name="id" th:field="*{id}">
                <strong><label for="nom" class="form-label">Titre</label></strong>
                <input type="text" class="form-control" th:field="*{nom}" id="nom">
            </div>
<!--            Description article-->
            <div class="mb-3">
                <strong><label for="desc" class="form-label">Description</label></strong>
                <input type="text" class="form-control" th:field="*{desc}" id="desc">
            </div>
<!--            Catégorie article-->
            <div class="mb-3">
                <strong><label for="categorie" class="form-label">Catégorie:</label></strong>
                <select class="form-control" th:field="*{numCategorie}" id="categorie" required>
                    <option th:each="categorie : ${categories}" th:value="${categorie.id}" th:text="${categorie.libelle}"></option>
                </select>
            </div>
<!--            Photo article-->
            <div class="mb-3">
                <label for="photo" class="form-label" th:text="#{article.add.form.label.photo}">Photo de l'article:</label>
                <input type="file" class="form-control" id="photo" accept="image/jpeg">
            </div>
<!--            Prix de l'article-->
            <div class="mb-3">
                <strong><label for="price" class="form-label">Prix initial</label></strong>
                <input type="text" class="form-control" th:field="*{prixInitial}" id="price">
            </div>
<!--            Date début enchère-->
            <div class="mb-3">
                <strong><label for="dateDebut" class="form-label">Date début d'enchère</label></strong>
                <input type="date" class="form-control" th:value="*{dateDebutEnch}" id="dateDebut" name="dateDebut">
            </div>
<!--            Date fin enchère-->
            <div class="mb-3">
                <strong><label for="dateFin" class="form-label">Date fin d'enchère</label></strong>
                <input type="date" class="form-control" th:value="*{dateFinEnch}" id="dateFin" name="dateFin">
            </div>
<!--            Retrait-->
            <h4 th:text="#{article.add.form.label.removal}">Retrait</h4>
            <div th:object="${retrait}">
                <!--            Rue-->
                <div class="mb-3">
                    <strong><label for="street" class="form-label">Rue</label></strong>
                    <input type="text" class="form-control" th:field="*{rue}" id="street">
                </div>
                <!--            Code postal-->
                <div class="mb-3">
                    <strong><label for="cp" class="form-label">Code postal</label></strong>
                    <input type="text" class="form-control" th:field="*{code_postale}" id="cp">
                </div>
                <!--            Ville-->
                <div class="mb-3">
                    <strong><label for="city" class="form-label">Ville</label></strong>
                    <input type="text" class="form-control" th:field="*{ville}" id="city">
                </div>
            </div>
            <div class="d-flex justify-content-end align-items-center">
                <button type="submit" class="btn btn-primary border-right" th:text="#{edit.profil.button.edit}"></button>
            </div>
        </form>
        <div class="d-flex justify-content-end align-items-center mt-2">
            <form th:action="@{/article/delete}" method="post">
                <input type="hidden" name="articleId" id="articleId" th:value="${article.id}">
                <button type="submit" class="btn btn-danger" th:text="#{edit.article.delete}"></button>
            </form>
            <a class="btn btn-secondary ml-2" th:href="@{/article/show(id=${article.id})}" th:text="#{edit.profil.button.cancel}"></a>
        </div>
    </div>

</body>
</html>