{% extends "base.html" %}
{% block title %}Salles Pronote — GMAO{% endblock %}

{% block content %}
<div class="container-fluid">
    <h1 class="h3 mb-4"><i class="bi bi-door-open"></i> Salles importées depuis Pronote</h1>
    
    {% if rooms %}
    <div class="row">
        {% for room in rooms %}
        <div class="col-md-4 col-lg-3 mb-3">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">{{ room.name }}</h5>
                    <p class="card-text">
                        <small class="text-muted">Code : {{ room.code }}</small><br>
                        {% if room.room_type %}
                        <span class="badge" style="background-color: {{ room.room_type.color|hex_color }}; color: {{ room.room_type.color|text_color }};">
                            {{ room.room_type.name }}
                        </span>
                        {% endif %}
                    </p>
                    <a href="{{ url_for('pronote.room_planning', room_id=room.id) }}" class="btn btn-sm btn-outline-primary">
                        <i class="bi bi-calendar-week"></i> Voir le planning
                    </a>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
    {% else %}
    <div class="alert alert-info">
        <i class="bi bi-info-circle"></i> Aucune salle importée depuis Pronote.
        <form method="post" action="{{ url_for('pronote.sync_salles') }}" class="d-inline">
          <button type="submit" class="btn btn-link alert-link p-0 align-baseline">Synchroniser les salles</button>
        </form>
    </div>
    {% endif %}
    
    <div class="mt-3">
        <a href="{{ url_for('pronote.index') }}" class="btn btn-secondary">
            <i class="bi bi-arrow-left"></i> Retour à Pronote
        </a>
    </div>
</div>
{% endblock %}
