2026-08-14 18:02:25 +02:00
{% extends "base.html" %}
2026-08-15 01:26:22 +02:00
{% block title %}{{ 'Modifier' if part is defined and part else 'Nouvelle' }} pièce — GMAO{% endblock %}
2026-08-14 18:02:25 +02:00
{% block content %}
< div class = "container-fluid" >
< div class = "d-flex justify-content-between align-items-center mb-4" >
2026-08-15 01:26:22 +02:00
< h1 > < i class = "bi bi-plus-circle" > < / i > {{ 'Modifier' if part is defined and part else 'Nouvelle' }} pièce< / h1 >
2026-08-14 18:02:25 +02:00
< 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 >
2026-08-15 01:26:22 +02:00
< input type = "text" name = "name" class = "form-control" value = "{{ part.name if part is defined and part else '' }}" required >
2026-08-14 18:02:25 +02:00
< / div >
< div class = "col-md-6 mb-3" >
< label class = "form-label" > Référence< / label >
2026-08-15 01:26:22 +02:00
< input type = "text" name = "reference" class = "form-control" value = "{{ part.reference if part is defined and part and part.reference else '' }}" >
2026-08-14 18:02:25 +02:00
< / div >
< / div >
< div class = "row" >
< div class = "col-md-4 mb-3" >
< label class = "form-label" > Quantité< / label >
2026-08-15 01:26:22 +02:00
< input type = "number" name = "quantity" class = "form-control" value = "{{ part.quantity if part is defined and part else 0 }}" min = "0" >
{% if part is defined and part %}< input name = "stock_reason" class = "form-control mt-2" placeholder = "Motif si la quantité change" > {% endif %}
2026-08-14 18:02:25 +02:00
< / div >
< div class = "col-md-4 mb-3" >
< label class = "form-label" > Unité< / label >
< select name = "unit" class = "form-select" >
2026-08-15 01:26:22 +02:00
{% for value, label in [('unité','Unité'),('mètre','Mètre'),('litre','Litre'),('kg','Kilogramme')] %}< option value = "{{ value }}" { % if part is defined and part and part . unit = = value % } selected { % endif % } > {{ label }}< / option > {% endfor %}
2026-08-14 18:02:25 +02:00
< / select >
< / div >
< div class = "col-md-4 mb-3" >
< label class = "form-label" > Prix unitaire< / label >
2026-08-15 01:26:22 +02:00
< input type = "number" name = "unit_price" class = "form-control" step = "0.01" min = "0" value = "{{ part.unit_price if part is defined and part and part.unit_price is not none else '' }}" >
2026-08-14 18:02:25 +02:00
< / div >
< / div >
< div class = "mb-3" >
< label class = "form-label" > Fournisseur< / label >
2026-08-15 01:26:22 +02:00
< input type = "text" name = "supplier" class = "form-control" value = "{{ part.supplier if part is defined and part and part.supplier else '' }}" >
2026-08-14 18:02:25 +02:00
< / div >
< button type = "submit" class = "btn btn-primary" >
< i class = "bi bi-check" > < / i > Enregistrer
< / button >
< / form >
< / div >
< / div >
< / div >
2026-08-15 01:26:22 +02:00
{% endblock %}