<div class="container py-5">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item active" aria-current="page">Lista de Status</li>
        </ol>
    </nav>

    <?php Sessao::mensagem('status'); ?>

    <a href="<?= URL ?>/status/cadastrar" class="btn btn-primary mb-3">Cadastrar Novo Status</a>

    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Descrição</th>
                    <th>Imagem</th>
                    <th>Opções</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($dados['status'] as $status): ?>
                    <tr>
                        <td><?= $status->id_status ?></td>
                        <td><?= htmlspecialchars($status->descricao) ?></td>
                        <td>
                            <?php if (!empty($status->img)): ?>
                                <img src="<?= htmlspecialchars($status->img) ?>" alt="Ícone" style="height:30px;">
                            <?php endif; ?>
                        </td>
                        <td>
                            <a href="<?= URL ?>/status/visualizar/<?= $status->id_status ?>" class="btn btn-info btn-sm">Ver</a>
                            <a href="<?= URL ?>/status/editar/<?= $status->id_status ?>" class="btn btn-warning btn-sm">Editar</a>
                            <a href="<?= URL ?>/status/excluir/<?= $status->id_status ?>" class="btn btn-danger btn-sm" onclick="return confirm('Tem certeza?')">Excluir</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
                <?php if (empty($dados['status'])): ?>
                    <tr>
                        <td colspan="4" class="text-center">Nenhum status cadastrado.</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
