Ajout de fonctionnalités:

Ajout de notes personnels et de notes d'équipe avec historique.
Ajout de prise de rendez-vous avec un coach selon ses disponibilités
This commit is contained in:
cedrick2711
2026-07-16 20:34:56 -04:00
parent b02fe29e30
commit 24fcc9a048
24 changed files with 2625 additions and 264 deletions
+119 -2
View File
@@ -114,7 +114,19 @@
<hr class="section-divider">
<h4 class="section-title"><i class="fas fa-user-friends"></i> Select Players</h4>
<p class="text-muted small"><i class="fas fa-info-circle"></i> Click on players to assign them to Team 1 or Team 2. Players available in all selected time blocks are shown below.</p>
<!-- Randomize Teams Section -->
<div class="randomize-section">
<div class="randomize-controls">
<label><i class="fas fa-random"></i> Randomize Teams:</label>
<input type="number" id="team1-size" class="randomize-input" min="1" value="1" onchange="updateRandomizePreview()">
<span>vs</span>
<span id="team2-size-preview" class="randomize-preview">0</span>
<button type="button" class="btn btn-sm randomize-btn" onclick="randomizeTeams()">
<i class="fas fa-random"></i> Randomize
</button>
</div>
<p class="text-muted small" id="randomize-hint">Select players then click Randomize to split them into teams.</p>
</div>
<div class="pvp-layout">
<div class="team-column">
@@ -203,7 +215,7 @@
font-size: 14px;
}
.team-selection .player-item:hover {
background: var(--accent-color);
background: var(--primary);
color: white;
}
.player-pool {
@@ -277,6 +289,41 @@
.team-selection .player-item:hover .remove-btn {
opacity: 1;
}
.randomize-section {
margin: 15px 0;
padding: 10px;
background: var(--bg-secondary);
border-radius: 8px;
}
.randomize-controls {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.randomize-controls label {
margin: 0;
font-weight: 500;
}
.randomize-input {
width: 60px;
padding: 4px 8px;
border: 1px solid var(--border-color);
border-radius: 4px;
}
.randomize-preview {
font-weight: bold;
min-width: 20px;
text-align: center;
}
.randomize-btn {
background: var(--primary);
color: white;
}
.randomize-btn:hover {
background: var(--primary-dark);
}
</style>
<script>
// Player data as simple JS object (id -> full_name)
@@ -645,6 +692,7 @@ function updatePlayerPool() {
});
pool.innerHTML = html || '<p class="text-muted small">No players available</p>';
updateRandomizePreview();
}
function assignToTeam(playerId, teamSide) {
@@ -727,5 +775,74 @@ function toggleMatchType() {
scrimSection.classList.remove('hidden');
}
}
function updateRandomizePreview() {
var checkedCount = document.querySelectorAll('#team1-selection [data-player-id], #team2-selection [data-player-id]').length;
var team1Size = parseInt(document.getElementById('team1-size').value) || 1;
var team2Size = checkedCount - team1Size;
if (team2Size < 0) team2Size = 0;
document.getElementById('team2-size-preview').textContent = team2Size;
}
function randomizeTeams() {
var allAssigned = [];
// Get all players currently in either team
document.querySelectorAll('#team1-selection [data-player-id], #team2-selection [data-player-id]').forEach(function(el) {
allAssigned.push(parseInt(el.getAttribute('data-player-id')));
});
if (allAssigned.length === 0) {
alert('Please assign at least one player before randomizing teams.');
return;
}
// Shuffle the array using Fisher-Yates
for (var i = allAssigned.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = allAssigned[i];
allAssigned[i] = allAssigned[j];
allAssigned[j] = temp;
}
var team1Size = parseInt(document.getElementById('team1-size').value) || 1;
var team1Players = allAssigned.slice(0, team1Size);
var team2Players = allAssigned.slice(team1Size);
// Clear both teams
document.querySelectorAll('#team1-selection [data-player-id], #team2-selection [data-player-id]').forEach(function(el) {
el.remove();
});
// Assign shuffled players to teams
team1Players.forEach(function(pid) {
var teamDiv = document.getElementById('team1-selection');
var playerName = playerDataById.player_data[pid];
if (playerName) {
var html = '<div class="player-item" data-player-id="' + pid + '" onclick="returnToPool(' + pid + ', event)">';
html += playerName;
html += '<span class="remove-btn">↺</span>';
html += '</div>';
teamDiv.insertAdjacentHTML('beforeend', html);
}
});
team2Players.forEach(function(pid) {
var teamDiv = document.getElementById('team2-selection');
var playerName = playerDataById.player_data[pid];
if (playerName) {
var html = '<div class="player-item" data-player-id="' + pid + '" onclick="returnToPool(' + pid + ', event)">';
html += playerName;
html += '<span class="remove-btn">↺</span>';
html += '</div>';
teamDiv.insertAdjacentHTML('beforeend', html);
}
});
updateHiddenInputs();
updateRandomizePreview();
}
</script>
{% endblock %}