{% extends "base.html" %}
{% block title %}Création groupée — GMAO{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1><i class="bi bi-layers"></i> Création d'interventions groupées</h1>
        <a href="{{ url_for('interventions.index') }}" class="btn btn-secondary">
            <i class="bi bi-arrow-left"></i> Retour
        </a>
    </div>

    <div class="card">
        <div class="card-body">
            <p class="text-muted">Sélectionnez les équipements pour lesquels créer des interventions.</p>
            
            <form method="POST" action="{{ url_for('interventions.create_for_group') }}">
                <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th><input type="checkbox" id="select-all"></th>
                                <th>Équipement</th>
                                <th>Salle</th>
                                <th>Bâtiment</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for equipment in equipments %}
                            <tr>
                                <td><input type="checkbox" name="equipment_ids" value="{{ equipment.id }}"></td>
                                <td>{{ equipment.name }}</td>
                                <td>{{ equipment.room.name if equipment.room else '-' }}</td>
                                <td>{{ equipment.room.building.name if equipment.room and equipment.room.building else '-' }}</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>

                <div class="text-end">
                    <button type="submit" class="btn btn-primary">
                        <i class="bi bi-check-lg"></i> Créer les interventions
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}