{% extends "base.html" %}
{% block title %}Ajouter un compteur — GMAO{% endblock %}

{% block content %}
<div class="container py-4">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card shadow-sm">
                <div class="card-header bg-primary text-white">
                    <h5 class="mb-0"><i class="bi bi-speedometer2"></i> Ajouter un compteur pour {{ equipment.name }}</h5>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                        <div class="mb-3">
                            <label class="form-label">Nom du compteur</label>
                            <input type="text" name="name" class="form-control" placeholder="ex: Compteur Eau, Odomètre, Index Électrique" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Unité de mesure</label>
                            <input type="text" name="unit" class="form-control" placeholder="ex: m3, kWh, km" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Valeur initiale</label>
                            <input type="number" step="0.01" name="initial_value" class="form-control" value="0">
                        </div>
                        <div class="d-flex gap-2">
                            <button type="submit" class="btn btn-primary">Enregistrer</button>
                            <a href="{{ url_for('equipments.detail', id=equipment.id) }}" class="btn btn-outline-secondary">Annuler</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
