{% extends "base.html" %}
{% block content %}
<h2>Dashboard</h2>
<a href="{{ url_for('company_create') }}" class="btn btn-primary">Neue Firma</a>
{% if companies %}
<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Telefon</th>
            <th>Email</th>
            <th>Aktionen</th>
        </tr>
    </thead>
    <tbody>
    {% for c in companies %}
        <tr>
            <td><a href="{{ url_for('contact_list', company_id=c.id) }}">{{ c.name }}</a></td>
            <td>{{ c.phone or '-' }}</td>
            <td>{{ c.email or '-' }}</td>
            <td>
                <a href="{{ url_for('company_edit', id=c.id) }}" class="btn btn-sm btn-secondary">Edit</a>
                <form method="post" action="{{ url_for('company_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>Noch keine Firmen erfasst.</p>
{% endif %}
{% endblock %}
