<?php require __DIR__ . '/../layouts/header.php'; ?>

<div class="card border-0 shadow-sm rounded-4 mx-auto" style="max-width:900px;">
    <div class="card-body p-4">
        <h1 class="fw-bold mb-3"><?= e(trans('upgrade_wizard')) ?></h1>

        <div class="row g-3 mb-4">
            <div class="col-md-6">
                <div class="border rounded-4 p-3">
                    <div class="small text-muted">Current Version</div>
                    <div class="h4 fw-bold mb-0"><?= e((string) $currentVersion) ?></div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="border rounded-4 p-3">
                    <div class="small text-muted">Target Version</div>
                    <div class="h4 fw-bold mb-0"><?= e((string) $targetVersion) ?></div>
                </div>
            </div>
        </div>

        <div class="table-responsive mb-4">
            <table class="table align-middle mb-0">
                <thead class="table-light">
                    <tr>
                        <th><?= e(trans('setting_key')) ?></th>
                        <th><?= e(trans('status')) ?></th>
                        <th><?= e(trans('setting_value')) ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($checks as $row): ?>
                        <tr>
                            <td><?= e((string) $row['label']) ?></td>
                            <td>
                                <?php if (!empty($row['ok'])): ?>
                                    <span class="badge bg-success"><?= e(trans('health_ok')) ?></span>
                                <?php else: ?>
                                    <span class="badge bg-danger"><?= e(trans('health_fail')) ?></span>
                                <?php endif; ?>
                            </td>
                            <td><?= e((string) $row['value']) ?></td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>

        <form method="post" action="<?= e(base_path('upgrade')) ?>">
            <input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
            <button type="submit" class="btn btn-success rounded-3"><?= e(trans('run_upgrade')) ?></button>
        </form>
    </div>
</div>

<?php require __DIR__ . '/../layouts/footer.php'; ?>
