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

{% block content %}
<div class="container-fluid">
    <div class="row mb-4">
        <div class="col-12 d-flex justify-content-between align-items-center">
            <h1 class="h3 mb-0"><i class="bi bi-box-se me-2"></i>{{ title }}</h1>
            <a href="{{ url_for('equipments_meters.create_lot') }}" class="btn btn-primary">
                <i class="bi bi-plus-lg"></i> Nouveau lot
            </a>
        </div>
    </div>
    
    <div class="card">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>Nom</th>
                            <th>Catégorie</th>
                            <th>Tâches</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for lot in lots %}
                        <tr>
                            <td>{{ lot.name }}</td>
                            <td>
                                {% if lot.category %}
                                <span class="badge bg-secondary">{{ lot.category.name }}</span>
                                {% else %}
                                <span class="text-muted">Non assignée</span>
                                {% endif %}
                            </td>
                            <td>{{ lot.tasks|length }}</td>
                            <td>
                                <a href="{{ url_for('equipments_meters.lot_detail', id=lot.id) }}" class="btn btn-sm btn-outline-primary">
                                    <i class="bi bi-pencil"></i> Modifier
                                </a>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}