629 lines
34 KiB
HTML
629 lines
34 KiB
HTML
{% extends "layouts/base.html" %}
|
|
{% block title %}{{ tryout.title }} - UdeS team manager{% 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" data-submit-on-change 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" data-confirm="{{ _('Delete this entire tryout? This removes all its 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" data-submit-on-change 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" data-confirm="{{ _('Remove %(name)s from this tryout? They will also be removed from every team and match within it.', name=p.username) }}">
|
|
<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" data-action="show-create-team">
|
|
<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" data-action="hide-create-team">{{ _('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 }}"
|
|
data-action="toggle-tryout-presence" data-match-id="{{ m.id }}" data-participant-id="{{ pp.participant_id }}">
|
|
{{ 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') }}"
|
|
data-action="toggle-tryout-presence" data-match-id="{{ m.id }}" data-participant-id="{{ pp.participant_id }}">
|
|
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();
|
|
}
|
|
});
|
|
|
|
// Behaviours declared in the markup, dispatched by the delegated listener
|
|
// in main.js. Inline onclick attributes cannot be authorised by a CSP nonce.
|
|
registerActions({
|
|
'show-create-team': showCreateTeam,
|
|
'hide-create-team': hideCreateTeam,
|
|
'toggle-tryout-presence': function (element) {
|
|
toggleTryoutPresence(
|
|
element.getAttribute('data-match-id'),
|
|
element.getAttribute('data-participant-id'),
|
|
element);
|
|
},
|
|
});
|
|
</script>
|
|
{% endblock %} |