{% extends "ui/templates/base/layout.html" %}
{% block content %}
<div class="space-y-6">
  <div class="flex items-center justify-between">
    <div>
      <h2 class="text-xl font-semibold text-slate-900">Firm Service Task Templates</h2>
      <p class="text-sm text-slate-500">Each firm can maintain its own execution template for enabled services.</p>
    </div>
    <a href="/services" class="rounded-xl border border-slate-300 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Back to Services</a>
  </div>
  <div class="overflow-hidden rounded-2xl bg-white shadow-soft">
    <table class="min-w-full divide-y divide-slate-200">
      <thead class="bg-slate-50"><tr>
        <th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">Code</th>
        <th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">Service</th>
        <th class="px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">Task Count</th>
        <th class="px-4 py-3"></th></tr></thead>
      <tbody class="divide-y divide-slate-100">
        {% for row in rows %}
        <tr>
          <td class="px-4 py-3 text-sm font-medium text-slate-900">{{ row.catalogue.service_code }}</td>
          <td class="px-4 py-3 text-sm text-slate-700">{{ row.catalogue.service_name }}</td>
          <td class="px-4 py-3 text-sm text-slate-700">{{ row.task_count }}</td>
          <td class="px-4 py-3 text-right"><a href="/services/templates/{{ row.catalogue.id }}" class="text-sm font-medium text-brand-700 hover:underline">Open</a></td>
        </tr>
        {% else %}<tr><td colspan="4" class="px-4 py-8 text-center text-sm text-slate-500">Enable a service for the firm first.</td></tr>{% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}
