{% extends "base.html" %}
{% block content %}
<h2>{{ company.name }} – Kontaktpersonen</h2>
<a href="{{ url_for('contact_create', company_id=company.id) }}" class="btn btn-primary">Neuer Kontakt</a>
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Zurück</a>
{% if contacts %}
<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Position</th>
            <th>Email</th>
            <th>Telefon</th>
            <th>Aktionen</th>
        </tr>
    </thead>
    <tbody>
    {% for c in contacts %}
        <tr>
            <td>{{ c.first_name }} {{ c.last_name }}</td>
            <td>{{ c.position or '-' }}</td>
            <td>{{ c.email or '-' }}</td>
            <td>{{ c.phone or '-' }}</td>
            <td>
                <a href="{{ url_for('contact_edit', id=c.id) }}" class="btn btn-sm btn-secondary">Edit</a>
                <form method="post" action="{{ url_for('contact_delete', id=c.id) }}" style="display:inline;">
                    <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Wirklich löschen?')">Del</button>
                </form>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>
{% else %}
<p>Keine Kontaktpersonen erfasst.</p>
{% endif %}
{% endblock %}
