Files
team-tryouts/templates/pages/edit_user.html
T
cedrick2711 4ed42d5ec8 Ajout de booking pour des One on One avec son coach,
Demande par discord au coach pour confirmer la rencontre
Ajout de message automatisé discord pour avertir des nouveaux match et rappel 24h a l'avance
2026-07-17 15:32:32 -04:00

151 lines
7.5 KiB
HTML

{% extends "layouts/base.html" %}
{% block title %}Edit {{ user.full_name }} - TryoutPro{% endblock %}
{% block page_title %}Edit User{% endblock %}
{% block breadcrumb %}<span class="breadcrumb">Home / <a href="{{ url_for('users.list_users') }}">Users</a> / Edit</span>{% endblock %}
{% block content %}
<div class="card">
<div class="card-body">
<form method="POST" action="{{ url_for('users.edit_user', user_id=user.id) }}" class="form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<div class="form-row">
<div class="form-group col-6">
<label for="full_name">Full Name</label>
<input type="text" id="full_name" name="full_name" value="{{ user.full_name }}" required>
</div>
<div class="form-group col-6">
<label for="email">Email</label>
<input type="email" id="email" name="email" value="{{ user.email }}" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-4">
<label for="phone">Phone</label>
<input type="tel" id="phone" name="phone" value="{{ user.phone or '' }}">
</div>
<div class="form-group col-4">
<label for="role">Role</label>
<select id="role" name="role" required>
{% for r in roles %}
<option value="{{ r }}" {% if user.role == r %}selected{% endif %}>{{ r | capitalize }}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-4">
<label for="is_active_account">
<input type="checkbox" id="is_active_account" name="is_active_account" {% if user.is_active_account %}checked{% endif %}>
Active Account
</label>
</div>
</div>
<hr class="section-divider">
<h4 class="section-title"><i class="fas fa-gamepad"></i> E-Sports Profile</h4>
<div class="form-group">
<label>Games</label>
<div class="checkbox-grid">
{% for game in esport_games %}
{% set games_list = user.get_games_list() %}
<label class="checkbox-label">
<input type="checkbox" name="games" value="{{ game }}" {% if game in games_list %}checked{% endif %}>
<span>{{ game }}</span>
</label>
{% endfor %}
</div>
</div>
<!-- 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>
{% endfor %}
</div>
<div class="form-row">
<div class="form-group col-4">
<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="discord_user_id"><i class="fab fa-discord"></i> Discord User ID <small>(for DMs)</small></label>
<input type="text" id="discord_user_id" name="discord_user_id" value="{{ user.discord_user_id or '' }}" placeholder="Numeric ID (e.g. 123456789012345678)">
<small class="text-muted">Enable Developer Mode in Discord → Right-click profile → Copy ID</small>
</div>
<div class="form-group col-4">
<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>
<div class="form-group">
<label for="password">New Password <small>(leave blank to keep current)</small></label>
<input type="password" id="password" name="password" placeholder="Enter new password">
</div>
<div class="form-actions">
<a href="{{ url_for('users.list_users') }}" class="btn btn-secondary">Cancel</a>
<button type="submit" class="btn btn-primary">Update User</button>
</div>
</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 %}