{% extends "ui/templates/base/layout.html" %}{% block content %}<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Registrations & Renewals</h1><p class="text-sm text-slate-500">Expiry, periodic updates, generated renewal work and escalation.</p></div>{% if can_manage %}<div class="flex gap-2"><a href="/registrations/masters" class="rounded border px-3 py-2">Lifecycle Masters</a><form method="post" action="/registrations/run-engine"><input type="hidden" name="csrf_token" value="{{ csrf_token }}"><button class="rounded bg-brand-600 px-3 py-2 text-white">Run Lifecycle Engine</button></form></div>{% endif %}</div><div class="grid gap-4 md:grid-cols-4">{% for label,value in [('Active',counts.active),('Due / Update Due',counts.due),('Expired',counts.expired),('Open Renewal Tasks',counts.tasks)] %}<div class="rounded-xl border bg-white p-4"><div class="text-sm text-slate-500">{{ label }}</div><div class="text-3xl font-semibold">{{ value }}</div></div>{% endfor %}</div><div class="rounded-xl border bg-white"><div class="border-b p-4 font-semibold">Open renewal and update work</div><div class="overflow-x-auto"><table class="min-w-full text-sm"><thead><tr class="bg-slate-50"><th class="p-3 text-left">Due</th><th class="p-3 text-left">Client</th><th class="p-3 text-left">Work</th><th class="p-3 text-left">Status</th></tr></thead><tbody>{% for task,client in tasks %}<tr class="border-t"><td class="p-3">{{ task.cycle_due_date }}</td><td class="p-3">{{ client.client_name }}</td><td class="p-3"><a class="text-brand-600" href="/registrations/tasks/{{ task.id }}">{{ task.title }}</a></td><td class="p-3">{{ task.status|replace('_',' ')|title }}</td></tr>{% else %}<tr><td colspan="4" class="p-6 text-center text-slate-500">No open lifecycle work.</td></tr>{% endfor %}</tbody></table></div></div><div class="rounded-xl border bg-white"><div class="border-b p-4 font-semibold">Client registrations</div><div class="overflow-x-auto"><table class="min-w-full text-sm"><thead><tr class="bg-slate-50"><th class="p-3 text-left">Client</th><th class="p-3 text-left">Type</th><th class="p-3 text-left">Number</th><th class="p-3 text-left">Expiry / Next action</th><th class="p-3 text-left">Status</th></tr></thead><tbody>{% for reg,client,rt in registrations %}<tr class="border-t"><td class="p-3"><a class="text-brand-600" href="/registrations/clients/{{ client.id }}">{{ client.client_name }}</a></td><td class="p-3">{{ rt.name }}</td><td class="p-3">{{ reg.registration_number }}</td><td class="p-3">{{ reg.valid_until or reg.next_action_date or '—' }}</td><td class="p-3">{{ reg.status|replace('_',' ')|title }}</td></tr>{% else %}<tr><td colspan="5" class="p-6 text-center text-slate-500">No registration records.</td></tr>{% endfor %}</tbody></table></div></div></div>{% endblock %}
