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

declare(strict_types=1);

/** @var list<array<string, mixed>> $careers */
?>
<div class="flex items-center justify-between">
    <h1 class="text-2xl font-semibold text-white">Careers</h1>
    <a href="<?= e(url('/admin/careers/create')) ?>" class="rounded-full bg-white px-4 py-2 text-xs font-semibold text-carbon">New</a>
</div>
<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">Title</th><th class="py-3 pr-4">Status</th><th class="py-3">Actions</th></tr>
        </thead>
        <tbody>
        <?php foreach ($careers as $c): ?>
            <tr class="border-b border-white/5">
                <td class="py-3 pr-4 text-white"><?= e((string) $c['title']) ?></td>
                <td class="py-3 pr-4"><?= e((string) $c['status']) ?></td>
                <td class="py-3">
                    <a class="text-electric-300" href="<?= e(url('/admin/careers/edit/' . (int) $c['id'])) ?>">Edit</a>
                    <form method="post" action="<?= e(url('/admin/careers/delete/' . (int) $c['id'])) ?>" class="inline" onsubmit="return confirm('Delete?');"><?= \App\Core\Csrf::field() ?><button type="submit" class="ml-3 text-red-400">Delete</button></form>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
</div>
