ajustements des calendriers, ajout de matchs jouer vs joueur

This commit is contained in:
cedrick2711
2026-07-14 14:50:48 -04:00
parent 83ee10ca64
commit 4e7ecf0ab9
13 changed files with 338 additions and 41 deletions
+61 -8
View File
@@ -12,10 +12,11 @@
<form method="POST" action="{{ url_for('matches.create_match', tryout_id=tryout.id) }}" class="form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<div class="form-group">
<div class="form-group">
<label for="match_type">Match Type</label>
<select name="match_type" id="match_type" class="form-select" onchange="toggleMatchType()" required>
<option value="team_vs_team">Team vs Team</option>
<option value="player_vs_player">Player vs Player</option>
<option value="player_scrim">Player Scrim</option>
</select>
</div>
@@ -79,10 +80,41 @@
</div>
</div>
<!-- Player vs Player Selection -->
<div id="player-vs-player-section" class="hidden">
<hr class="section-divider">
<h4 class="section-title"><i class="fas fa-user-friends"></i> Select Players</h4>
<div class="form-row">
<div class="form-group">
<label>Team 1 Players</label>
<div class="checkbox-grid">
{% for player in all_players %}
<label class="checkbox-label">
<input type="checkbox" name="team1_player_ids" value="{{ player.id }}" onchange="handleTeamSelection(this, 1)">
{{ player.full_name }}
</label>
{% endfor %}
</div>
</div>
<div class="form-group">
<label>Team 2 Players</label>
<div class="checkbox-grid">
{% for player in all_players %}
<label class="checkbox-label">
<input type="checkbox" name="team2_player_ids" value="{{ player.id }}" onchange="handleTeamSelection(this, 2)">
{{ player.full_name }}
</label>
{% endfor %}
</div>
</div>
</div>
</div>
<!-- Player Scrim Selection -->
<div id="player-scrim-section" class="hidden">
<hr class="section-divider">
<h4 class="section-title"><i class="fas fa-user-friends"></i> Select Players</h4>
<h4 class="section-title"><i class="fas fa-users"></i> Select Players</h4>
<div class="form-group">
<label>Players</label>
@@ -115,20 +147,41 @@
function toggleMatchType() {
var matchType = document.getElementById('match_type').value;
var teamSection = document.getElementById('team-vs-team-section');
var playerSection = document.getElementById('player-scrim-section');
var playerVsPlayerSection = document.getElementById('player-vs-player-section');
var scrimSection = document.getElementById('player-scrim-section');
// Hide all sections first
teamSection.classList.add('hidden');
playerVsPlayerSection.classList.add('hidden');
scrimSection.classList.add('hidden');
// Show relevant section
if (matchType === 'team_vs_team') {
teamSection.classList.remove('hidden');
playerSection.classList.add('hidden');
} else {
teamSection.classList.add('hidden');
playerSection.classList.remove('hidden');
} else if (matchType === 'player_vs_player') {
playerVsPlayerSection.classList.remove('hidden');
} else if (matchType === 'player_scrim') {
scrimSection.classList.remove('hidden');
}
}
function handleTeamSelection(checkbox, teamSide) {
// When selecting from one team, deselect from the other team
var otherSide = teamSide === 1 ? 2 : 1;
var otherCheckboxes = document.querySelectorAll('input[name="team' + otherSide + '_player_ids"]');
var playerId = checkbox.value;
// Find the corresponding checkbox in the other team and uncheck it
otherCheckboxes.forEach(function(other) {
if (other.value === playerId) {
other.checked = false;
}
});
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
toggleMatchType();
});
</script>
{% endblock %}
{% endblock %}