<?php \App\Core\View::render('reports/_toolbar', ['show' => ['date' => true, 'agent' => true], 'filters' => $filters, 'query' => $query], null); ?>
<div class="card">
  <div class="table-wrap">
    <table class="table">
      <thead><tr><th>Agent</th><th>Handled</th><th>Resolved</th><th>Reassignments</th><th>Avg. handling time</th><th>Avg. CSAT</th></tr></thead>
      <tbody>
      <?php foreach ($rows as $r) : ?>
        <tr>
          <td><?= e($r['agent_name']) ?></td>
          <td><?= (int)$r['handled'] ?></td>
          <td><?= (int)$r['resolved'] ?></td>
          <td><?= (int)$r['reassignments'] ?></td>
          <td class="text-sm"><?= $r['avg_handle_minutes'] ? fmt_minutes((int)$r['avg_handle_minutes']) : '—' ?></td>
          <td><?= $r['avg_csat'] ?? '—' ?></td>
        </tr>
      <?php endforeach; ?>
      </tbody>
    </table>
  </div>
</div>
