Merge branch 'main' of https://gitlab.com/marvin.epip/enchere
This commit is contained in:
@@ -68,6 +68,12 @@ public class ArticleController {
|
||||
Optional<Float> maxMontantEnchere = lastEnchere.stream()
|
||||
.map(Enchere::getMontantEnchere) // Récupère seulement les montants d'enchère
|
||||
.max(Float::compareTo);
|
||||
UserProfil currentUser = userService.utilisateurByName(authentication.getName());
|
||||
boolean isArticleCurrentUser = false;
|
||||
if (currentUser.getId() == user.getId()) {
|
||||
isArticleCurrentUser = true;
|
||||
}
|
||||
model.addAttribute("isArticleCurrentUser", isArticleCurrentUser);
|
||||
model.addAttribute("article", article);
|
||||
model.addAttribute("username", user);
|
||||
model.addAttribute("cate", cate.getLibelle());
|
||||
|
||||
@@ -30,3 +30,7 @@
|
||||
.navbar-nav .nav-item.active .nav-link {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#container-main {
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
BIN
src/main/resources/static/images/articles/1.jpg
Normal file
BIN
src/main/resources/static/images/articles/1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 228 KiB |
@@ -144,10 +144,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Pagination -->
|
||||
<div class="row mt-4">
|
||||
<div class="row mt-4" th:if="${not #lists.isEmpty(articles)}">
|
||||
<div class="col-md-12">
|
||||
<nav aria-label="Page navigation example">
|
||||
<ul class="pagination justify-content-center">
|
||||
<!-- Bouton pour la première page -->
|
||||
<li class="page-item">
|
||||
<a class="page-link" th:href="@{/(page=0)}">
|
||||
<span aria-hidden="true">«</span>
|
||||
@@ -155,6 +156,7 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Bouton pour la page précédente -->
|
||||
<li th:if="${currentPage > 0}" class="page-item">
|
||||
<a class="page-link" th:href="@{/(page=${currentPage - 1})}">
|
||||
<span aria-hidden="true">‹</span>
|
||||
@@ -162,6 +164,15 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Boucle pour afficher les numéros de page -->
|
||||
<!-- Vous pouvez ajuster la plage de pages affichées comme vous le souhaitez -->
|
||||
<th:block th:each="page,iter : ${#numbers.sequence(0, totalPages - 1)}">
|
||||
<li class="page-item" th:if="${iter.index >= (currentPage - 2) && iter.index <= (currentPage + 2)}">
|
||||
<a class="page-link" th:href="@{/(page=${page})}" th:text="${page} + 1"></a>
|
||||
</li>
|
||||
</th:block>
|
||||
|
||||
<!-- Bouton pour la page suivante -->
|
||||
<li th:if="${currentPage < totalPages - 1}" class="page-item">
|
||||
<a class="page-link" th:href="@{/(page=${currentPage + 1})}">
|
||||
<span aria-hidden="true">›</span>
|
||||
@@ -169,6 +180,7 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Bouton pour la dernière page -->
|
||||
<li class="page-item">
|
||||
<a class="page-link" th:href="@{/(page=${totalPages - 1})}">
|
||||
<span aria-hidden="true">»</span>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div id="container-main">
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6 offset-md-3">
|
||||
<div class="container-fluid" id="container-main" >
|
||||
<div class="row mt-3 justify-content-center"> <!-- Ajoutez la classe justify-content-center pour centrer le contenu -->
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 th:text="#{article.details.heading}"></h4>
|
||||
@@ -46,7 +46,7 @@
|
||||
<strong><label class="col-form-label" th:text="#{article.details.label.pickup}"></label></strong>
|
||||
<span th:text="${retrait} ? ${retrait.rue} + ' ' + ${retrait.code_postale} + ' ' + ${retrait.ville} : #{article.details.address.unknown}"></span>
|
||||
</div>
|
||||
<form th:action="@{/enchere/incEnchere}" method="post" th:object="${enchere}" class="mt-2 d-flex flex-row align-items-end justify-content-between">
|
||||
<form th:if="${!isArticleCurrentUser}" th:action="@{/enchere/incEnchere}" method="post" th:object="${enchere}" class="mt-2 d-flex flex-row align-items-end justify-content-between">
|
||||
<input type="hidden" id="articleId" name="articleId" th:value="${article.id}">
|
||||
<label for="montantEnchere" th:text="#{article.details.label.amount}"></label>
|
||||
<input type="number" th:field="*{montantEnchere}" id="montantEnchere" step="0.01" min="0">
|
||||
@@ -57,6 +57,7 @@
|
||||
</span>
|
||||
<button type="submit" class="btn btn-primary" th:text="#{article.details.button.bid}"></button>
|
||||
</form>
|
||||
<button th:if="${isArticleCurrentUser}" type="button" class="btn btn-success"> Modifier</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,5 +65,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user