Files
Escapepage/templates/game/admin/feedback/index.html.twig
T
FrankandClaude Sonnet 5 5dc01a358a Add pagination/search/sort to the admin tables that can grow large
Uses simple-datatables (vanilla JS, no jQuery needed) on the Users,
Sessions, Email Log, and Feedback tables, since those grow with real
usage. Left Games (small, admin-curated) and Hints (row order is
meaningful - "checked in order" - a sortable column would mislead)
untouched.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-28 20:39:14 +02:00

68 lines
4.3 KiB
Twig

{% extends 'game/admin/base.html.twig' %}
{% block title %}Feedback — Admin{% endblock %}
{% block admin_body %}
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
<h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Feedback</h1>
<span style="color: #64748b; font-size: 0.9rem;">{{ entries|length }} submission{{ entries|length != 1 ? 's' : '' }}</span>
</div>
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem;">
{% set stats = [
{ label: 'Submissions', value: summary.count, color: '#64748b' },
{ label: 'Avg. Difficulty', value: summary.avgDifficulty is not null ? summary.avgDifficulty ~ '/10' : '—', color: '#3b82f6' },
{ label: 'Avg. Entertainment', value: summary.avgEntertaining is not null ? summary.avgEntertaining ~ '/10' : '—', color: '#8b5cf6' },
{ label: 'Avg. Theme', value: summary.avgTheme is not null ? summary.avgTheme ~ '/10' : '—', color: '#10b981' },
] %}
{% for stat in stats %}
<div style="
background: #fff;
border-radius: 8px;
padding: 1.25rem;
border-left: 4px solid {{ stat.color }};
box-shadow: 0 1px 3px rgba(0,0,0,.07);
">
<div style="font-size: 1.75rem; font-weight: 700; color: {{ stat.color }};">{{ stat.value }}</div>
<div style="font-size: 0.8rem; color: #64748b; margin-top: 0.25rem;">{{ stat.label }}</div>
</div>
{% endfor %}
</div>
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
<table class="admin-datatable" style="width: 100%; min-width: 760px; border-collapse: collapse; font-size: 0.9rem;">
<thead>
<tr style="background: #f1f5f9; border-bottom: 1px solid #e2e8f0;">
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Game</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Session</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Player</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Difficulty</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Entertainment</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Theme</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Comment</th>
</tr>
</thead>
<tbody>
{% for entry in entries %}
<tr style="border-bottom: 1px solid #f1f5f9;">
<td style="padding: 0.75rem 1rem; font-weight: 500; color: #0f172a;">{{ entry.session.game.name }}</td>
<td style="padding: 0.75rem 1rem;">
<a href="{{ path('game_admin_view_session', {session: entry.session.id}) }}" style="color: #3b82f6; text-decoration: none;">#{{ entry.session.id }}</a>
</td>
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.player.user.username }}</td>
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.difficulty ?? '—' }}</td>
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.entertaining ?? '—' }}</td>
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.theme ?? '—' }}</td>
<td style="padding: 0.75rem 1rem; color: #475569; max-width: 320px; white-space: pre-wrap;">{{ entry.text ?? '' }}</td>
</tr>
{% else %}
<tr>
<td colspan="7" style="padding: 2rem; text-align: center; color: #94a3b8;">No feedback submitted yet.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}