<form class="filters">
  <input type="date" name="date_from" value="<%= filters.date_from || '' %>">
  <input type="date" name="date_to" value="<%= filters.date_to || '' %>">
  <input name="utm_source" placeholder="source" value="<%= filters.utm_source || '' %>">
  <input name="utm_campaign" placeholder="campaign" value="<%= filters.utm_campaign || '' %>">
  <input name="device_type" placeholder="device" value="<%= filters.device_type || '' %>">
  <button>Filtrer</button>
  <button name="export" value="csv">Export CSV</button>
</form>
<section class="admin-grid">
  <%- include('_stat-list', { title: 'Clics par jour', rows: stats.byDay }) %>
  <%- include('_stat-list', { title: 'Clics par bookmaker', rows: stats.byBookmaker }) %>
  <%- include('_stat-list', { title: 'Clics par prono', rows: stats.byPrediction }) %>
  <%- include('_stat-list', { title: 'Clics par source', rows: stats.bySource }) %>
  <%- include('_stat-list', { title: 'Clics par campagne', rows: stats.byCampaign }) %>
  <%- include('_stat-list', { title: 'Clics par utilisateur', rows: stats.byUser }) %>
</section>
<table class="data"><thead><tr><th>Date</th><th>Utilisateur</th><th>Email</th><th>Prono</th><th>Bookmaker</th><th>Source</th><th>Campaign</th><th>Device</th><th>Plateforme</th><th>UA</th></tr></thead><tbody>
<% rows.forEach(c => { %>
  <tr><td><%= formatDateTime(c.clicked_at) %></td><td><%= c.user_name || '-' %></td><td><%= c.email || '-' %></td><td><%= c.home_team || '' %> - <%= c.away_team || '' %></td><td><%= c.affiliate_name || '-' %></td><td><%= c.utm_source || '-' %></td><td><%= c.utm_campaign || '-' %></td><td><%= c.device_type %></td><td><%= c.platform_detected %></td><td><%= (c.user_agent || '').slice(0, 80) %></td></tr>
<% }) %>
</tbody></table>
