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

declare(strict_types=1);

/** @var array<string, mixed> $row */
?>
<h1 class="text-2xl font-semibold text-white">Submission</h1>
<div class="mt-6 space-y-2 text-sm text-silver-300">
    <p><span class="text-silver-500">Name:</span> <?= e((string) $row['full_name']) ?></p>
    <p><span class="text-silver-500">Email:</span> <?= e((string) $row['email']) ?></p>
    <p><span class="text-silver-500">Company:</span> <?= e((string) ($row['company'] ?? '')) ?></p>
    <p><span class="text-silver-500">Type:</span> <?= e((string) ($row['project_type'] ?? '')) ?></p>
    <p><span class="text-silver-500">Budget:</span> <?= e((string) ($row['budget_range'] ?? '')) ?></p>
    <p><span class="text-silver-500">Timeline:</span> <?= e((string) ($row['timeline'] ?? '')) ?></p>
    <p class="whitespace-pre-wrap pt-4 text-white"><?= e((string) $row['message']) ?></p>
</div>
<form method="post" action="<?= e(url('/admin/contacts/status/' . (int) $row['id'])) ?>" class="mt-8 flex gap-4">
    <?= \App\Core\Csrf::field() ?>
    <select name="status" class="rounded border border-white/10 bg-charcoal px-3 py-2 text-white">
        <option value="new" <?= ($row['status'] === 'new') ? 'selected' : '' ?>>new</option>
        <option value="read" <?= ($row['status'] === 'read') ? 'selected' : '' ?>>read</option>
        <option value="archived" <?= ($row['status'] === 'archived') ? 'selected' : '' ?>>archived</option>
    </select>
    <button type="submit" class="rounded-full bg-white px-4 py-2 text-xs font-semibold text-carbon">Update status</button>
</form>
<a href="<?= e(url('/admin/contacts')) ?>" class="mt-6 inline-block text-sm text-electric-300">Back</a>
