<div class="container py-5">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item active" aria-current="page">Relatório de Diárias por Funcionário</li>
        </ol>
    </nav>

    <form method="GET" class="row g-3 align-items-end mb-4">
        <div class="col-md-6">
            <label for="nome" class="form-label">Nome do Funcionário</label>
            <input type="text" name="nome" id="nome" class="form-control" placeholder="Digite o nome" value="<?= htmlspecialchars($filtros['nome'] ?? '') ?>">
        </div>
        <div class="col-md-3">
            <button type="submit" class="btn btn-primary w-100"><i class="bi bi-funnel"></i> Filtrar</button>
        </div>
        <div class="col-md-3 text-end">
            <a href="index.php?url=Relatorios/pdf_diariasPorFuncionario" target="_blank" class="btn btn-danger w-100">
                <i class="fa fa-file-pdf"></i> Exportar PDF Geral
            </a>
        </div>
    </form>

    <?php if (!empty($diarias) && count($diarias) > 0): ?>
        <div class="table-responsive">
            <table class="table table-bordered table-hover align-middle display" id="tabelaDiarias">
                <thead class="table-dark">
                    <tr>
                        <th>#</th>
                        <th>Funcionário</th>
                        <th>Total de Diárias</th>
                        <th>Valor Total (R$)</th>
                       
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($diarias as $i => $linha): ?>
                        <tr>
                            <td><?= $i + 1 ?></td>
                            <td><?= htmlspecialchars($linha['nome']) ?></td>
                            <td><?= $linha['total_diarias'] ?></td>
                            <td><?= number_format($linha['valor_total'], 2, ',', '.') ?></td>
                            
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    <?php else: ?>
        <div class="alert alert-info mt-4">
            <i class="bi bi-info-circle"></i> Nenhum registro encontrado com os filtros informados.
        </div>
    <?php endif; ?>
</div>

<!-- DataTables (opcional, se quiser paginação e busca) -->
<script>
    $(document).ready(function () {
        $('#tabelaDiarias').DataTable({
            language: {
                url: 'https://cdn.datatables.net/plug-ins/1.13.6/i18n/pt-BR.json'
            }
        });
    });
</script>
