{% extends "base.html" %}

{% block content %}
<div class="content-card">
    <div class="page-header">
        <h1>Ansprechpartner</h1>
        <a class="btn" href="{{ url_for('admin_contact_new') }}">Neuen Ansprechpartner erstellen</a>
    </div>

    {% if contacts %}
        <table class="admin-table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>E-Mail</th>
                    <th>Info</th>
                    <th>Aktionen</th>
                </tr>
            </thead>
            <tbody>
                {% for contact in contacts %}
                <tr>
                    <td>{{ contact.id }}</td>
                    <td>{{ contact.name }}</td>
                    <td>{{ contact.email }}</td>
                    <td>{{ contact.infotext or "" }}</td>
                    <td class="actions">
                        <a class="btn btn-small" href="{{ url_for('admin_contact_edit', ansprechpartner_id=contact.id) }}">Bearbeiten</a>

                        <form method="post"
                              action="{{ url_for('admin_contact_delete', ansprechpartner_id=contact.id) }}"
                              style="display:inline;"
                              onsubmit="return confirm('Ansprechpartner wirklich löschen?');">
                            <button type="submit" class="btn btn-small btn-danger">Löschen</button>
                        </form>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>Keine Ansprechpartner vorhanden.</p>
    {% endif %}
</div>
{% endblock %}