Files
team-tryouts/app/templates/pages/dashboard.html
T
GGThedandClaude Opus 5 80bc1413f1 feat(i18n): traduire l'ensemble des gabarits
Le site s'affiche desormais integralement en francais. 483 chaines, aucune
non traduite, dans les deux catalogues.

Couvert : navigation et mise en page partagee, connexion, les cinq pages
d'erreur, et les 29 gabarits de pages.

Methode
  Marquage semi-automatique, conservateur par construction : seuls des
  motifs sans ambiguite sont balises -- contenu de balises de texte,
  attributs placeholder/title/aria-label, texte suivant une icone, blocs
  title et page_title -- et tout contenu comportant du Jinja ou du balisage
  imbrique est laisse de cote. Deux passes, la seconde pour td, li, h6,
  strong, em et caption.

  97 entrees etaient marquees fuzzy par pybabel update, c'est-a-dire
  devinees par similarite. Une entree fuzzy est **ignoree a l'execution** :
  elles ont donc ete traitees comme non traduites, et le drapeau retire une
  fois la traduction ecrite.

Deux pieges rencontres, tous deux documentes dans docs/translations.md

  Une entite HTML n'est pas du texte. ×, utilise comme libelle de
  bouton de fermeture, a ete balise par la passe automatique. Jinja
  l'echappait alors en × et le bouton aurait affiche le texte
  litteral × au lieu de la croix. Corrige dans cinq gabarits.

  Huit chaines subsistent dans des blocs <script>. Elles fonctionnent mais
  restent fragiles : Jinja echappe & < > " ' dans un bloc script, et ces
  entites n'y sont pas decodees -- une traduction contenant une apostrophe
  droite arriverait dans la chaine JavaScript sous la forme &#39;. Le
  francais retenu utilise des apostrophes typographiques, non echappees,
  donc l'existant est sur. Toute nouvelle chaine a cet endroit devra passer
  par un attribut data- ou un bloc <script type="application/json">.

