SEC-WEB-001 / OPS-010. script-src porte toujours 'unsafe-inline' : c'est
pour cela que le XSS stocke de SEC-XSS-001 s'executait au lieu d'etre
bloque. Le retirer n'est pas un changement d'une ligne.
Ce qui bloque reellement
Un nonce autorise des elements <script> ; il ne peut rien pour un
attribut onclick="...". Mesure faite : 76 gestionnaires en ligne repartis
dans 15 gabarits. Tant qu'il en reste un, la politique ne peut pas etre
durcie.
Piege supplementaire, documente dans build_csp() : en CSP niveau 3, un
navigateur ignore 'unsafe-inline' des qu'un nonce est present. Emettre
les deux ne serait donc pas une transition douce -- ce serait couper
d'un coup tous les scripts en ligne et tous les onclick, et uniquement
sur les navigateurs recents. La bascule doit etre atomique, d'ou un
drapeau unique : CSP_ALLOW_INLINE_SCRIPT.
Infrastructure posee
build_csp() assemble l'en-tete selon le drapeau. Un nonce est genere par
requete et n'est emis que lorsque l'inline est interdit. Les 15 blocs
<script> portent deja nonce="{{ csp_nonce }}", inerte aujourd'hui : la
bascule finale sera un changement de configuration, pas de gabarits.
Couche partagee migree en premier
base.html et macros.html sont rendus sur absolument toutes les pages. Six
gestionnaires retires, remplaces par des attributs data-action et un
ecouteur delegue unique dans main.js. La delegation plutot qu'un
ecouteur par widget : le contenu injecte dynamiquement herite du
comportement sans re-attachement.
Un cliquet plutot qu'une promesse
tests/test_csp.py fixe un budget par gabarit qui ne peut que baisser.
Ajouter un gestionnaire en ligne fait echouer la suite ; en retirer sans
mettre le budget a jour aussi, ce qui force a enregistrer la progression
dans le diff. A zero, il ne reste qu'a basculer le drapeau.
Le cliquet a d'ailleurs corrige mon propre relevé : mon grep initial
comptait 83 gestionnaires, la mesure exacte en donne 76 -- le motif ne
verifiait pas l'espace avant l'attribut.
style-src conserve 'unsafe-inline' : les attributs style="" sont partout et
ne constituent pas un vecteur XSS a eux seuls. Migration distincte.
192 tests.
Co-Authored-By: Claude Opus 5 <[email protected]>
618 lines
33 KiB
HTML
618 lines
33 KiB
HTML
{% extends "layouts/base.html" %}
|
|
{% block title %}{{ tryout.title }} - TryoutPro{% endblock %}
|
|
{% block page_title %}{{ tryout.title }}{% endblock %}
|
|
{% block breadcrumb %}<span class="breadcrumb">Home / <a href="{{ url_for('tryouts.list_tryouts') }}">Tryouts</a> / {{ tryout.title }}</span>{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="tryout-detail">
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
<h3>Tryout Details</h3>
|
|
<div class="card-actions">
|
|
{% if can_edit and not tryout.is_ended %}
|
|
<a href="{{ url_for('matches.create_match', tryout_id=tryout.id) }}" class="btn btn-sm btn-success">
|
|
<i class="fas fa-futbol"></i> Schedule Match
|
|
</a>
|
|
{% endif %}
|
|
{% if can_edit %}
|
|
<form method="POST" action="{{ url_for('tryouts.update_status', tryout_id=tryout.id) }}" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<select name="status" onchange="this.form.submit()" class="form-select">
|
|
<option value="upcoming" {% if tryout.status == 'upcoming' %}selected{% endif %}>Upcoming</option>
|
|
<option value="in_progress" {% if tryout.status == 'in_progress' %}selected{% endif %}>In Progress</option>
|
|
<option value="completed" {% if tryout.status == 'completed' %}selected{% endif %}>Completed</option>
|
|
</select>
|
|
</form>
|
|
{% endif %}
|
|
{% if can_edit and not tryout.is_ended %}
|
|
<a href="{{ url_for('tryouts.edit_tryout', tryout_id=tryout.id) }}" class="btn btn-sm btn-primary">
|
|
<i class="fas fa-edit"></i> Edit
|
|
</a>
|
|
{% endif %}
|
|
{% if can_edit %}
|
|
<form method="POST" action="{{ url_for('tryouts.delete_tryout', tryout_id=tryout.id) }}" class="inline-form" onsubmit="return confirm('Are you sure you want to delete this entire tryout? This will remove all matches, teams, registrations, and evaluations.');">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<button type="submit" class="btn btn-sm btn-danger">
|
|
<i class="fas fa-trash"></i> Delete Tryout
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="detail-grid">
|
|
<div class="detail-item">
|
|
<span class="detail-label">Game</span>
|
|
<span class="detail-value">{{ tryout.game }}</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Date</span>
|
|
<span class="detail-value">
|
|
{% if tryout.end_date and tryout.end_date != tryout.date %}
|
|
{{ tryout.date.strftime('%B %d') }} - {{ tryout.end_date.strftime('%B %d, %Y') }}
|
|
{% else %}
|
|
{{ tryout.date.strftime('%A, %B %d, %Y') }}
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Location</span>
|
|
<span class="detail-value">{{ tryout.location or 'Not specified' }}</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Status</span>
|
|
<span class="detail-value">
|
|
<span class="badge badge-{{ tryout.status }}">{{ tryout.status | replace('_', ' ') | title }}</span>
|
|
</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Target Team</span>
|
|
<span class="detail-value">{{ tryout.target_org_team.name if tryout.target_org_team else 'Not specified' }}</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Manager</span>
|
|
<span class="detail-value">{{ tryout.manager.username if tryout.manager else 'Not assigned' }}</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Coaches</span>
|
|
<span class="detail-value">
|
|
{% if tryout.coaches %}
|
|
{{ tryout.coaches | map(attribute='username') | join(', ') }}
|
|
{% elif tryout.coach %}
|
|
{{ tryout.coach.username }}
|
|
{% else %}
|
|
Not assigned
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
<div class="detail-item">
|
|
<span class="detail-label">Registered Players</span>
|
|
<span class="detail-value">{{ registered_players | length }}</span>
|
|
</div>
|
|
{% if tryout.description %}
|
|
<div class="detail-item full-width">
|
|
<span class="detail-label">Description</span>
|
|
<span class="detail-value">{{ tryout.description }}</span>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if current_user.role == 'player' and not is_registered and tryout.status in ['upcoming', 'in_progress'] %}
|
|
<div class="card mb-4">
|
|
<div class="card-body text-center">
|
|
<form method="POST" action="{{ url_for('tryouts.register_for_tryout', tryout_id=tryout.id) }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<button type="submit" class="btn btn-primary btn-lg">
|
|
<i class="fas fa-user-plus"></i> Register for this Tryout
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if can_edit and not tryout.is_ended %}
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
<h3><i class="fas fa-user-plus"></i> Add Player to Tryout</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="POST" action="{{ url_for('tryouts.register_player', tryout_id=tryout.id) }}" class="form-inline">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<select name="player_id" class="form-select" required>
|
|
<option value="">-- Select a player --</option>
|
|
{% for p in all_players %}
|
|
{% set is_already = registrations | selectattr('player_id', 'equalto', p.id) | list | length > 0 %}
|
|
<option value="{{ p.id }}" {% if is_already %}disabled class="text-muted"{% endif %}>{{ p.username }}{% if is_already %} (already registered){% endif %}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button type="submit" class="btn btn-sm btn-primary ml-2">
|
|
<i class="fas fa-plus"></i> Register Player
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="dashboard-grid">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3><i class="fas fa-users"></i> Registered Players ({{ registered_players | length }})</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-container">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Player</th>
|
|
<th>Status</th>
|
|
{% if current_user.can_evaluate() %}
|
|
<th>Evaluation</th>
|
|
{% endif %}
|
|
{% if can_edit %}
|
|
<th>Actions</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for p in registered_players %}
|
|
{% set reg = registrations | selectattr('player_id', 'equalto', p.id) | first %}
|
|
<tr>
|
|
<td>
|
|
<div class="user-mini">
|
|
<div class="avatar-sm">{{ p.username[:2] | upper }}</div>
|
|
<a href="{{ url_for('users.view_user', user_id=p.id) }}">{{ p.username }}</a>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
{% if can_edit %}
|
|
<form method="POST" action="{{ url_for('tryouts.update_registration_status', tryout_id=tryout.id, player_id=p.id) }}" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<select name="status" onchange="this.form.submit()" class="form-select form-select-sm">
|
|
<option value="registered" {% if reg.status == 'registered' %}selected{% endif %}>Registered</option>
|
|
<option value="attended" {% if reg.status == 'attended' %}selected{% endif %}>Attended</option>
|
|
<option value="no_show" {% if reg.status == 'no_show' %}selected{% endif %}>No Show</option>
|
|
</select>
|
|
</form>
|
|
{% else %}
|
|
<span class="badge badge-{{ reg.status }}">{{ reg.status }}</span>
|
|
{% endif %}
|
|
</td>
|
|
{% if current_user.can_evaluate() %}
|
|
<td>
|
|
{% if player_eval_status.get(p.id) %}
|
|
<span class="badge badge-success">Evaluated</span>
|
|
{% else %}
|
|
<span class="badge badge-warning">Pending</span>
|
|
{% endif %}
|
|
</td>
|
|
{% endif %}
|
|
{% if can_edit %}
|
|
<td class="eval-actions">
|
|
{% if current_user.can_evaluate() %}
|
|
<a href="{{ url_for('evaluations.evaluate_player', tryout_id=tryout.id, player_id=p.id) }}" class="btn btn-sm btn-primary" title="Evaluate player">
|
|
<i class="fas fa-edit"></i> {% if player_eval_status.get(p.id) %}Edit{% else %}Evaluate{% endif %}
|
|
</a>
|
|
<a href="{{ url_for('users.add_note_from_tryout', tryout_id=tryout.id) }}?player_id={{ p.id }}" class="btn btn-sm btn-outline" title="Add note for {{ p.username }}">
|
|
<i class="fas fa-sticky-note"></i>
|
|
</a>
|
|
{% endif %}
|
|
{% if not tryout.is_ended %}
|
|
<form method="POST" action="{{ url_for('tryouts.remove_player', tryout_id=tryout.id, player_id=p.id) }}" class="inline-form" onsubmit="return confirm('Remove {{ p.username }} from this tryout? This will also remove them from all teams and matches within this tryout.');">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<button type="submit" class="btn btn-sm btn-danger" title="Remove player from tryout">
|
|
<i class="fas fa-user-minus"></i> Remove
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="{% if can_edit %}{% if current_user.can_evaluate() %}5{% else %}4{% endif %}{% else %}{% if current_user.can_evaluate() %}4{% else %}2{% endif %}{% endif %}" class="text-center">
|
|
No players registered yet.
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3><i class="fas fa-users-cog"></i> Teams</h3>
|
|
{% if can_edit and not tryout.is_ended %}
|
|
<button class="btn btn-sm btn-primary" onclick="showCreateTeam()">
|
|
<i class="fas fa-plus"></i> New Team
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body">
|
|
{% if can_edit and not tryout.is_ended %}
|
|
<div id="createTeamForm" class="hidden mb-3">
|
|
<form method="POST" action="{{ url_for('tryouts.create_team', tryout_id=tryout.id) }}" class="form-inline">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<input type="text" name="team_name" placeholder="Team name" required class="form-input mr-2">
|
|
<button type="submit" class="btn btn-sm btn-success">Create</button>
|
|
<button type="button" class="btn btn-sm btn-secondary" onclick="hideCreateTeam()">Cancel</button>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% for team in team_data %}
|
|
<div class="team-card mb-3">
|
|
<h4 class="team-name">{{ team.team.name }}</h4>
|
|
<ul class="team-members">
|
|
{% for member in team.members %}
|
|
<li>
|
|
<div class="avatar-sm">{{ member.player.username[:2] | upper }}</div>
|
|
<span>{{ member.player.username }}</span>
|
|
{% if member.position %}
|
|
<span class="position-tag">{{ member.position }}</span>
|
|
{% endif %}
|
|
</li>
|
|
{% else %}
|
|
<li class="text-muted">No players assigned yet.</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% if can_edit and not tryout.is_ended and registered_players %}
|
|
{% set positions = game_positions.get(tryout.game, []) %}
|
|
<form method="POST" action="{{ url_for('tryouts.add_to_team', tryout_id=tryout.id, team_id=team.team.id) }}" class="form-inline mt-2">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<select name="player_id" class="form-select" required>
|
|
<option value="">Select player...</option>
|
|
{% for p in registered_players %}
|
|
{% if p.id not in team.members | map(attribute='player') | map(attribute='id') | list %}
|
|
<option value="{{ p.id }}">{{ p.username }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
{% if positions %}
|
|
<select name="position" class="form-select mx-2">
|
|
<option value="">-- Select Position --</option>
|
|
{% for pos in positions %}
|
|
<option value="{{ pos }}">{{ pos }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
<input type="text" name="position" placeholder="Position" class="form-input mx-2">
|
|
{% endif %}
|
|
<button type="submit" class="btn btn-sm btn-primary">Add</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<p class="text-muted text-center">No teams created yet.</p>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if can_view_calendar %}
|
|
<div class="card tryout-schedule-card mb-4">
|
|
<div class="card-header">
|
|
<h3><i class="fas fa-futbol"></i> Schedule</h3>
|
|
{% if can_edit and not tryout.is_ended %}
|
|
<div class="card-actions">
|
|
<a href="{{ url_for('matches.create_match', tryout_id=tryout.id) }}" class="btn btn-sm btn-success">
|
|
<i class="fas fa-plus"></i> Schedule Match
|
|
</a>
|
|
<a href="{{ url_for('users.add_note_from_tryout', tryout_id=tryout.id) }}" class="btn btn-sm btn-primary">
|
|
<i class="fas fa-sticky-note"></i> Add Note
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body">
|
|
{% if matches %}
|
|
<!-- Matches Table -->
|
|
<div class="table-container">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Match</th>
|
|
<th>Type</th>
|
|
<th>Date</th>
|
|
<th>Participants</th>
|
|
<th>Time</th>
|
|
<th>Presence</th>
|
|
<th>Status</th>
|
|
{% if can_edit %}
|
|
<th>Actions</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in match_data %}
|
|
{% set m = item.match %}
|
|
{% set participants = item.participants %}
|
|
<tr>
|
|
<td class="cell-title">{{ m.title }}</td>
|
|
<td>
|
|
<span class="badge badge-{{ 'success' if m.match_type in ['team_vs_team', 'player_vs_player'] else 'warning' }}">
|
|
{% if m.match_type == 'team_vs_team' %}
|
|
Team vs Team
|
|
{% elif m.match_type == 'player_vs_player' %}
|
|
Player vs Player
|
|
{% else %}
|
|
Player Scrim
|
|
{% endif %}
|
|
</span>
|
|
</td>
|
|
<td>{{ m.date.strftime('%m/%d/%Y') }}</td>
|
|
<td>
|
|
{% if m.start_time and m.end_time %}
|
|
{{ m.start_time.strftime('%H:%M') }} - {{ m.end_time.strftime('%H:%M') }}
|
|
{% else %}
|
|
TBD
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if item.total_count > 0 %}
|
|
<span class="presence-summary" title="{{ item.confirmed_count }} of {{ item.total_count }} confirmed">
|
|
{% if item.confirmed_count == item.total_count and item.total_count > 0 %}
|
|
<span class="badge badge-success">✅ {{ item.confirmed_count }}/{{ item.total_count }}</span>
|
|
{% elif item.confirmed_count > 0 %}
|
|
<span class="badge badge-warning">✅ {{ item.confirmed_count }}/{{ item.total_count }}</span>
|
|
{% else %}
|
|
<span class="badge badge-secondary">⏳ 0/{{ item.total_count }}</span>
|
|
{% endif %}
|
|
</span>
|
|
<!-- Per-player presence toggles -->
|
|
{% if can_edit and item.player_presence %}
|
|
<div class="presence-players" style="margin-top:6px;">
|
|
{% for pp in item.player_presence %}
|
|
<button class="btn btn-xs presence-toggle-btn {% if pp.attendance_confirmed %}presence-confirmed-btn{% else %}presence-pending-btn{% endif %}"
|
|
title="{{ pp.player_name }}"
|
|
onclick="toggleTryoutPresence({{ m.id }}, {{ pp.participant_id }}, this)">
|
|
{{ pp.player_name[:2] | upper }} {% if pp.attendance_confirmed %}✅{% else %}⏳{% endif %}
|
|
</button>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
<!-- Player self-presence toggle -->
|
|
{% if not can_edit and item.player_presence %}
|
|
{% for pp in item.player_presence %}
|
|
{% if pp.player_id == current_user.id %}
|
|
<div class="presence-players" style="margin-top:6px;">
|
|
<button class="btn btn-xs presence-toggle-btn {% if pp.attendance_confirmed %}presence-confirmed-btn{% else %}presence-pending-btn{% endif %}"
|
|
title="Toggle your attendance"
|
|
onclick="toggleTryoutPresence({{ m.id }}, {{ pp.participant_id }}, this)">
|
|
Me {% if pp.attendance_confirmed %}✅{% else %}⏳{% endif %}
|
|
</button>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% else %}
|
|
<span class="text-muted">—</span>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if m.match_type == 'team_vs_team' %}
|
|
<div class="match-teams">
|
|
<div class="match-team">
|
|
<span class="team-name">{{ m.team1.name if m.team1 else 'Team 1' }}</span>
|
|
{% if participants.team1_players %}
|
|
<ul class="team-players-list">
|
|
{% for pl in participants.team1_players %}
|
|
<li>{{ pl.name }}{% if pl.position %} <span class="position-tag">{{ pl.position }}</span>{% endif %}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
<div class="match-vs">vs</div>
|
|
<div class="match-team">
|
|
<span class="team-name">{{ m.team2.name if m.team2 else 'Team 2' }}</span>
|
|
{% if participants.team2_players %}
|
|
<ul class="team-players-list">
|
|
{% for pl in participants.team2_players %}
|
|
<li>{{ pl.name }}{% if pl.position %} <span class="position-tag">{{ pl.position }}</span>{% endif %}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% elif m.match_type == 'player_vs_player' %}
|
|
<div class="match-teams">
|
|
<div class="match-team">
|
|
<span class="team-name">Team 1</span>
|
|
{% if participants.team1_players %}
|
|
<ul class="team-players-list">
|
|
{% for pl in participants.team1_players %}
|
|
<li>{{ pl.name }}{% if pl.position %} <span class="position-tag">{{ pl.position }}</span>{% endif %}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
<div class="match-vs">vs</div>
|
|
<div class="match-team">
|
|
<span class="team-name">Team 2</span>
|
|
{% if participants.team2_players %}
|
|
<ul class="team-players-list">
|
|
{% for pl in participants.team2_players %}
|
|
<li>{{ pl.name }}{% if pl.position %} <span class="position-tag">{{ pl.position }}</span>{% endif %}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
{{ participants | join(', ') }}
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<span class="badge badge-{{ m.status }}">{{ m.status }}</span>
|
|
</td>
|
|
{% if can_edit %}
|
|
<td>
|
|
{% if not tryout.is_ended %}
|
|
<a href="{{ url_for('matches.edit_match', match_id=m.id) }}" class="btn btn-sm btn-outline">
|
|
<i class="fas fa-edit"></i> Edit
|
|
</a>
|
|
{% endif %}
|
|
<a href="{{ url_for('users.add_note_from_match', match_id=m.id) }}" class="btn btn-sm btn-primary" title="Add Note for this Match">
|
|
<i class="fas fa-sticky-note"></i> Note
|
|
</a>
|
|
</td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if matches %}
|
|
<!-- Mini Calendar -->
|
|
<div id="mini-calendar" style="min-height: 300px; margin-top: 20px;"></div>
|
|
{% else %}
|
|
<!-- No matches yet - show message -->
|
|
<div class="text-center py-4">
|
|
<i class="fas fa-calendar-alt fa-3x text-muted mb-3"></i>
|
|
<p class="text-muted">No matches scheduled yet. Check back later!</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if current_user.can_evaluate() %}
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3><i class="fas fa-star"></i> Evaluation Summary</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-container">
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Player</th>
|
|
<th>Evaluator</th>
|
|
<th>Mecanics</th>
|
|
<th>Cohesion</th>
|
|
<th>Communication</th>
|
|
<th>Gamesense</th>
|
|
<th>Versatility</th>
|
|
<th>Discipline</th>
|
|
<th>Analysis</th>
|
|
<th>Sport Ethics</th>
|
|
<th>Mental</th>
|
|
<th>Overall</th>
|
|
<th>Recommendation</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for eval in evaluations %}
|
|
<tr>
|
|
<td>{{ eval.player.username }}</td>
|
|
<td>{{ eval.evaluator.username }}</td>
|
|
<td>{{ eval.mecanics_score or '-' }}</td>
|
|
<td>{{ eval.cohesion_score or '-' }}</td>
|
|
<td>{{ eval.communication_score or '-' }}</td>
|
|
<td>{{ eval.gamesense_score or '-' }}</td>
|
|
<td>{{ eval.versatility_score or '-' }}</td>
|
|
<td>{{ eval.discipline_score or '-' }}</td>
|
|
<td>{{ eval.analysis_score or '-' }}</td>
|
|
<td>{{ eval.sport_ethics_score or '-' }}</td>
|
|
<td>{{ eval.mental_score or '-' }}</td>
|
|
<td><span class="score">{{ eval.overall_score or '-' }}</span></td>
|
|
<td>{{ eval.position_recommendation or '-' }}</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="13" class="text-center">No evaluations yet.</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<style>
|
|
.presence-toggle-btn {
|
|
padding: 2px 7px;
|
|
font-size: 0.7rem;
|
|
border-radius: 10px;
|
|
border: 1px solid #d1d5db;
|
|
cursor: pointer;
|
|
margin: 2px;
|
|
font-weight: 600;
|
|
transition: all 0.15s ease;
|
|
}
|
|
.presence-confirmed-btn {
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
border-color: #a7f3d0;
|
|
}
|
|
.presence-pending-btn {
|
|
background: #fef3c7;
|
|
color: #92400e;
|
|
border-color: #fde68a;
|
|
}
|
|
.presence-toggle-btn:hover {
|
|
transform: scale(1.08);
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12);
|
|
}
|
|
</style>
|
|
<script nonce="{{ csp_nonce }}">
|
|
function showCreateTeam() { document.getElementById('createTeamForm').classList.remove('hidden'); }
|
|
function hideCreateTeam() { document.getElementById('createTeamForm').classList.add('hidden'); }
|
|
|
|
function toggleTryoutPresence(matchId, participantId, btn) {
|
|
fetch('/matches/' + matchId + '/toggle-presence/' + participantId, {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRFToken': '{{ csrf_token() }}',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
})
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
if (data.attendance_confirmed) {
|
|
btn.classList.add('presence-confirmed-btn');
|
|
btn.classList.remove('presence-pending-btn');
|
|
btn.innerHTML = btn.innerHTML.replace('⏳', '✅');
|
|
} else {
|
|
btn.classList.remove('presence-confirmed-btn');
|
|
btn.classList.add('presence-pending-btn');
|
|
btn.innerHTML = btn.innerHTML.replace('✅', '⏳');
|
|
}
|
|
location.reload();
|
|
})
|
|
.catch(function(err) {
|
|
console.error('Error toggling tryout presence:', err);
|
|
});
|
|
}
|
|
|
|
// Mini calendar for matches
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
var miniCalendarEl = document.getElementById('mini-calendar');
|
|
if (miniCalendarEl) {
|
|
var miniCalendar = new FullCalendar.Calendar(miniCalendarEl, {
|
|
initialView: 'dayGridMonth',
|
|
headerToolbar: {
|
|
left: 'prev,next',
|
|
center: 'title',
|
|
right: 'dayGridMonth,timeGridWeek'
|
|
},
|
|
events: '/matches/api/events/{{ tryout.id }}',
|
|
height: '300px',
|
|
eventClick: function(info) {
|
|
if (info.event.extendedProps.match_id) {
|
|
window.location.href = '/matches/' + info.event.extendedProps.match_id + '/edit';
|
|
}
|
|
}
|
|
});
|
|
miniCalendar.render();
|
|
}
|
|
});
|
|
</script>
|
|
{% endblock %} |