Show marketing opt-in status in admin users overview
Adds a Marketing column to the admin users table and a total opt-in count in the header, so admins can see who signed up for updates on future projects. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,8 +22,11 @@ final class GameAdminUserController extends AbstractController
|
|||||||
#[Route('', name: 'game_admin_users', methods: ['GET'])]
|
#[Route('', name: 'game_admin_users', methods: ['GET'])]
|
||||||
public function index(UserRepository $userRepository): Response
|
public function index(UserRepository $userRepository): Response
|
||||||
{
|
{
|
||||||
|
$users = $userRepository->findBy([], ['id' => 'ASC']);
|
||||||
|
|
||||||
return $this->render('game/admin/users/index.html.twig', [
|
return $this->render('game/admin/users/index.html.twig', [
|
||||||
'users' => $userRepository->findBy([], ['id' => 'ASC']),
|
'users' => $users,
|
||||||
|
'marketingOptInCount' => count(array_filter($users, static fn (User $user) => $user->isMarketingOptIn())),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{% block admin_body %}
|
{% block admin_body %}
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
|
<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;">Users</h1>
|
<h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Users</h1>
|
||||||
<span style="color: #64748b; font-size: 0.9rem;">{{ users|length }} total</span>
|
<span style="color: #64748b; font-size: 0.9rem;">{{ users|length }} total · {{ marketingOptInCount }} opted in to marketing</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
|
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Email</th>
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Email</th>
|
||||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Roles</th>
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Roles</th>
|
||||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Verified</th>
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Verified</th>
|
||||||
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Marketing</th>
|
||||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Actions</th>
|
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -49,6 +50,13 @@
|
|||||||
<span style="color: #dc2626;">✗ No</span>
|
<span style="color: #dc2626;">✗ No</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td style="padding: 0.75rem 1rem;">
|
||||||
|
{% if user.marketingOptIn %}
|
||||||
|
<span style="color: #16a34a; font-weight: 500;">✓ Yes</span>
|
||||||
|
{% else %}
|
||||||
|
<span style="color: #dc2626;">✗ No</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td style="padding: 0.75rem 1rem;">
|
<td style="padding: 0.75rem 1rem;">
|
||||||
<a href="{{ path('game_admin_user_edit', {id: user.id}) }}" style="
|
<a href="{{ path('game_admin_user_edit', {id: user.id}) }}" style="
|
||||||
color: #3b82f6;
|
color: #3b82f6;
|
||||||
@@ -74,7 +82,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="6" style="padding: 2rem; text-align: center; color: #94a3b8;">No users found.</td>
|
<td colspan="7" style="padding: 2rem; text-align: center; color: #94a3b8;">No users found.</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user