{% extends "base.html" %}
{% block title %}Branches{% endblock %}
{% block content %}
<div class="space-y-4">
  <div class="flex justify-between items-center">
    <h1 class="text-2xl font-bold">Branches</h1>
    <div class="flex gap-2">
      <a href="{% url 'inventory:location_list' %}" class="btn btn-outline btn-sm">Locations</a>
      <a href="{% url 'inventory:branch_create' %}" class="btn btn-primary btn-sm">New Branch</a>
    </div>
  </div>
  <div class="card bg-base-100 border border-base-200">
    <div class="overflow-x-auto">
      <table class="table table-zebra">
        <thead><tr><th>Name</th><th>Code</th><th>Location</th><th>Phone</th><th>Status</th><th></th></tr></thead>
        <tbody>
          {% for branch in branches %}
          <tr>
            <td>{{ branch.name }}</td>
            <td>{{ branch.code|default:"-" }}</td>
            <td>{{ branch.location|default:"-" }}</td>
            <td>{{ branch.contact_phone|default:"-" }}</td>
            <td>{% if branch.is_active %}Active{% else %}Inactive{% endif %}</td>
            <td>
              <a href="{% url 'inventory:branch_edit' branch.pk %}" class="btn btn-ghost btn-xs">Edit</a>
            </td>
          </tr>
          {% empty %}
          <tr><td colspan="6" class="text-center opacity-70">No branches.</td></tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
</div>
{% endblock %}