Vocabulaire retenu -- a valider avec le club
  tryout -> selection · manager -> gerant · coach -> coach (conserve, terme
  d'usage en e-sport) · scout -> recruteur · email -> courriel · scrim ->
  scrim. Les noms de jeux et les postes (Support, Duelist, AWPer) restent
  en anglais : ce sont les termes employes par les joueurs.
  Ces choix vivent dans un seul catalogue, donc chacun se change en un
  endroit.

Reste a faire : les messages flash hors routes/auth.py, et les messages de
validation de app/validators.py, qui necessitent lazy_gettext puisque les
champs de schema sont construits a l'import.

Verifie : 13 pages parcourues dans les deux langues, aucune ne laisse de
marqueur Jinja non evalue ni d'entite doublement echappee. 193 tests.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-07 21:43:29 -04:00

381 lines
15 KiB
HTML

{% extends "layouts/base.html" %}
{% block title %}{{ _('Dashboard') }} - TryoutPro{% endblock %}
{% block page_title %}{{ _('Dashboard') }}{% endblock %}
{% block breadcrumb %}<span class="breadcrumb">Home / Dashboard</span>{% endblock %}
{% block content %}
<div class="dashboard">
{% if user.role == 'admin' %}
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon bg-primary">
<i class="fas fa-users"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_users }}</h3>
<p>{{ _('Total Users') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-success">
<i class="fas fa-user-friends"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_players }}</h3>
<p>{{ _('Players') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-warning">
<i class="fas fa-calendar-check"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_tryouts }}</h3>
<p>{{ _('Total Tryouts') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-info">
<i class="fas fa-clipboard-list"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_evaluations }}</h3>
<p>{{ _('Evaluations') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-danger">
<i class="fas fa-play-circle"></i>
</div>
<div class="stat-info">
<h3>{{ stats.active_tryouts }}</h3>
<p>{{ _('Active Tryouts') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-secondary">
<i class="fas fa-clock"></i>
</div>
<div class="stat-info">
<h3>{{ stats.upcoming_tryouts }}</h3>
<p>{{ _('Upcoming') }}</p>
</div>
</div>
</div>
<div class="dashboard-grid">
<div class="card">
<div class="card-header">
<h3><i class="fas fa-user-plus"></i> {{ _('Recent Users') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead>
<tr><th>{{ _('Name') }}</th><th>{{ _('Role') }}</th><th>{{ _('Joined') }}</th></tr>
</thead>
<tbody>
{% for u in stats.recent_users %}
<tr>
<td>{{ u.username }}</td>
<td><span class="badge badge-{{ u.role }}">{{ u.role }}</span></td>
<td>{{ u.created_at.strftime('%m/%d/%Y') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card">
<div class="card-header">
<h3><i class="fas fa-calendar-alt"></i> {{ _('Recent Tryouts') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead>
<tr><th>{{ _('Title') }}</th><th>{{ _('Date') }}</th><th>{{ _('Status') }}</th></tr>
</thead>
<tbody>
{% for t in stats.recent_tryouts %}
<tr>
<td><a href="{{ url_for('tryouts.view_tryout', tryout_id=t.id) }}">{{ t.title }}</a></td>
<td>{{ t.date.strftime('%m/%d/%Y') }}</td>
<td><span class="badge badge-{{ t.status }}">{{ t.status }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% if stats.upcoming_matches %}
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-futbol"></i> {{ _('Upcoming Matches') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead><tr><th>{{ _('Match') }}</th><th>{{ _('Tryout') }}</th><th>{{ _('Date & Time') }}</th><th>{{ _('Status') }}</th></tr></thead>
<tbody>
{% for match in stats.upcoming_matches %}
<tr>
<td>{{ match.title }}</td>
<td><a href="{{ url_for('tryouts.view_tryout', tryout_id=match.tryout_id) }}">{{ match.tryout.title }}</a></td>
<td>
{{ match.date.strftime('%m/%d/%Y') }}
{% if match.start_time %} at {{ match.start_time.strftime('%I:%M %p') }}{% endif %}
</td>
<td><span class="badge badge-{{ match.status }}">{{ match.status }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% elif user.role == 'manager' %}
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon bg-primary">
<i class="fas fa-calendar-alt"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_tryouts }}</h3>
<p>{{ _('My Tryouts') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-success">
<i class="fas fa-play-circle"></i>
</div>
<div class="stat-info">
<h3>{{ stats.active_tryouts }}</h3>
<p>{{ _('Active') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-info">
<i class="fas fa-clipboard-check"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_evaluations }}</h3>
<p>{{ _('My Evaluations') }}</p>
</div>
</div>
</div>
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-calendar"></i> {{ _('My Tryouts') }}</h3>
<a href="{{ url_for('tryouts.create_tryout') }}" class="btn btn-sm btn-primary">+ New Tryout</a>
</div>
<div class="card-body">
<table class="table">
<thead>
<tr><th>{{ _('Title') }}</th><th>{{ _('Date') }}</th><th>{{ _('Status') }}</th><th>{{ _('Players') }}</th><th>{{ _('Actions') }}</th></tr>
</thead>
<tbody>
{% for t in stats.my_tryouts %}
<tr>
<td>{{ t.title }}</td>
<td>{{ t.date.strftime('%m/%d/%Y') }}</td>
<td><span class="badge badge-{{ t.status }}">{{ t.status }}</span></td>
<td>{{ t.registrations.count() }}</td>
<td><a href="{{ url_for('tryouts.view_tryout', tryout_id=t.id) }}" class="btn btn-sm btn-outline">View</a></td>
</tr>
{% endfor %}
{% if not stats.my_tryouts %}
<tr><td colspan="5" class="text-center">No tryouts yet. <a href="{{ url_for('tryouts.create_tryout') }}">Create one</a></td></tr>
{% endif %}
</tbody>
</table>
</div>
</div>
{% if stats.upcoming_matches %}
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-futbol"></i> {{ _('Upcoming Matches') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead><tr><th>{{ _('Match') }}</th><th>{{ _('Tryout') }}</th><th>{{ _('Date & Time') }}</th><th>{{ _('Status') }}</th></tr></thead>
<tbody>
{% for match in stats.upcoming_matches %}
<tr>
<td>{{ match.title }}</td>
<td><a href="{{ url_for('tryouts.view_tryout', tryout_id=match.tryout_id) }}">{{ match.tryout.title }}</a></td>
<td>
{{ match.date.strftime('%m/%d/%Y') }}
{% if match.start_time %} at {{ match.start_time.strftime('%I:%M %p') }}{% endif %}
</td>
<td><span class="badge badge-{{ match.status }}">{{ match.status }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% elif user.role == 'coach' %}
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon bg-primary">
<i class="fas fa-clipboard-check"></i>
</div>
<div class="stat-info">
<h3>{{ stats.my_evaluations }}</h3>
<p>{{ _('Evaluations Done') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-warning">
<i class="fas fa-hourglass-half"></i>
</div>
<div class="stat-info">
<h3>{{ stats.pending_evaluations }}</h3>
<p>{{ _('Pending') }}</p>
</div>
</div>
</div>
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-history"></i> {{ _('Recent Evaluations') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead>
<tr><th>{{ _('Player') }}</th><th>{{ _('Tryout') }}</th><th>{{ _('Score') }}</th><th>{{ _('Date') }}</th></tr>
</thead>
<tbody>
{% for e in stats.my_recent_evaluations %}
<tr>
<td>{{ e.player.username }}</td>
<td>{{ e.tryout.title }}</td>
<td><span class="score">{{ e.overall_score }}</span></td>
<td>{{ e.created_at.strftime('%m/%d/%Y') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% elif user.role == 'player' %}
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon bg-primary">
<i class="fas fa-calendar-check"></i>
</div>
<div class="stat-info">
<h3>{{ stats.my_tryouts }}</h3>
<p>{{ _('My Tryouts') }}</p>
</div>
</div>
</div>
<div class="dashboard-grid">
<div class="card">
<div class="card-header">
<h3><i class="fas fa-futbol"></i> {{ _('My Next Matches') }}</h3>
</div>
<div class="card-body">
{% if stats.next_matches %}
<table class="table">
<thead><tr><th>{{ _('Tryout') }}</th><th>{{ _('Match') }}</th><th>{{ _('Date & Time') }}</th><th>{{ _('Opponent') }}</th></tr></thead>
<tbody>
{% for item in stats.next_matches %}
<tr>
<td><a href="{{ url_for('tryouts.view_tryout', tryout_id=item.tryout.id) }}">{{ item.tryout.title }}</a></td>
<td>{{ item.match.title }}</td>
<td>
{{ item.match.date.strftime('%m/%d/%Y') }}
{% if item.match.start_time %} at {{ item.match.start_time.strftime('%I:%M %p') }}{% endif %}
</td>
<td>
{% if item.match.match_type == 'team_vs_team' and item.team %}
{% if item.match.team1_id == item.team.id %}
vs {{ item.match.team2.name if item.match.team2 else 'TBD' }}
{% else %}
vs {{ item.match.team1.name if item.match.team1 else 'TBD' }}
{% endif %}
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">{{ _('No upcoming matches yet.') }}</p>
{% endif %}
</div>
</div>
<div class="card">
<div class="card-header">
<h3><i class="fas fa-clipboard-list"></i> {{ _('My Registrations') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead><tr><th>{{ _('Tryout') }}</th><th>{{ _('Date') }}</th><th>{{ _('Status') }}</th></tr></thead>
<tbody>
{% for r in stats.my_registrations %}
<tr>
<td><a href="{{ url_for('tryouts.view_tryout', tryout_id=r.tryout.id) }}">{{ r.tryout.title }}</a></td>
<td>{{ r.tryout.date.strftime('%m/%d/%Y') }}</td>
<td><span class="badge badge-{{ r.status }}">{{ r.status }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% elif user.role == 'scout' %}
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon bg-primary">
<i class="fas fa-user-friends"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_players }}</h3>
<p>{{ _('Total Players') }}</p>
</div>
</div>
<div class="stat-card">
<div class="stat-icon bg-info">
<i class="fas fa-clipboard-list"></i>
</div>
<div class="stat-info">
<h3>{{ stats.total_evaluations }}</h3>
<p>{{ _('Total Evaluations') }}</p>
</div>
</div>
</div>
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-trophy"></i> {{ _('Top Rated Players') }}</h3>
</div>
<div class="card-body">
<table class="table">
<thead><tr><th>#</th><th>{{ _('Player') }}</th><th>{{ _('Avg Score') }}</th></tr></thead>
<tbody>
{% for player, score in stats.top_players %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ player.username }}</td>
<td><span class="score">{{ score }}</span></td>
</tr>
{% endfor %}
{% if not stats.top_players %}
<tr><td colspan="3" class="text-center">{{ _('No evaluations yet.') }}</td></tr>
{% endif %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>
{% endblock %}