{% extends "base.html" %}
{% block title %}Nouvelle pièce — 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> Nouvelle pièce</h1>
        <a href="{{ url_for('parts.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">
                    <div class="col-md-6 mb-3">
                        <label class="form-label">Nom</label>
                        <input type="text" name="name" class="form-control" required>
                    </div>
                    <div class="col-md-6 mb-3">
                        <label class="form-label">Référence</label>
                        <input type="text" name="reference" class="form-control">
                    </div>
                </div>
                
                <div class="row">
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Quantité</label>
                        <input type="number" name="quantity" class="form-control" value="0" min="0">
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Unité</label>
                        <select name="unit" class="form-select">
                            <option value="unité">Unité</option>
                            <option value="mètre">Mètre</option>
                            <option value="litre">Litre</option>
                            <option value="kg">Kilogramme</option>
                        </select>
                    </div>
                    <div class="col-md-4 mb-3">
                        <label class="form-label">Prix unitaire</label>
                        <input type="number" name="unit_price" class="form-control" step="0.01" min="0">
                    </div>
                </div>
                
                <div class="mb-3">
                    <label class="form-label">Fournisseur</label>
                    <input type="text" name="supplier" class="form-control">
                </div>
                
                <button type="submit" class="btn btn-primary">
                    <i class="bi bi-check"></i> Enregistrer
                </button>
            </form>
        </div>
    </div>
</div>
{% endblock %}