better classe and add view page web Player, Match, Tournoi

This commit is contained in:
Theouche
2024-07-24 18:29:10 +02:00
parent c82085dc0e
commit 2efc9bc962
11 changed files with 509 additions and 23 deletions

View File

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Matches List</title>
</head>
<body>
<h1>Matches List</h1>
<table border="1">
<thead>
<tr>
<th>ID</th>
<th>Player 1</th>
<th>Player 2</th>
<th>Score Player 1</th>
<th>Score Player 2</th>
<th>Winner</th>
<th>Ball Touches Player 1</th>
<th>Ball Touches Player 2</th>
<th>Duration</th>
<th>Date</th>
<th>Is Tournament</th>
<th>Tournament</th>
</tr>
</thead>
<tbody>
{% for match in matches %}
<tr>
<td>{{ match.id }}</td>
<td>{{ match.player1.name }}</td>
<td>{{ match.player2.name }}</td>
<td>{{ match.score_player1 }}</td>
<td>{{ match.score_player2 }}</td>
<td>{{ match.winner.name }}</td>
<td>{{ match.nbr_ball_touch_p1 }}</td>
<td>{{ match.nbr_ball_touch_p2 }}</td>
<td>{{ match.duration }}</td>
<td>{{ match.date }}</td>
<td>{{ match.is_tournoi }}</td>
<td>{{ match.tournoi.name }}</td>
</tr>
{% empty %}
<tr>
<td colspan="12">No matches found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Players List</title>
</head>
<body>
<h1>Players List</h1>
<table border="1">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Total Matches</th>
<th>Total Wins</th>
<th>Win Percentage</th>
<th>Average Match Score</th>
<th>Average Opponent Score</th>
<th>Best Score</th>
<th>Average Ball Touches</th>
<th>Total Duration</th>
<th>Average Duration</th>
<th>Participated Tournaments</th>
<th>Won Tournaments</th>
</tr>
</thead>
<tbody>
{% for player in players %}
<tr>
<td>{{ player.id }}</td>
<td>{{ player.name }}</td>
<td>{{ player.total_match }}</td>
<td>{{ player.total_win }}</td>
<td>{{ player.p_win }}</td>
<td>{{ player.m_score_match }}</td>
<td>{{ player.m_score_adv_match }}</td>
<td>{{ player.best_score }}</td>
<td>{{ player.m_nbr_ball_touch }}</td>
<td>{{ player.total_duration }}</td>
<td>{{ player.m_duration }}</td>
<td>{{ player.num_participated_tournaments }}</td>
<td>{{ player.num_won_tournaments }}</td>
</tr>
{% empty %}
<tr>
<td colspan="13">No players found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tournaments List</title>
</head>
<body>
<h1>Tournaments List</h1>
<table border="1">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Number of Players</th>
<th>Date</th>
<th>Winner</th>
</tr>
</thead>
<tbody>
{% for tournoi in tournois %}
<tr>
<td>{{ tournoi.id }}</td>
<td>{{ tournoi.name }}</td>
<td>{{ tournoi.nbr_player }}</td>
<td>{{ tournoi.date }}</td>
<td>{{ tournoi.winner.name }}</td>
</tr>
{% empty %}
<tr>
<td colspan="5">No tournaments found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>