ajout d'un calendrier pour sceduler des match

This commit is contained in:
cedrick2711
2026-07-14 13:35:30 -04:00
parent acb9bc3256
commit 83ee10ca64
15 changed files with 968 additions and 6 deletions
+105 -2
View File
@@ -6,9 +6,14 @@
{% block content %}
<div class="tryout-detail">
<div class="card mb-4">
<div class="card-header">
<div class="card-header">
<h3>Tryout Details</h3>
<div class="card-actions">
{% if can_edit %}
<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() }}"/>
@@ -226,6 +231,80 @@
</div>
</div>
{% if matches %}
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-futbol"></i> Scheduled Matches</h3>
{% if can_edit %}
<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>
{% endif %}
</div>
<div class="card-body">
<!-- Mini Calendar -->
<div id="mini-calendar" style="min-height: 300px;"></div>
<!-- Matches Table -->
<div class="table-container mt-3">
<table class="table">
<thead>
<tr>
<th>Match</th>
<th>Type</th>
<th>Date</th>
<th>Participants</th>
<th>Time</th>
<th>Status</th>
{% if can_edit %}
<th>Actions</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for item in match_data %}
{% set m = item.match %}
<tr>
<td class="cell-title">{{ m.title }}</td>
<td>
<span class="badge badge-{{ 'success' if m.match_type == 'team_vs_team' else 'warning' }}">
{{ 'Team vs Team' if m.match_type == 'team_vs_team' else 'Player Scrim' }}
</span>
</td>
<td>{{ m.date.strftime('%m/%d/%Y') }}</td>
<td>
{% if m.match_type == 'team_vs_team' %}
{{ item.participants.team1 }} vs {{ item.participants.team2 }}
{% else %}
{{ item.participants | join(', ') }}
{% endif %}
</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>
<span class="badge badge-{{ m.status }}">{{ m.status }}</span>
</td>
{% if can_edit %}
<td>
<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>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
<div class="card mt-4">
<div class="card-header">
<h3><i class="fas fa-star"></i> Evaluation Summary</h3>
@@ -274,5 +353,29 @@
<script>
function showCreateTeam() { document.getElementById('createTeamForm').classList.remove('hidden'); }
function hideCreateTeam() { document.getElementById('createTeamForm').classList.add('hidden'); }
// 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) {
// Could show match details or edit link
if (info.event.extendedProps.match_id) {
window.location.href = '/matches/' + info.event.extendedProps.match_id + '/edit';
}
}
});
miniCalendar.render();
}
});
</script>
{% endblock %}
{% endblock %}