<?php
// PATCH V1.8.4 - Exemplo de estrutura segura para filtro GET dos relatórios.
?>
<h2>Relatórios</h2>

<form method="GET" action="<?= base_url('index.php') ?>" class="card">
    <input type="hidden" name="route" value="/admin/relatorios">

    <div class="grid-2">
        <div>
            <label>Protocolo</label>
            <input type="text" name="protocolo" value="<?= e($_GET['protocolo'] ?? '') ?>">
        </div>

        <div>
            <label>Status</label>
            <input type="text" name="status" value="<?= e($_GET['status'] ?? '') ?>">
        </div>

        <div>
            <label>Categoria</label>
            <input type="text" name="categoria_id" value="<?= e($_GET['categoria_id'] ?? '') ?>">
        </div>

        <div>
            <label>Setor</label>
            <input type="text" name="setor_id" value="<?= e($_GET['setor_id'] ?? '') ?>">
        </div>

        <div>
            <label>Data inicial</label>
            <input type="date" name="data_inicio" value="<?= e($_GET['data_inicio'] ?? '') ?>">
        </div>

        <div>
            <label>Data final</label>
            <input type="date" name="data_fim" value="<?= e($_GET['data_fim'] ?? '') ?>">
        </div>
    </div>

    <div style="margin-top:12px; display:flex; gap:8px; flex-wrap:wrap;">
        <button type="submit" class="btn">Aplicar filtros</button>
        <a href="<?= base_url('index.php?route=/admin/relatorios') ?>" class="btn btn-outline">Limpar</a>
    </div>
</form>
