{% extends "base.html" %}
{% block title %}Sales Returns{% endblock %}
{% block content %}
<div class="space-y-4">
  <div class="flex justify-between items-center">
    <h1 class="text-2xl font-bold">Sales Returns</h1>
    <a href="{% url 'sales:sales_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>Sale</th><th>Date</th><th>Status</th><th>Total</th><th></th></tr></thead>
        <tbody>
          {% for sr in returns %}
          <tr>
            <td>{{ sr.reference }}</td>
            <td>{{ sr.sale.reference }}</td>
            <td>{{ sr.date }}</td>
            <td>{{ sr.get_status_display }}</td>
            <td>{{ sr.total }}</td>
            <td><a href="{% url 'sales:sales_return_detail' sr.pk %}" class="btn btn-ghost btn-xs">View</a></td>
          </tr>
          {% empty %}
          <tr><td colspan="6" class="text-center opacity-70">No sales returns.</td></tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
  {% include "partials/pagination.html" with page_obj=returns %}
</div>
{% endblock %}
