{% extends "base.html" %}
{% block title %}Nouvel équipement — 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-plus-circle"></i> Nouvel équipement</h1>
        <a href="{{ url_for('equipments.index') }}" class="btn btn-secondary"><i class="bi bi-arrow-left"></i> Retour</a>
    </div>
    <div class="card"><div class="card-body">
        <form method="POST">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <div class="row mb-3">
                <div class="col-md-6"><label class="form-label">Nom *</label><input type="text" name="name" class="form-control" required></div>
                <div class="col-md-6"><label class="form-label">Catégorie</label>
                    <select name="category_id" class="form-select">
                        <option value="">-- Sélectionner --</option>
                        {% for cat in categories %}<option value="{{ cat.id }}">{{ cat.name }}</option>{% endfor %}
                    </select>
                </div>
            </div>
            <div class="row mb-3">
                <div class="col-md-6"><label class="form-label">Salle</label>
                    <select name="room_id" class="form-select">
                        <option value="">-- Sélectionner --</option>
                        {% for room in rooms %}<option value="{{ room.id }}">{{ room.name }}</option>{% endfor %}
                    </select>
                </div>
                <div class="col-md-6"><label class="form-label">Statut</label>
                    <select name="status" class="form-select">
                        {% for key, val in statuses.items() %}<option value="{{ key }}">{{ val }}</option>{% endfor %}
                    </select>
                </div>
            </div>
            <div class="row mb-3">
                <div class="col-md-4"><label class="form-label">Numéro de série</label><input type="text" name="serial_number" class="form-control"></div>
                <div class="col-md-4"><label class="form-label">Marque</label><input type="text" name="brand" class="form-control"></div>
                <div class="col-md-4"><label class="form-label">Modèle</label><input type="text" name="model" class="form-control"></div>
            </div>
            <div class="mb-3"><label class="form-label">Notes</label><textarea name="notes" class="form-control" rows="3"></textarea></div>
            <div class="text-end"><button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Créer</button></div>
        </form>
    </div></div>
</div>
{% endblock %}