Admin can now open a message via a per-row "View" page (which stamps read_at the first time it's opened), see a sortable Read column on the list instead of the raw message text, and soft-delete messages via a Delete button on both the list and detail view. Deleted messages are excluded from the default list so it doesn't pile up over time.
55 lines
3.5 KiB
Twig
55 lines
3.5 KiB
Twig
{% extends 'game/admin/base.html.twig' %}
|
|
|
|
{% block title %}Contact Messages — 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;">Contact Messages</h1>
|
|
<span style="color: #64748b; font-size: 0.9rem;">{{ messages|length }} message{{ messages|length != 1 ? 's' : '' }}</span>
|
|
</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;">Received</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Name</th>
|
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Email</th>
|
|
<th data-type="boolean" style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Read</th>
|
|
<th data-sortable="false" style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for entry in messages %}
|
|
<tr style="border-bottom: 1px solid #f1f5f9;">
|
|
<td style="padding: 0.75rem 1rem; color: #475569; white-space: nowrap;">{{ entry.createdAt|date('Y-m-d H:i:s') }}</td>
|
|
<td style="padding: 0.75rem 1rem; font-weight: 500; color: #0f172a;">{{ entry.name }}</td>
|
|
<td style="padding: 0.75rem 1rem; color: #475569;">
|
|
<a href="mailto:{{ entry.email }}" style="color: #3b82f6; text-decoration: none;">{{ entry.email }}</a>
|
|
</td>
|
|
<td style="padding: 0.75rem 1rem; color: #16a34a; font-weight: 600;">{{ entry.read ? '✓' : '' }}</td>
|
|
<td style="padding: 0.75rem 1rem;">
|
|
<a href="{{ path('game_admin_contact_show', {id: entry.id}) }}" style="color: #3b82f6; text-decoration: none; font-size: 0.85rem; margin-right: 0.75rem;">View</a>
|
|
<form method="post" action="{{ path('game_admin_contact_delete', {id: entry.id}) }}" style="display: inline;" onsubmit="return confirm('Delete message from {{ entry.name }}?')">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('delete_contact_' ~ entry.id) }}">
|
|
<button type="submit" style="
|
|
background: none;
|
|
border: none;
|
|
color: #ef4444;
|
|
cursor: pointer;
|
|
font-size: 0.85rem;
|
|
padding: 0;
|
|
">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr>
|
|
<td colspan="5" style="padding: 2rem; text-align: center; color: #94a3b8;">No messages yet.</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endblock %}
|