feat: amélioration des formulaires d'inscription et pré-inscription
- Rendre le champ téléphone obligatoire (entités et UI). - Ajout du champ 'Ancienne catégorie' conditionné par la saisie de l'ancien club. - Synchronisation de l'ancienne catégorie entre la pré-inscription et la fiche adhérent.
This commit is contained in:
@@ -35,7 +35,7 @@ public class Adherent {
|
||||
@Column(nullable = false, length = 100)
|
||||
private String email;
|
||||
|
||||
@Column(length = 20)
|
||||
@Column(nullable = false, length = 20)
|
||||
private String telephone;
|
||||
|
||||
@Column(name = "representant_legal", length = 150)
|
||||
@@ -47,6 +47,9 @@ public class Adherent {
|
||||
@Column(name = "ancien_club", length = 150)
|
||||
private String ancienClub;
|
||||
|
||||
@Column(name = "ancienne_categorie", length = 50)
|
||||
private String ancienneCategorie;
|
||||
|
||||
private boolean residentTalange = true;
|
||||
|
||||
@Column(nullable = false, length = 10)
|
||||
@@ -99,6 +102,9 @@ public class Adherent {
|
||||
public String getAncienClub() { return ancienClub; }
|
||||
public void setAncienClub(String ancienClub) { this.ancienClub = ancienClub; }
|
||||
|
||||
public String getAncienneCategorie() { return ancienneCategorie; }
|
||||
public void setAncienneCategorie(String ancienneCategorie) { this.ancienneCategorie = ancienneCategorie; }
|
||||
|
||||
public boolean isResidentTalange() { return residentTalange; }
|
||||
public void setResidentTalange(boolean residentTalange) { this.residentTalange = residentTalange; }
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PreInscription {
|
||||
@Column(nullable = false, length = 150)
|
||||
private String email;
|
||||
|
||||
@Column(length = 20)
|
||||
@Column(nullable = false, length = 20)
|
||||
private String telephone;
|
||||
|
||||
@Column(name = "representant_legal", length = 150)
|
||||
@@ -58,6 +58,9 @@ public class PreInscription {
|
||||
@Column(name = "ancien_club", length = 150)
|
||||
private String ancienClub;
|
||||
|
||||
@Column(name = "ancienne_categorie", length = 50)
|
||||
private String ancienneCategorie = "NA";
|
||||
|
||||
// Getters and Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
@@ -106,4 +109,7 @@ public class PreInscription {
|
||||
|
||||
public String getAncienClub() { return ancienClub; }
|
||||
public void setAncienClub(String ancienClub) { this.ancienClub = ancienClub; }
|
||||
|
||||
public String getAncienneCategorie() { return ancienneCategorie; }
|
||||
public void setAncienneCategorie(String ancienneCategorie) { this.ancienneCategorie = ancienneCategorie; }
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class PreInscriptionService {
|
||||
adherent.setRepresentantLegal(pre.getRepresentantLegal());
|
||||
adherent.setTypeDemande(pre.getTypeDemande());
|
||||
adherent.setAncienClub(pre.getAncienClub());
|
||||
adherent.setAncienneCategorie(pre.getAncienneCategorie());
|
||||
// Par défaut
|
||||
adherent.setSexe("MASCULIN");
|
||||
adherent.setTypeMaillot("JOUEUR");
|
||||
|
||||
@@ -120,8 +120,8 @@
|
||||
|
||||
<!-- Téléphone -->
|
||||
<div>
|
||||
<label for="telephone" class="block text-sm font-medium text-gray-700 mb-1">Téléphone</label>
|
||||
<input type="tel" id="telephone" th:field="*{telephone}"
|
||||
<label for="telephone" class="block text-sm font-medium text-gray-700 mb-1">Téléphone <span class="text-red-500">*</span></label>
|
||||
<input type="tel" id="telephone" th:field="*{telephone}" required
|
||||
class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-colors"
|
||||
th:classappend="${#fields.hasErrors('telephone')} ? 'border-red-500' : ''">
|
||||
<p th:if="${#fields.hasErrors('telephone')}" th:errors="*{telephone}" class="mt-1 text-xs text-red-600"></p>
|
||||
@@ -166,6 +166,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ancienneCategorieBlock" class="grid grid-cols-1 md:grid-cols-2 gap-6 hidden-block mt-6">
|
||||
<div>
|
||||
<label for="ancienneCategorie" class="block text-sm font-medium text-gray-700 mb-1">Ancienne catégorie <span class="text-red-500">*</span></label>
|
||||
<select id="ancienneCategorie" th:field="*{ancienneCategorie}"
|
||||
class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-colors">
|
||||
<option value="NA">NA (Je ne sais plus)</option>
|
||||
<option value="U6">U6</option>
|
||||
<option value="U7">U7</option>
|
||||
<option value="U8">U8</option>
|
||||
<option value="U9">U9</option>
|
||||
<option value="U10">U10</option>
|
||||
<option value="U11">U11</option>
|
||||
<option value="U12">U12</option>
|
||||
<option value="U13">U13</option>
|
||||
<option value="U14">U14</option>
|
||||
<option value="U15">U15</option>
|
||||
<option value="U16">U16</option>
|
||||
<option value="U17">U17</option>
|
||||
<option value="Senior">Senior</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Removed Adresse -->
|
||||
|
||||
<div class="pt-4 flex justify-end space-x-3 border-t border-gray-100">
|
||||
@@ -681,6 +704,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
const ancienClubInput = document.getElementById('ancienClub');
|
||||
const ancienneCategorieBlock = document.getElementById('ancienneCategorieBlock');
|
||||
const ancienneCategorieSelect = document.getElementById('ancienneCategorie');
|
||||
|
||||
if (ancienClubInput) {
|
||||
ancienClubInput.addEventListener('input', function() {
|
||||
if (this.value.trim().length > 0) {
|
||||
ancienneCategorieBlock.classList.remove('hidden-block');
|
||||
ancienneCategorieSelect.required = true;
|
||||
} else {
|
||||
ancienneCategorieBlock.classList.add('hidden-block');
|
||||
ancienneCategorieSelect.required = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (ancienClubInput.value.trim().length > 0) {
|
||||
ancienneCategorieBlock.classList.remove('hidden-block');
|
||||
ancienneCategorieSelect.required = true;
|
||||
}
|
||||
}
|
||||
|
||||
function updateLicencesCategoryAndPrices() {
|
||||
if (!dateInput.value) return;
|
||||
const dob = new Date(dateInput.value);
|
||||
|
||||
@@ -52,7 +52,27 @@
|
||||
<div id="nouvelleLicenceBlock" class="hidden space-y-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Ancien club</label>
|
||||
<input type="text" th:field="*{ancienClub}" class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none" placeholder="Nom du club (laisser vide si aucun)">
|
||||
<input type="text" id="ancienClub" th:field="*{ancienClub}" class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none" placeholder="Nom du club (laisser vide si aucun)">
|
||||
</div>
|
||||
|
||||
<div id="ancienneCategorieBlock" class="hidden">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Ancienne catégorie <span class="text-red-500">*</span></label>
|
||||
<select id="ancienneCategorie" th:field="*{ancienneCategorie}" class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none">
|
||||
<option value="NA">NA (Je ne sais plus)</option>
|
||||
<option value="U6">U6</option>
|
||||
<option value="U7">U7</option>
|
||||
<option value="U8">U8</option>
|
||||
<option value="U9">U9</option>
|
||||
<option value="U10">U10</option>
|
||||
<option value="U11">U11</option>
|
||||
<option value="U12">U12</option>
|
||||
<option value="U13">U13</option>
|
||||
<option value="U14">U14</option>
|
||||
<option value="U15">U15</option>
|
||||
<option value="U16">U16</option>
|
||||
<option value="U17">U17</option>
|
||||
<option value="Senior">Senior</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-lg">
|
||||
@@ -113,8 +133,8 @@
|
||||
<input type="email" th:field="*{email}" required class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Téléphone</label>
|
||||
<input type="tel" th:field="*{telephone}" class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Téléphone <span class="text-red-500">*</span></label>
|
||||
<input type="tel" th:field="*{telephone}" required class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -184,6 +204,27 @@
|
||||
nouvelleLicenceBlock.classList.remove('hidden');
|
||||
}
|
||||
|
||||
const ancienClubInput = document.getElementById('ancienClub');
|
||||
const ancienneCategorieBlock = document.getElementById('ancienneCategorieBlock');
|
||||
const ancienneCategorieSelect = document.getElementById('ancienneCategorie');
|
||||
|
||||
if (ancienClubInput) {
|
||||
ancienClubInput.addEventListener('input', function() {
|
||||
if (this.value.trim().length > 0) {
|
||||
ancienneCategorieBlock.classList.remove('hidden');
|
||||
ancienneCategorieSelect.required = true;
|
||||
} else {
|
||||
ancienneCategorieBlock.classList.add('hidden');
|
||||
ancienneCategorieSelect.required = false;
|
||||
}
|
||||
});
|
||||
// Initial check
|
||||
if (ancienClubInput.value.trim().length > 0) {
|
||||
ancienneCategorieBlock.classList.remove('hidden');
|
||||
ancienneCategorieSelect.required = true;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('dateNaissance').addEventListener('change', function() {
|
||||
const dateInput = this.value;
|
||||
const repBlock = document.getElementById('representantBlock');
|
||||
|
||||
Reference in New Issue
Block a user