<?php \App\Core\View::render('reports/_toolbar', ['show' => ['date' => true, 'customer' => true, 'priority' => true], 'filters' => $filters, 'query' => $query], null); ?>
<div class="card">
  <div class="table-wrap">
    <table class="table">
      <thead><tr><th>Customer</th><th>Priority</th><th>Tickets</th><th>First response met</th><th>Resolution met</th></tr></thead>
      <tbody>
      <?php foreach ($rows as $r) :
        $respPct = $r['total'] ? round(($r['resp_met'] / $r['total']) * 100) : 0;
        $resPct = $r['res_total'] ? round(($r['res_met'] / $r['res_total']) * 100) : null;
      ?>
        <tr>
          <td><?= e($r['customer_name']) ?></td>
          <td><span class="badge badge-outline"><?= e($r['priority']) ?></span></td>
          <td><?= $r['total'] ?></td>
          <td><?= $respPct ?>%</td>
          <td><?= $resPct !== null ? $resPct . '%' : '—' ?></td>
        </tr>
      <?php endforeach; ?>
      <?php if (empty($rows)) : ?><tr><td colspan="5" class="text-faint">No data yet.</td></tr><?php endif; ?>
      </tbody>
    </table>
  </div>
</div>
