gmao/app_new/templates/housing/form.html
root a296b9e013
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Gère les logements de fonction et leurs pièces
2026-08-14 21:23:33 +00:00

7 lines
2.9 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ 'Modifier' if unit else 'Nouveau' }} logement — GMAO{% endblock %}
{% block content %}<div class="container" style="max-width:900px"><h1 class="h3 mb-4">{{ 'Modifier le' if unit else 'Nouveau' }} logement</h1><form method="post" class="card"><div class="card-body row g-3">
<div class="col-md-8"><label class="form-label">Nom *</label><input name="name" class="form-control" value="{{ unit.name if unit else '' }}" placeholder="Ex. Logement 1" required></div><div class="col-md-4"><label class="form-label">Code</label><input name="code" class="form-control" value="{{ unit.code if unit and unit.code else '' }}"></div>
<div class="col-md-6"><label class="form-label">Bâtiment *</label><select name="building_id" class="form-select" required><option value=""></option>{% for building in buildings %}<option value="{{ building.id }}" {% if unit and unit.building_id == building.id %}selected{% endif %}>{{ building.site.name ~ ' · ' if building.site else '' }}{{ building.name }}</option>{% endfor %}</select></div><div class="col-md-3"><label class="form-label">Type</label><select name="housing_type" class="form-select"><option value="fonction">Fonction</option><option value="gardien">Gardien</option><option value="temporaire">Temporaire</option></select></div><div class="col-md-3"><label class="form-label">État</label><select name="occupancy_status" class="form-select">{% for value,label in [('vacant','Vacant'),('occupe','Occupé'),('travaux','En travaux'),('indisponible','Indisponible')] %}<option value="{{ value }}" {% if unit and unit.occupancy_status == value %}selected{% endif %}>{{ label }}</option>{% endfor %}</select></div>
<div class="col-md-6"><label class="form-label">Occupant</label><input name="occupant_name" class="form-control" value="{{ unit.occupant_name if unit and unit.occupant_name else '' }}"></div><div class="col-md-6"><label class="form-label">Contact</label><input name="occupant_contact" class="form-control" value="{{ unit.occupant_contact if unit and unit.occupant_contact else '' }}"></div><div class="col-md-3"><label class="form-label">Début d'occupation</label><input type="date" name="occupancy_start" class="form-control" value="{{ unit.occupancy_start.isoformat() if unit and unit.occupancy_start else '' }}"></div><div class="col-md-3"><label class="form-label">Fin prévue/réelle</label><input type="date" name="occupancy_end" class="form-control" value="{{ unit.occupancy_end.isoformat() if unit and unit.occupancy_end else '' }}"></div><div class="col-md-6"><label class="form-label">Notes techniques</label><textarea name="notes" class="form-control">{{ unit.notes if unit and unit.notes else '' }}</textarea></div>
</div><div class="card-footer"><button class="btn btn-primary">Enregistrer</button> <a href="{{ url_for('housing.index') }}" class="btn btn-outline-secondary">Annuler</a></div></form></div>{% endblock %}