<?php
/// file: app/View/admin/contacts/index.php

declare(strict_types=1);

/** @var list<array<string, mixed>> $rows */
?>
<h1 class="text-2xl font-semibold text-white">Contact submissions</h1>
<div class="mt-8 overflow-x-auto">
    <table class="min-w-full text-left text-sm text-silver-300">
        <thead class="border-b border-white/10 text-xs uppercase text-silver-500">
            <tr><th class="py-3 pr-4">Date</th><th class="py-3 pr-4">Name</th><th class="py-3 pr-4">Email</th><th class="py-3 pr-4">Status</th><th class="py-3">View</th></tr>
        </thead>
        <tbody>
        <?php foreach ($rows as $r): ?>
            <tr class="border-b border-white/5">
                <td class="py-3 pr-4"><?= e((string) ($r['created_at'] ?? '')) ?></td>
                <td class="py-3 pr-4 text-white"><?= e((string) $r['full_name']) ?></td>
                <td class="py-3 pr-4"><?= e((string) $r['email']) ?></td>
                <td class="py-3 pr-4"><?= e((string) $r['status']) ?></td>
                <td class="py-3"><a class="text-electric-300" href="<?= e(url('/admin/contacts/view/' . (int) $r['id'])) ?>">Open</a></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>
