régler problème avec les liens TRN

This commit is contained in:
cedrick2711
2026-07-15 16:29:58 -04:00
parent 073543fc48
commit ca60f001e2
13 changed files with 368 additions and 47 deletions
+71 -8
View File
@@ -54,17 +54,45 @@
{% endfor %}
</div>
</div>
<div class="form-row">
<div class="form-group col-4">
<label for="trn_username">TRN (Tracker Network) Username</label>
<input type="text" id="trn_username" name="trn_username" value="{{ user.trn_username or '' }}" placeholder="Tracker Network username">
<!-- Gamertag inputs - will be shown when game is selected -->
<div id="gamertag-section" style="display: none;">
<hr class="section-divider">
<h4 class="section-title"><i class="fas fa-chart-line"></i> Gamertags for TRN</h4>
<p class="text-muted small">Enter gamertag for each selected game to link to Tracker Network.</p>
{% for game in esport_games %}
{% set gamertag_data = user_gamertags.get(game) %}
<div class="gamertag-input-row" data-game="{{ game }}" style="display: none; margin-bottom: 15px; padding: 15px; background: #f9fafb; border-radius: 8px;">
<h5 style="margin-top: 0; margin-bottom: 10px;">{{ game }}</h5>
<div class="form-row">
<div class="form-group col-6">
<label for="gamertag_{{ game }}">Gamertag</label>
<input type="text" id="gamertag_{{ game }}" name="gamertag_{{ game }}" value="{{ gamertag_data.gamertag if gamertag_data else '' }}" placeholder="Gamertag">
</div>
{% if game_platforms.get(game) %}
<div class="form-group col-6">
<label for="platform_{{ game }}">Platform</label>
<select id="platform_{{ game }}" name="platform_{{ game }}">
<option value="">Select Platform</option>
{% for platform in game_platforms[game] %}
<option value="{{ platform }}" {% if gamertag_data and gamertag_data.platform == platform %}selected{% endif %}>{{ platform }}</option>
{% endfor %}
</select>
</div>
{% endif %}
</div>
</div>
<div class="form-group col-4">
<label for="discord_username">Discord Username</label>
{% endfor %}
</div>
<div class="form-row">
<div class="form-group col-6">
<label for="discord_username"><i class="fab fa-discord"></i> Discord Username</label>
<input type="text" id="discord_username" name="discord_username" value="{{ user.discord_username or '' }}" placeholder="e.g. Name#1234">
</div>
<div class="form-group col-4">
<label for="league_os_profile">League OS Connection</label>
<div class="form-group col-6">
<label for="league_os_profile"><i class="fas fa-link"></i> League OS Connection</label>
<input type="text" id="league_os_profile" name="league_os_profile" value="{{ user.league_os_profile or '' }}" placeholder="League OS profile link or ID">
</div>
</div>
@@ -80,4 +108,39 @@
</form>
</div>
</div>
<script>
// Show/hide gamertag inputs when games are checked
function toggleGamertagInputs() {
var selectedGames = [];
document.querySelectorAll('input[name="games"]:checked').forEach(function(cb) {
selectedGames.push(cb.value);
});
if (selectedGames.length > 0) {
document.getElementById('gamertag-section').style.display = 'block';
} else {
document.getElementById('gamertag-section').style.display = 'none';
}
document.querySelectorAll('.gamertag-input-row').forEach(function(row) {
if (selectedGames.includes(row.dataset.game)) {
row.style.display = 'block';
} else {
row.style.display = 'none';
}
});
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
// Set up event listeners for game checkboxes
document.querySelectorAll('input[name="games"]').forEach(function(cb) {
cb.addEventListener('change', toggleGamertagInputs);
});
// Show gamertag inputs for already selected games
toggleGamertagInputs();
});
</script>
{% endblock %}