feat: add flocage customization options to equipement configuration
This commit is contained in:
@@ -33,6 +33,15 @@ public class Equipement {
|
|||||||
private String couleursDisponibles;
|
private String couleursDisponibles;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "has_flocage_prenom", nullable = false)
|
||||||
|
private boolean hasFlocagePrenom = false;
|
||||||
|
|
||||||
|
@Column(name = "has_flocage_initiales", nullable = false)
|
||||||
|
private boolean hasFlocageInitiales = false;
|
||||||
|
|
||||||
|
@Column(name = "has_flocage_numero", nullable = false)
|
||||||
|
private boolean hasFlocageNumero = false;
|
||||||
|
|
||||||
@ManyToOne(optional = false, fetch = FetchType.LAZY)
|
@ManyToOne(optional = false, fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "saison_id", nullable = false)
|
@JoinColumn(name = "saison_id", nullable = false)
|
||||||
private Saison saison;
|
private Saison saison;
|
||||||
@@ -63,6 +72,15 @@ public class Equipement {
|
|||||||
public String getCouleursDisponibles() { return couleursDisponibles; }
|
public String getCouleursDisponibles() { return couleursDisponibles; }
|
||||||
public void setCouleursDisponibles(String couleursDisponibles) { this.couleursDisponibles = couleursDisponibles; }
|
public void setCouleursDisponibles(String couleursDisponibles) { this.couleursDisponibles = couleursDisponibles; }
|
||||||
|
|
||||||
|
public boolean isHasFlocagePrenom() { return hasFlocagePrenom; }
|
||||||
|
public void setHasFlocagePrenom(boolean hasFlocagePrenom) { this.hasFlocagePrenom = hasFlocagePrenom; }
|
||||||
|
|
||||||
|
public boolean isHasFlocageInitiales() { return hasFlocageInitiales; }
|
||||||
|
public void setHasFlocageInitiales(boolean hasFlocageInitiales) { this.hasFlocageInitiales = hasFlocageInitiales; }
|
||||||
|
|
||||||
|
public boolean isHasFlocageNumero() { return hasFlocageNumero; }
|
||||||
|
public void setHasFlocageNumero(boolean hasFlocageNumero) { this.hasFlocageNumero = hasFlocageNumero; }
|
||||||
|
|
||||||
public Saison getSaison() { return saison; }
|
public Saison getSaison() { return saison; }
|
||||||
public void setSaison(Saison saison) { this.saison = saison; }
|
public void setSaison(Saison saison) { this.saison = saison; }
|
||||||
}
|
}
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
ALTER TABLE equipement ADD COLUMN has_flocage_prenom BOOLEAN DEFAULT FALSE NOT NULL;
|
||||||
|
ALTER TABLE equipement ADD COLUMN has_flocage_initiales BOOLEAN DEFAULT FALSE NOT NULL;
|
||||||
|
ALTER TABLE equipement ADD COLUMN has_flocage_numero BOOLEAN DEFAULT FALSE NOT NULL;
|
||||||
|
|
||||||
|
-- Activation automatique de l'option "numéro" pour les équipements ayant déjà des dotations avec un numéro
|
||||||
|
UPDATE equipement e
|
||||||
|
SET has_flocage_numero = TRUE
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT 1 FROM dotation d WHERE d.equipement_id = e.id AND d.numero IS NOT NULL AND d.numero != ''
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Activation automatique de l'option "prénom" (uniquement) pour les équipements ayant déjà des dotations avec un flocage
|
||||||
|
UPDATE equipement e
|
||||||
|
SET has_flocage_prenom = TRUE
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT 1 FROM dotation d WHERE d.equipement_id = e.id AND d.flocage IS NOT NULL AND d.flocage != ''
|
||||||
|
);
|
||||||
|
|
||||||
|
UPDATE dotation
|
||||||
|
SET flocage = a.prenom
|
||||||
|
FROM licence l
|
||||||
|
JOIN adherent a ON l.adherent_id = a.id
|
||||||
|
WHERE dotation.licence_id = l.id
|
||||||
|
AND dotation.flocage IS NOT NULL
|
||||||
|
AND dotation.flocage != ''
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT 1 FROM equipement e
|
||||||
|
WHERE e.id = dotation.equipement_id
|
||||||
|
AND e.has_flocage_prenom = TRUE
|
||||||
|
AND e.has_flocage_initiales = FALSE
|
||||||
|
);
|
||||||
@@ -56,8 +56,32 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm font-medium text-gray-700 mb-1">Tailles disponibles</label>
|
<label class="block text-sm font-medium text-gray-700 mb-1">Tailles disponibles</label>
|
||||||
<input type="text" th:field="*{taillesDisponibles}" placeholder="ex: XS, S, M, L, XL ou 5/6 ANS, 7/8 ANS..." class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none">
|
|
||||||
<p class="text-xs text-gray-500 mt-1">Séparez les tailles par des virgules. Laissez vide si taille unique ou standard.</p>
|
<div class="mb-2">
|
||||||
|
<select id="grilleTailles" class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none bg-gray-50" onchange="applyGrilleTailles()">
|
||||||
|
<option value="">-- Utiliser une grille prédéfinie --</option>
|
||||||
|
<option value="5/6ANS (Taille 116cm),7/8ANS (Taille 128cm),9/10ANS (Taille 140cm),11/12ANS (Taille 152cm),13/14ANS (Taille 164cm)">Vêtements Junior</option>
|
||||||
|
<option value="XS,S,M,L,XL,XXL">Vêtements Adulte</option>
|
||||||
|
<option value="5/6ANS (Taille 116cm),7/8ANS (Taille 128cm),9/10ANS (Taille 140cm),11/12ANS (Taille 152cm),13/14ANS (Taille 164cm),XS,S,M,L,XL,XXL">Vêtements (Junior + Adulte)</option>
|
||||||
|
<option value="27/30 (Taille 0),31/34 (Taille 1),35/38 (Taille 2),39/42 (Taille 3)">Pointures Junior</option>
|
||||||
|
<option value="35/38 (Taille 2),39/42 (Taille 3),43/46 (Taille 4)">Pointures Adulte</option>
|
||||||
|
<option value="27/30 (Taille 0),31/34 (Taille 1),35/38 (Taille 2),39/42 (Taille 3),43/46 (Taille 4)">Pointures (Junior + Adulte)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="text" id="taillesDisponibles" th:field="*{taillesDisponibles}" placeholder="ex: XS, S, M, L, XL ou 5/6 ANS, 7/8 ANS..." class="w-full border border-gray-300 rounded-lg px-4 py-2 text-sm focus:ring-2 focus:ring-blue-500 outline-none">
|
||||||
|
<p class="text-xs text-gray-500 mt-1">Séparez les tailles par des virgules. Vous pouvez utiliser une grille ci-dessus et ajuster manuellement.</p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function applyGrilleTailles() {
|
||||||
|
const select = document.getElementById('grilleTailles');
|
||||||
|
const input = document.getElementById('taillesDisponibles');
|
||||||
|
if (select.value) {
|
||||||
|
input.value = select.value;
|
||||||
|
select.value = ''; // Reset select after applying
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -67,6 +91,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pt-4 border-t border-gray-100">
|
||||||
|
<h3 class="text-sm font-medium text-gray-900 mb-4">Options de personnalisation (Flocage)</h3>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<input type="checkbox" th:field="*{hasFlocagePrenom}" class="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
|
||||||
|
<label class="ml-2 block text-sm text-gray-700">Flocage : Prénom du joueur</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<input type="checkbox" th:field="*{hasFlocageInitiales}" class="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
|
||||||
|
<label class="ml-2 block text-sm text-gray-700">Flocage : Initiales du joueur</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<input type="checkbox" th:field="*{hasFlocageNumero}" class="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
|
||||||
|
<label class="ml-2 block text-sm text-gray-700">Flocage : Numéro</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="pt-4 flex justify-end space-x-3 border-t border-gray-100">
|
<div class="pt-4 flex justify-end space-x-3 border-t border-gray-100">
|
||||||
<a th:href="@{/equipements}" class="px-4 py-2 text-sm font-medium text-gray-700 border border-gray-300 rounded-lg hover:bg-gray-50">Annuler</a>
|
<a th:href="@{/equipements}" class="px-4 py-2 text-sm font-medium text-gray-700 border border-gray-300 rounded-lg hover:bg-gray-50">Annuler</a>
|
||||||
<button type="submit" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700">Enregistrer</button>
|
<button type="submit" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700">Enregistrer</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user