{% extends "base.html" %}
{% block title %}Purchase Returns{% endblock %}
{% block content %}
<div class="space-y-4">
  <div class="flex justify-between items-center">
    <h1 class="text-2xl font-bold">Purchase Returns</h1>
    <a href="{% url 'inventory:purchase_return_create' %}" class="btn btn-primary btn-sm">New Return</a>
  </div>
  <div class="card bg-base-100 border border-base-200">
    <div class="overflow-x-auto">
      <table class="table table-zebra">
        <thead><tr><th>Reference</th><th>PO</th><th>Date</th><th>Status</th><th>Total</th><th></th></tr></thead>
        <tbody>
          {% for pr in returns %}
          <tr>
            <td>{{ pr.reference }}</td>
            <td>{{ pr.purchase_order.reference }}</td>
            <td>{{ pr.date }}</td>
            <td>{{ pr.get_status_display }}</td>
            <td>{{ pr.total }}</td>
            <td><a href="{% url 'inventory:purchase_return_detail' pr.pk %}" class="btn btn-ghost btn-xs">View</a></td>
          </tr>
          {% empty %}
          <tr><td colspan="6" class="text-center opacity-70">No purchase returns.</td></tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
  {% include "partials/pagination.html" with page_obj=returns %}
</div>
{% endblock %}
