diff --git a/Front/js/backend/match.js b/Front/js/backend/match.js index e556f0b..377d2fc 100644 --- a/Front/js/backend/match.js +++ b/Front/js/backend/match.js @@ -314,9 +314,21 @@ if (window.location.href.includes("arbitrage.html")) { "prenom": prenom, "promo": promoId }; - await pb.collection('joueurs').create(data); - //rechargement de la page - window.location.href = "arbitrage.html"; + const allPlayerList = await pb.collection('joueurs').getFullList({ + expand: 'promo' + }); + const existingPlayer = allPlayerList.find(player => + player.name.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") === nom.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") && + player.prenom.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") === prenom.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") && + player.promo === promoId + ); + + if (existingPlayer) { + alert("Un joueur avec ce nom, prénom et promo existe déjà."); + } else { + await pb.collection('joueurs').create(data); + window.location.href = "arbitrage.html"; + } }); } diff --git a/README.md b/README.md index b6f9d85..b360e81 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ ## Point d'amélioration: - Verification de doublon dans les joueurs - Import des equipes depuis un excel +- Modifier les equipes +- Recherche des joueurs pour la creation d'une equipe +- Interface mettre tous les points d'un coup ## Show your support