{% extends 'base.html' %}
{% block title %}Other Income{% endblock %}

{% block content %}
<div class="flex justify-between items-center mb-6">
  <h1 class="text-2xl font-bold">Other Income</h1>
  <a href="{% url 'finance:income_create' %}" class="btn btn-primary btn-sm">➕ Add Income</a>
</div>

<div class="card bg-base-100 shadow">
  <div class="card-body p-0">
    <table class="table table-zebra">
      <thead>
        <tr>
          <th>Description</th>
          <th>Account</th>
          <th>Amount</th>
          <th>Reference</th>
          <th>Date</th>
          <th>By</th>
        </tr>
      </thead>
      <tbody>
        {% for income in incomes %}
        <tr>
          <td>{{ income.description }}</td>
          <td>{{ income.account.name }}</td>
          <td class="text-success font-medium">{{ business.currency }} {{ income.amount|floatformat:0 }}</td>
          <td class="font-mono text-xs text-base-content/50">{{ income.reference|default:"—" }}</td>
          <td>{{ income.date|date:"d M Y" }}</td>
          <td>{{ income.created_by.username|default:"—" }}</td>
        </tr>
        {% empty %}
        <tr>
          <td colspan="6" class="text-center text-base-content/40 py-10">
            No income recorded yet.
            <a href="{% url 'finance:income_create' %}" class="link link-primary">Add first entry</a>
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}