<?php
/** @var \BotGuard\Core\View $this @var array $checks @var bool $passed */
$this->layout('install.layout');
?>
<h2 class="h4 mb-1">Server Requirements</h2>
<p class="text-secondary small mb-4">All required checks must pass before you can continue.</p>

<div class="table-responsive">
    <table class="table align-middle">
        <tbody>
            <?php foreach ($checks as $c): ?>
                <tr>
                    <td>
                        <?= e($c['label']) ?>
                        <?php if (! $c['required']): ?><span class="badge text-bg-secondary ms-1">optional</span><?php endif; ?>
                    </td>
                    <td class="text-secondary small"><?= e($c['value']) ?></td>
                    <td class="text-end" style="width:80px">
                        <?php if ($c['passed']): ?>
                            <i class="bi bi-check-circle-fill text-success fs-5"></i>
                        <?php elseif ($c['required']): ?>
                            <i class="bi bi-x-circle-fill text-danger fs-5"></i>
                        <?php else: ?>
                            <i class="bi bi-exclamation-circle-fill text-warning fs-5"></i>
                        <?php endif; ?>
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>

<div class="d-flex justify-content-between mt-4">
    <a href="/install/license" class="btn btn-outline-secondary">Back</a>
    <?php if ($passed): ?>
        <a href="/install/database" class="btn btn-primary">Continue <i class="bi bi-arrow-right"></i></a>
    <?php else: ?>
        <div class="text-end">
            <div class="text-danger small mb-2">Please resolve the failing requirements, then reload.</div>
            <a href="/install/requirements" class="btn btn-outline-primary"><i class="bi bi-arrow-clockwise"></i> Re-check</a>
        </div>
    <?php endif; ?>
</div>
