{# HTMX swap target: forward history table after a successful forward #}
{% if forwards %}
<table class="table">
  <thead>
    <tr><th>Supplier</th><th>Credits</th><th>Status</th><th>Response</th><th>Sent</th></tr>
  </thead>
  <tbody>
    {% for f in forwards %}
    <tr>
      <td><a href="{{ url_for('admin.supplier_detail', supplier_id=f.supplier_id) }}">{{ f.supplier_name }}</a></td>
      <td>{{ f.credit_cost }}</td>
      <td>
        {% set fwd_status = f.status or 'sent' %}
        {% if fwd_status == 'won' %}
          <span class="badge-success">Won</span>
        {% elif fwd_status == 'lost' %}
          <span class="badge">Lost</span>
        {% elif fwd_status in ('contacted', 'quoted') %}
          <span class="badge-warning">{{ fwd_status | capitalize }}</span>
        {% else %}
          <span class="badge">{{ fwd_status | capitalize }}</span>
        {% endif %}
      </td>
      <td>
        {% if f.supplier_note %}
        <span class="text-xs text-slate" title="{{ f.supplier_note }}">{{ f.supplier_note | truncate(40) }}</span>
        {% elif f.status_updated_at %}
        <span class="text-xs text-slate mono">{{ (f.status_updated_at or '')[:10] }}</span>
        {% else %}
        <span class="text-xs text-slate">—</span>
        {% endif %}
      </td>
      <td class="mono text-sm">{{ (f.created_at or '')[:16] }}</td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% else %}
<p class="text-slate text-sm">No forwards yet.</p>
{% endif %}
