patch projet finish v2 + translate
This commit is contained in:
@@ -198,10 +198,13 @@ public class ArticleController {
|
||||
LocalDate dateFinEnch = LocalDate.parse(dateFin);
|
||||
LocalDate datePlusUnJour = LocalDate.now().plusDays(1);
|
||||
if (dateFinEnch.isBefore(datePlusUnJour)) {
|
||||
redirectAttributes.addAttribute("erreur", "La date de début d'enchère ne peux pas être infàrieur à la date du jour + 1.");
|
||||
redirectAttributes.addAttribute("erreur", "La date de début d'enchère ne peux pas être infèrieur à la date du jour + 1.");
|
||||
return "redirect:/article/new";
|
||||
}
|
||||
if (dateFinEnch.isBefore(dateDebutEnch) || dateFinEnch.isEqual(dateDebutEnch)){
|
||||
redirectAttributes.addAttribute("erreur", "La date de fin d'enchère ne peux pas être infèrieur ou égal à la date de début d'enchère.");
|
||||
return "redirect:/article/new";
|
||||
}
|
||||
|
||||
//Vérification rue
|
||||
if (!Pattern.matches("^[a-zA-Z0-9 ]+$", retrait.getRue())){
|
||||
redirectAttributes.addAttribute("erreur", "Le rue n'est pas valide.");
|
||||
|
||||
@@ -99,14 +99,15 @@ public class EnchereController {
|
||||
.max(Comparator.comparing(Enchere::getMontantEnchere)) // Comparaison basée sur le montant d'enchère
|
||||
.map(Enchere::getPseudoUtilisateur);
|
||||
UserProfil user = this.userService.utilisateurByName(pseudoMaxEnchere.get());
|
||||
|
||||
//Get seller
|
||||
Article articleSell = articleService.findArticleById(id);
|
||||
UserProfil userSeller = userService.utilisateurById(articleSell.getUtilisateur());
|
||||
Optional<Float> maxMontantEnchere = listEncheres.stream()
|
||||
.map(Enchere::getMontantEnchere) // Récupère seulement les montants d'enchère
|
||||
.max(Float::compareTo);
|
||||
|
||||
//setCredit user.
|
||||
float userCredit = user.getCredit();
|
||||
float newCredit = userCredit - maxMontantEnchere.get();
|
||||
float newCredit = user.getCredit() - maxMontantEnchere.get();
|
||||
this.userService.setCredit(newCredit, user.getId());
|
||||
|
||||
//Delete enchere
|
||||
@@ -116,6 +117,11 @@ public class EnchereController {
|
||||
|
||||
//Delete article
|
||||
this.articleService.setSellPrice(id, maxMontantEnchere.get());
|
||||
|
||||
//Crédit selleur
|
||||
float sellerCredit = userSeller.getCredit() + maxMontantEnchere.get();
|
||||
this.userService.setCredit(sellerCredit, userSeller.getId());
|
||||
|
||||
return "redirect:/enchere";
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ home.article.end = End of auction:
|
||||
footer.desc = Created by the association "Objects are our friends", ENI-Auctions aims to help its members sell or buy objects of all kinds.
|
||||
|
||||
profil.title = My Profile
|
||||
profil.title.other = User profile
|
||||
profil.button = Edit
|
||||
profil.pseudo = Username:
|
||||
profil.surname = First name:
|
||||
@@ -40,6 +41,7 @@ profil.phone = Phone:
|
||||
profil.street = Street:
|
||||
profil.postal = Postal code:
|
||||
profil.city = City:
|
||||
profil.address = Address:
|
||||
profil.credit = Credits:
|
||||
|
||||
edit.profil.currentpassword = Current password:
|
||||
@@ -87,6 +89,12 @@ admin.users.table.firstname = First name
|
||||
admin.users.table.email = Email
|
||||
admin.users.table.disable = Disable
|
||||
admin.users.table.delete = Delete
|
||||
admin.users.bouton.save = Save
|
||||
admin.users.bouton.isDisabled = Enabled
|
||||
admin.users.bouton.disabled = Disabled
|
||||
admin.users.bouton.delete = Delete
|
||||
admin.users.bouton.isAdmin = Remove admin
|
||||
admin.users.bouton.Admin = Add admin
|
||||
|
||||
article.add.title = Add an article
|
||||
article.add.heading = New sale
|
||||
@@ -124,3 +132,9 @@ edit.article.title = Edit my article
|
||||
edit.article.update = Edit
|
||||
edit.article.back = Back
|
||||
edit.article.delete = Cancel my article
|
||||
|
||||
bank.creditNumber = Credit number
|
||||
bank.cardNumber = Card number
|
||||
bank.cardExpired = Expiration date
|
||||
bank.cardTitulaire = Name of the card holder
|
||||
bank.payer = Pay
|
||||
@@ -32,6 +32,7 @@ footer.desc = Cr\u00e9\u00e9e par l'association "Les objets sont nos amis", ENI-
|
||||
footer.
|
||||
|
||||
profil.title = Mon profile
|
||||
profil.title.other = Profil de l'utilisateur
|
||||
profil.button = Modifier
|
||||
profil.pseudo = Pseudo:
|
||||
profil.surname = Pr\u00e9nom:
|
||||
@@ -41,6 +42,7 @@ profil.phone = T\u00e9l\u00e9phone:
|
||||
profil.street = Rue:
|
||||
profil.postal = Code postal:
|
||||
profil.city = Ville:
|
||||
profil.address = Adresse:
|
||||
profil.credit = Cr\u00e9dits:
|
||||
|
||||
edit.profil.currentpassword = Mot de passe actuel:
|
||||
@@ -89,6 +91,12 @@ admin.users.table.firstname = Pr\u00E9nom
|
||||
admin.users.table.email = Email
|
||||
admin.users.table.disable = D\u00E9sactiver
|
||||
admin.users.table.delete = Supprimer
|
||||
admin.users.bouton.save = save
|
||||
admin.users.bouton.isDisabled = Activer
|
||||
admin.users.bouton.disabled = D\u00E9sactiver
|
||||
admin.users.bouton.delete = Supprimer
|
||||
admin.users.bouton.isAdmin = Retirer Admin
|
||||
admin.users.bouton.Admin = Ajouter admin
|
||||
|
||||
article.add.title = Ajouter un article
|
||||
article.add.heading = Nouvelle vente
|
||||
@@ -127,3 +135,9 @@ edit.article.title = Modifier mon article
|
||||
edit.article.update = Modifier
|
||||
edit.article.back = Retour
|
||||
edit.article.delete = Annuler vente
|
||||
|
||||
bank.creditNumber = Nombre de cr\u00E9dits
|
||||
bank.cardNumber = Num\u00E9ro de carte
|
||||
bank.cardExpired = date d'expiration
|
||||
bank.cardTitulaire = Nom du titulaire de la carte
|
||||
bank.payer = Payer
|
||||
@@ -62,23 +62,23 @@
|
||||
<form th:action="@{/admin/update/credit}" method="post">
|
||||
<input type="number" name="newCredit" id="newCredit" th:value="${user.credit}" class="form-control">
|
||||
<input type="hidden" name="idUser" id="idUser" th:value="${user.id}">
|
||||
<button type="submit" class="btn btn-primary mt-2">Sauvegarder</button>
|
||||
<button type="submit" class="btn btn-primary mt-2" th:text="#{admin.users.bouton.save}"></button>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form th:action="@{/admin/disabled}" method="post">
|
||||
<input type="hidden" name="userDisabled" id="userDisabled" th:value="${user.id}">
|
||||
<input type="hidden" name="isDis" id="isDis" th:value="${user.isDisabled}">
|
||||
<button type="submit" th:text="${user.isDisabled} ? 'Activer' : 'Désactiver'" class="btn btn-secondary mt-2"></button>
|
||||
<button type="submit" th:text="${user.isDisabled} ? #{admin.users.bouton.isDisabled} : #{admin.users.bouton.disabled}" class="btn btn-secondary mt-2"></button>
|
||||
</form>
|
||||
<form th:action="@{/admin/delete}" method="post">
|
||||
<input type="hidden" name="userDelete" id="userDelete" th:value="${user.id}">
|
||||
<button type="submit" class="btn btn-danger mt-2">Supprimer</button>
|
||||
<button type="submit" class="btn btn-danger mt-2" th:text="#{admin.users.bouton.delete}"></button>
|
||||
</form>
|
||||
<form th:action="@{/admin/administrateur}" method="post">
|
||||
<input type="hidden" name="userAdmin" id="userAdmin" th:value="${user.id}">
|
||||
<input type="hidden" name="isAdmin" id="isAdmin" th:value="${user.admin}">
|
||||
<button type="submit" th:text="${user.admin} ? 'Retirer admin' : 'Ajouter admin'" class="btn btn-info mt-2"></button>
|
||||
<button type="submit" th:text="${user.admin} ? #{admin.users.bouton.isAdmin} : #{admin.users.bouton.Admin}" class="btn btn-info mt-2"></button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html th:replace="~{modele-page :: layout('${articleDetailsTitle}',~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||
<html th:replace="~{modele-page :: layout(${article.nom},~{::link} , ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="col-md-8">
|
||||
<form th:action="@{/bank/checkout}" method="post" th:object="${bank}" class="needs-validation" novalidate>
|
||||
<div class="mb-3">
|
||||
<label for="cartAmount" class="form-label">Nombre de crédits:</label>
|
||||
<label for="cartAmount" class="form-label" th:text="#{bank.creditNumber}"></label>
|
||||
<input type="number" class="form-control" th:field="*{cartAmount}" id="cartAmount" step="0.01" max="2000000" required/>
|
||||
<div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartAmount')}">
|
||||
<ul>
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cartNumber" class="form-label">Numéro de carte:</label>
|
||||
<label for="cartNumber" class="form-label" th:text="#{bank.cardNumber}"></label>
|
||||
<input type="text" class="form-control" th:field="*{cartNumber}" id="cartNumber" pattern="[0-9]{16}" maxlength="16" placeholder="1234 5678 9012 3456" required/>
|
||||
<div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartNumber')}">
|
||||
<ul>
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cartExpired" class="form-label">Date d'expiration:</label>
|
||||
<label for="cartExpired" class="form-label" th:text="#{bank.cardExpired}"></label>
|
||||
<input type="text" class="form-control" th:field="*{cartExpired}" id="cartExpired" pattern="(0[1-9]|1[0-2])\/[0-9]{4}" placeholder="MM/YYYY" required/>
|
||||
<div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartExpired')}">
|
||||
<ul>
|
||||
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="cartName" class="form-label">Nom du titulaire de la carte:</label>
|
||||
<label for="cartName" class="form-label" th:text="#{bank.cardTitulaire}"></label>
|
||||
<input type="text" class="form-control" th:field="*{cartName}" id="cartName" required/>
|
||||
<div class="is-invalid text-danger" th:if="${#fields.hasErrors('cartName')}">
|
||||
<ul>
|
||||
@@ -54,7 +54,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-100">Payer</button>
|
||||
<button type="submit" class="btn btn-primary w-100" th:text="#{bank.payer}"></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="text-center">Profil de l'utilisateur</h2>
|
||||
<h2 class="text-center" th:text="#{profil.title.other}"></h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><strong>Pseudo:</strong> <span th:text="${userProfil.pseudo}"></span></li>
|
||||
<li class="list-group-item"><strong>Nom:</strong> <span th:text="${userProfil.nom}"></span></li>
|
||||
<li class="list-group-item"><strong>Prénom:</strong> <span th:text="${userProfil.prenom}"></span></li>
|
||||
<li class="list-group-item"><strong>Email:</strong> <span th:text="${userProfil.email}"></span></li>
|
||||
<li class="list-group-item"><strong>Téléphone:</strong> <span th:text="${userProfil.telephone}"></span></li>
|
||||
<li class="list-group-item"><strong>Adresse:</strong> <span th:text="${userProfil.rue} + ' ' + ${userProfil.code_postal} + ' ' + ${userProfil.ville}"></span></li>
|
||||
<li class="list-group-item"><strong th:text="#{profil.pseudo}"></strong> <span th:text="${userProfil.pseudo}"></span></li>
|
||||
<li class="list-group-item"><strong th:text="#{profil.name}">Nom:</strong> <span th:text="${userProfil.nom}"></span></li>
|
||||
<li class="list-group-item"><strong th:text="#{profil.surname}">Prénom:</strong> <span th:text="${userProfil.prenom}"></span></li>
|
||||
<li class="list-group-item"><strong th:text="#{profil.email}">Email:</strong> <span th:text="${userProfil.email}"></span></li>
|
||||
<li class="list-group-item"><strong th:text="#{profil.phone}">Téléphone:</strong> <span th:text="${userProfil.telephone}"></span></li>
|
||||
<li class="list-group-item"><strong th:text="#{profil.address}">Adresse:</strong> <span th:text="${userProfil.rue} + ' ' + ${userProfil.code_postal} + ' ' + ${userProfil.ville}"></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user