<?php

declare(strict_types=1);

require_once __DIR__ . '/helpers.php';

staff_module_boot();

$staffRecord = find_staff_or_abort((int) ($_GET['id'] ?? 0));
$pageTitle = 'View Staff Member';

require dirname(__DIR__, 2) . '/includes/header.php';
require dirname(__DIR__, 2) . '/includes/sidebar.php';
require dirname(__DIR__, 2) . '/includes/topbar.php';
require dirname(__DIR__, 2) . '/includes/flash.php';
?>
<section class="panel-card">
    <div class="panel-card-header mb-3">
        <div>
            <p class="eyebrow mb-1">Staff profile</p>
            <h2 class="h4 mb-0"><?php echo e($staffRecord['full_name']); ?></h2>
        </div>
        <div class="d-flex gap-2"><a class="btn btn-outline-jlfc" href="<?php echo e(base_url('app/modules/staff/edit.php?id=' . (int) $staffRecord['id'])); ?>">Edit</a><a class="btn btn-outline-danger" href="<?php echo e(base_url('app/modules/staff/delete.php?id=' . (int) $staffRecord['id'])); ?>">Delete</a></div>
    </div>
    <div class="row g-3">
        <div class="col-md-4">
            <div class="feature-tile"><i class="bi bi-buildings"></i>
                <div>
                    <h4>Club</h4>
                    <p><?php echo e($staffRecord['club_name']); ?></p>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="feature-tile"><i class="bi bi-person-badge"></i>
                <div>
                    <h4>Role</h4>
                    <p><?php echo e(ucwords(str_replace('_', ' ', $staffRecord['role']))); ?></p>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="feature-tile"><i class="bi bi-flag"></i>
                <div>
                    <h4>Status</h4>
                    <p><?php echo e(ucfirst($staffRecord['status'])); ?></p>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="feature-tile"><i class="bi bi-telephone"></i>
                <div>
                    <h4>Phone</h4>
                    <p><?php echo e($staffRecord['phone'] ?: 'Not set'); ?></p>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="feature-tile"><i class="bi bi-envelope"></i>
                <div>
                    <h4>Email</h4>
                    <p><?php echo e($staffRecord['email'] ?: 'Not set'); ?></p>
                </div>
            </div>
        </div>
    </div>
</section>
<?php require dirname(__DIR__, 2) . '/includes/footer.php'; ?>