{% extends "base.html" %}
{% block title %}{{ party.name }} – Partei{% endblock %}
{% block content %}
<h2 class="mb-1">{{ party.name }}</h2>
{% if party.abbreviation %}<p class="text-muted">Kurz: {{ party.abbreviation }}</p>{% endif %}

<h3 class="mt-4">Gemeinden</h3>
<ul class="list-group mb-3">
	{% for g in public_bodies %}
		<li class="list-group-item">
			<a href="{% url 'public_body_detail' slug=g.slug %}">{{ g.name }}</a>
		</li>
	{% empty %}
		<li class="list-group-item">Keine Gemeinden.</li>
	{% endfor %}
</ul>

<h3 class="mt-4">Stadträt:innen</h3>
<div class="table-responsive mb-3">
	<table class="table table-striped align-middle">
		<thead>
			<tr>
				<th>Name</th>
				<th>Gemeinde</th>
			</tr>
		</thead>
		<tbody>
			{% for m in members %}
			<tr>
				<td><a href="{% url 'member_detail' pk=m.id %}">{{ m.first_name }} {{ m.last_name }}</a></td>
				<td>{% if m.public_body %}<a href="{% url 'public_body_detail' slug=m.public_body.slug %}">{{ m.public_body.name }}</a>{% else %}–{% endif %}</td>
			</tr>
			{% empty %}
			<tr><td colspan="2">Keine Mitglieder.</td></tr>
			{% endfor %}
		</tbody>
	</table>
</div>

<h3 class="mt-4">Fragen</h3>
<ul class="list-group">
	{% for q in questions %}
		<li class="list-group-item">
			<strong>{{ q.title }}</strong>
			<div class="text-muted">an <a href="{% url 'member_detail' pk=q.member.id %}">{{ q.member }}</a> • {{ q.created_at|date:'d.m.Y H:i' }}</div>
		</li>
	{% empty %}
		<li class="list-group-item">Keine Fragen.</li>
	{% endfor %}
</ul>
{% endblock %} 