{% extends "base.html" %}
{% block title %}Bâtiments — GMAO Collège{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h1><i class="bi bi-buildings"></i> Bâtiments</h1>
    <a href="{{ url_for('equipments.create_building') }}" class="btn btn-primary"><i class="bi bi-plus-lg"></i> Nouveau bâtiment</a>
</div>

<div class="row">
{% for building in buildings %}
<div class="col-md-6 col-lg-4 mb-3">
    <div class="card">
        <div class="card-body">
            <h5 class="card-title">{{ building.name }}</h5>
            <p class="card-text text-muted">{{ building.description or '' }}</p>
            <p><span class="badge bg-secondary">{{ building.rooms.count() }} salle(s)</span></p>
            <div class="btn-group">
                <a href="{{ url_for('equipments.edit_building', id=building.id) }}" class="btn btn-sm btn-outline-primary">Modifier</a>
                <a href="{{ url_for('equipments.rooms') }}" class="btn btn-sm btn-outline-secondary">Salles</a>
            </div>
        </div>
    </div>
</div>
{% endfor %}
</div>
{% endblock %}