{% extends "parc/base.html" %}

{% block title %}Équipements actifs{% endblock %}

{% block content %}
    <h1>Équipements actifs</h1>
    <a class="btn" href="{% url 'equipment_create' %}">Ajouter</a>

    {% if equipments %}
        <table>
            <thead>
                <tr>
                    <th>Hôte</th>
                    <th>Adresse IP</th>
                    <th>État</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                {% for equipment in equipments %}
                    <tr>
                        <td>{{ equipment.hostname }}</td>
                        <td>{{ equipment.ip }}</td>
                        <td>
                            {% if equipment.is_active %}
                                <span class="status-active">Actif</span>
                            {% else %}
                                <span class="status-inactive">Inactif</span>
                            {% endif %}
                        </td>
                        <td>
                            <a class="btn" href="{% url 'equipment_detail' equipment.pk %}">Voir</a>
                            <a class="btn btn-secondary" href="{% url 'equipment_update' equipment.pk %}">Modifier</a>
                            <a class="btn btn-danger" href="{% url 'equipment_delete' equipment.pk %}">Supprimer</a>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>Aucun équipement actif enregistré.</p>
    {% endif %}
{% endblock %}
