<?php require_once __DIR__ . '/includes/admin_bootstrap.php';
ugfx_require_permission('applications');
$adminTitle='Applications';
$items = array_reverse(ugfx_read_json($ugfx['storage']['applications'], []));
include __DIR__ . '/includes/admin_header.php'; ?>
<div class="ugfx-card p-4"><h3>Join the Team applications</h3><div class="table-responsive"><table class="table ugfx-table"><thead><tr><th>Name</th><th>Email</th><th>Role</th><th>Availability</th><th>Attachment</th><th>Status</th><th>Submitted</th></tr></thead><tbody><?php foreach ($items as $item): ?><tr><td><?= htmlspecialchars($item['name'] ?? '') ?></td><td><?= htmlspecialchars($item['email'] ?? '') ?></td><td><?= htmlspecialchars($item['role'] ?? '') ?></td><td><?= htmlspecialchars($item['availability'] ?? '') ?></td><td><?php if (!empty($item['attachment']['path'])): ?><a href="../<?= htmlspecialchars($item['attachment']['path']) ?>" target="_blank" rel="noopener"><?= htmlspecialchars($item['attachment']['name'] ?? 'Open file') ?></a><?php else: ?><span class="text-secondary">—</span><?php endif; ?></td><td><?= htmlspecialchars($item['status'] ?? 'new') ?></td><td><?= htmlspecialchars($item['created_at'] ?? '') ?></td></tr><tr><td colspan="7" class="text-secondary small"><?= nl2br(htmlspecialchars($item['experience'] ?? '')) ?><?php if (!empty($item['links'])): ?><div class="mt-2">Links: <?= nl2br(htmlspecialchars($item['links'])) ?></div><?php endif; ?></td></tr><?php endforeach; ?></tbody></table></div></div>
<?php include __DIR__ . '/includes/admin_footer.php'; ?>
