Files
hoopscout/templates/players/partials/results.html
2026-03-10 15:53:55 +01:00

95 lines
3.8 KiB
HTML

{% load player_query %}
<div class="flex flex-wrap items-center justify-between gap-3">
<h2>Results</h2>
<div class="text-sm text-slate-600">
{{ page_obj.paginator.count }} player{{ page_obj.paginator.count|pluralize }} found
</div>
</div>
{% if search_has_errors %}
<div class="mt-3 rounded-md border border-rose-200 bg-rose-50 p-3 text-sm text-rose-800">
<p class="font-medium">Search filters are invalid.</p>
{% for field in search_form %}
{% for error in field.errors %}
<p>{{ field.label }}: {{ error }}</p>
{% endfor %}
{% endfor %}
{% for error in search_form.non_field_errors %}
<p>{{ error }}</p>
{% endfor %}
</div>
{% endif %}
{% if request.user.is_authenticated %}
{% include "scouting/partials/save_search_form.html" %}
{% endif %}
{% if players %}
<div class="table-wrap mt-4">
<table class="data-table">
<thead>
<tr>
<th>Player</th>
<th>Nationality</th>
<th>Pos / Role</th>
<th>Origin</th>
<th>Height / Weight</th>
<th>Games</th>
<th>MPG</th>
<th>PPG</th>
<th>RPG</th>
<th>APG</th>
{% if request.user.is_authenticated %}<th>Watchlist</th>{% endif %}
</tr>
</thead>
<tbody class="divide-y divide-slate-100 bg-white">
{% for player in players %}
<tr>
<td><a class="font-medium" href="{% url 'players:detail' player.pk %}">{{ player.full_name }}</a></td>
<td>{{ player.nationality.name|default:"-" }}</td>
<td>{{ player.nominal_position.code|default:"-" }} / {{ player.inferred_role.name|default:"-" }}</td>
<td>
{{ player.origin_competition.name|default:"-" }}
{% if player.origin_team %}<div class="text-xs text-slate-500">{{ player.origin_team.name }}</div>{% endif %}
</td>
<td>{{ player.height_cm|default:"-" }} / {{ player.weight_kg|default:"-" }}</td>
<td>{{ player.games_played_value|floatformat:0 }}</td>
<td>{{ player.mpg_value|floatformat:1 }}</td>
<td>{{ player.ppg_value|floatformat:1 }}</td>
<td>{{ player.rpg_value|floatformat:1 }}</td>
<td>{{ player.apg_value|floatformat:1 }}</td>
{% if request.user.is_authenticated %}
<td>
{% if player.id in favorite_player_ids %}
{% include "scouting/partials/favorite_button.html" with player=player is_favorite=True next_url=request.get_full_path %}
{% else %}
{% include "scouting/partials/favorite_button.html" with player=player is_favorite=False next_url=request.get_full_path %}
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="mt-4 flex items-center justify-between gap-3">
<div>
{% if page_obj.has_previous %}
{% query_transform page=page_obj.previous_page_number as prev_query %}
<a class="btn-secondary" href="?{{ prev_query }}" hx-get="?{{ prev_query }}" hx-target="#player-results" hx-swap="innerHTML" hx-push-url="true" hx-indicator="#htmx-loading">Previous</a>
{% endif %}
</div>
<span class="text-sm text-slate-600">Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
<div>
{% if page_obj.has_next %}
{% query_transform page=page_obj.next_page_number as next_query %}
<a class="btn-secondary" href="?{{ next_query }}" hx-get="?{{ next_query }}" hx-target="#player-results" hx-swap="innerHTML" hx-push-url="true" hx-indicator="#htmx-loading">Next</a>
{% endif %}
</div>
</div>
{% else %}
<div class="empty-state mt-4">No players matched the current filters.</div>
{% endif %}