<%- include('../partials/header') %>
<div class="page-head">
  <h1>Tarifs — <%= s.name %></h1>
  <a class="btn btn-ghost" href="<%= base %>/suppliers/<%= s.id %>">← Fournisseur</a>
</div>
<form class="toolbar" method="get">
  <input name="q" value="<%= q %>" placeholder="Référence, EAN, désignation…">
  <label class="check"><input type="checkbox" name="unmatched" value="1" <%= unmatched ? 'checked' : '' %>> Seulement ceux absents de PrestaShop</label>
  <button class="btn">Filtrer</button>
  <span class="muted"><%= total %> article(s)</span>
</form>
<div class="card">
<table class="table">
  <thead><tr><th>Référence</th><th>EAN</th><th>Désignation</th><th class="num">Prix d’achat HT</th><th class="num">Marge</th><th class="num">Vente HT</th><th class="num">Vente TTC</th><th>Mis à jour</th></tr></thead>
  <tbody>
  <% items.forEach(i => { %>
    <tr><td><%= i.reference %></td><td><%= i.ean %></td><td><%= i.name %></td><td class="num"><%= i.purchase_price.toFixed(2) %> €</td><td class="num small"><%= i.margin_label %></td><td class="num"><%= i.sale_ht == null ? '—' : i.sale_ht.toFixed(2) + ' €' %></td><td class="num"><%= i.sale_ttc == null ? '—' : i.sale_ttc.toFixed(2) + ' €' %></td><td class="small"><%= i.updated_at %></td></tr>
  <% }) %>
  <% if (!items.length) { %><tr><td colspan="8" class="muted">Aucun article.</td></tr><% } %>
  </tbody>
</table>
<%- include('../partials/pager', { query: { q, unmatched: unmatched ? 1 : '' } }) %>
</div>
<%- include('../partials/footer') %>
