{% extends "base.html" %}

{% block content %}
<div class="content-card">
    <div class="page-header">
        <h1>Branchen</h1>
        <a class="btn" href="{{ url_for('admin_branche_new') }}">Neue Branche erstellen</a>
    </div>

    {% if branchen %}
        <table class="admin-table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Branchenname</th>
                    <th>Aktionen</th>
                </tr>
            </thead>
            <tbody>
                {% for branche in branchen %}
                <tr>
                    <td>{{ branche.id }}</td>
                    <td>{{ branche.branchenname }}</td>
                    <td class="actions">
                        <a class="btn btn-small" href="{{ url_for('admin_branche_edit', branche_id=branche.id) }}">
                            Bearbeiten
                        </a>

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