{% extends "base.html" %}
{% block title %}Saisir un relevé — 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-success text-white">
                    <h5 class="mb-0"><i class="bi bi-pencil-square"></i> Relevé : {{ meter.name }}</h5>
                </div>
                <div class="card-body">
                    <p class="text-muted small">Équipement : {{ meter.equipment.name }}</p>
                    <form method="POST">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                        <div class="mb-3">
                            <label class="form-label">Nouvelle valeur ({{ meter.unit }})</label>
                            <input type="number" step="0.01" name="value" class="form-control" required autofocus>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Commentaire (optionnel)</label>
                            <textarea name="comment" class="form-control" rows="2"></textarea>
                        </div>
                        <div class="d-flex gap-2">
                            <button type="submit" class="btn btn-success">Enregistrer le relevé</button>
                            <a href="{{ url_for('equipments.detail', id=meter.equipment_id) }}" class="btn btn-outline-secondary">Annuler</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
