<div class="container py-5">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item active" aria-current="page">Vínculos de Funcionários x Ordens</li>
        </ol>
    </nav>

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

    <a href="<?= URL ?>/ordens_funcionarios/cadastrar" class="btn btn-primary mb-3">Novo Vínculo</a>

    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th>#</th>
                    <th>Ordem</th>
                    <th>Funcionário</th>
                    <th>Tipo Ordem</th>
                    <th>Data</th>
                    <th>Opções</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($dados['ordens_funcionarios'] as $of): ?>
                    <tr>
                        <td><?= $of->id_ordens_funcionarios ?></td>
                        <td><?= htmlspecialchars($of->numero_ordem) ?></td>
                        <td><?= htmlspecialchars($of->nome_funcionario) ?> (<?= htmlspecialchars($of->matricula_funcionario) ?>)</td>
                        <td><?= htmlspecialchars($of->tipo_ordem) ?></td>
                        <td><?= date('d/m/Y H:i', strtotime($of->criado_em)) ?></td>
                        <td>
                            <a href="<?= URL ?>/ordens_funcionarios/visualizar/<?= $of->id_ordens_funcionarios ?>" class="btn btn-info btn-sm">Ver</a>
                            <a href="<?= URL ?>/ordens_funcionarios/editar/<?= $of->id_ordens_funcionarios ?>" class="btn btn-warning btn-sm">Editar</a>
                            <a href="<?= URL ?>/ordens_funcionarios/excluir/<?= $of->id_ordens_funcionarios ?>" class="btn btn-danger btn-sm" onclick="return confirm('Tem certeza?')">Excluir</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
                <?php if (empty($dados['ordens_funcionarios'])): ?>
                    <tr>
                        <td colspan="6" class="text-center">Nenhum vínculo cadastrado.</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
