{% extends 'admin_frontend/base.html' %}
{% block title %}Organization Sites{% endblock %}
{% block content %}
<div class="flex items-center justify-between mb-4">
  <h1 class="text-xl font-semibold">Organization Sites</h1>
  <form method="post">
    {% csrf_token %}
    <button class="btn-outline" type="submit">Map Current Site</button>
  </form>
  <style>.btn-outline{border:1px solid #cbd5e1;padding:.375rem .5rem;border-radius:.375rem}</style>
</div>

<div class="bg-white rounded shadow overflow-hidden">
  <table class="min-w-full text-sm">
    <thead class="bg-gray-50 text-left">
      <tr>
        <th class="px-4 py-2">Site Domain</th>
        <th class="px-4 py-2">Organization</th>
      </tr>
    </thead>
    <tbody>
      {% for m in mappings %}
      <tr class="border-t">
        <td class="px-4 py-2">{{ m.site.domain }}</td>
        <td class="px-4 py-2">{{ m.organization.name }} ({{ m.organization.code }})</td>
      </tr>
      {% empty %}
      <tr>
        <td colspan="2" class="px-4 py-6 text-center text-gray-500">No mappings yet.</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
</div>
{% endblock %}

