{% extends "base.html" %} {% block title %}{{ intervention.title }} — GMAO{% endblock %} {% block content %}
{% if intervention.is_deleted %}
Cette intervention est dans la corbeille. Supprimée le {{ intervention.deleted_at.strftime('%d/%m/%Y %H:%M') if intervention.deleted_at else '—' }}.
{% endif %} {% if intervention.equipment and intervention.equipment.status in ['a_jeter', 'jete'] %}
{% if intervention.equipment.status == 'a_jeter' %} Équipement à jeter : L'équipement « {{ intervention.equipment.name }} » est marqué pour mise au rebut. {% else %} Équipement mis au rebut : L'équipement « {{ intervention.equipment.name }} » a été définitivement mis au rebut. L'historique reste consultable. {% endif %}
{% endif %}

{% if intervention.type == 'curatif' %}🔧 Curatif{% else %}🛡️ Préventif{% endif %} {{ intervention.title }}

Intervention #{{ intervention.id }} — {{ intervention.created_at.strftime('%d/%m/%Y %H:%M') if intervention.created_at else '—' }}
{{ intervention.status_label }} {{ intervention.priority_label }}
Workflow
{% set workflow_order = ['brouillon', 'attente_chef', 'valide_chef', 'demande_gima', 'gima_accepte', 'budget_previsionnel', 'en_cours', 'en_attente_pieces', 'en_attente_entreprise', 'terminee', 'cloturee'] %} {% for step in workflow_order %} {% if step in statuses %} {% set is_current = (step == intervention.status) %} {% set is_past = workflow_order.index(step) < workflow_order.index(intervention.status) if intervention.status in workflow_order else false %} {% set bg_class = 'bg-' + statuses[step]['color'] if is_current else ('bg-success' if is_past else 'bg-light') %} {% set text_class = 'text-white' if is_current or is_past else 'text-muted' %} {% if is_past %}{% endif %} {{ statuses[step]['label'] }} {% if not loop.last %}{% endif %} {% endif %} {% endfor %}
{% if transitions %}
Actions rapides
{% for status, label in transitions %} {% endfor %}
{% if intervention.equipment and intervention.equipment.status not in ['a_jeter', 'jete'] %}
{% endif %}
{% else %}
Aucune transition possible depuis le statut actuel avec votre rôle.
{% endif %}
Responsable actuel
{% if intervention.assigned_to %}
{{ intervention.assigned_to.full_name[0]|upper }}
{{ intervention.assigned_to.full_name }}
{{ intervention.assigned_to.role_label }}
{% elif intervention.status == 'brouillon' %} Brouillon — pas encore de responsable assigné {% else %} Non assigné {% endif %}
{% if intervention.technician %}
Technicien assigné
{{ intervention.technician.full_name }} {{ intervention.technician.role_label }}
{% endif %}
Description
{% if intervention.description %}

{{ intervention.description }}

{% else %}

Aucune description

{% endif %}
{% if intervention.gima_number or intervention.needs_budget %}
GIMA & Budget
{% if intervention.gima_number %}
N° demande GIMA : {{ intervention.gima_number }}
Service : {% if intervention.gima_service == 'entretien' %} Service Entretien {% elif intervention.gima_service == 'securite' %} Service Sécurité {% else %} {{ intervention.gima_service or '—' }} {% endif %}
{% endif %} {% if intervention.needs_budget %}
Budget prévisionnel requis
{% if intervention.budget_amount %} Montant : {{ "%.2f"|format(intervention.budget_amount) }} € {% endif %} {% if intervention.budget_approved %} Approuvé {% else %} En attente {% endif %}
{% endif %}
{% endif %}
Équipement
{% if intervention.is_group_intervention %}
Groupe d'équipements {{ intervention.quantity_affected }} unité(s) concernée(s)
{% endif %} {{ intervention.equipment.code or intervention.equipment.name }}
{{ intervention.equipment.full_path }}
{% if intervention.is_group_intervention %} {% set affected_units = intervention.get_affected_units() %} {% if affected_units %}
Éléments concernés ({{ affected_units|length }})
{% for unit in affected_units %} {% endfor %}
Code Position Statut Actions
{{ unit.individual_number }} {{ unit.code or '—' }} {{ unit.position or '—' }} {{ unit.status|format_status }} {% if unit.has_active_curative and unit.id != intervention.equipment_id %} {% endif %} {% if intervention.status not in ['cloturee', 'terminee'] %}
{% endif %}
{% endif %} {% endif %} {% if intervention.company %}
Entreprise extérieure
{{ intervention.company.name }} {% if intervention.company.specialty %} {{ intervention.company.specialty }} {% endif %}
{% endif %} {% if history %}
Historique des statuts
{% for change in history %}
{{ change.to_label }} {% if change.from_status %} (de {{ change.from_label }}) {% endif %}
Par {{ change.changed_by.full_name }} — {{ change.created_at.strftime('%d/%m/%Y %H:%M') if change.created_at else '—' }} {% if change.comment %}
{{ change.comment }} {% endif %}
{% endfor %}
{% endif %}
Commentaires
{% for comment in intervention.comments %}
{{ comment.author.full_name[0]|upper }}
{{ comment.author.full_name }} {{ comment.created_at.strftime('%d/%m/%Y %H:%M') if comment.created_at else '—' }}

{{ comment.content }}

{% endfor %}
{% if intervention.is_deleted %}
{% else %} Modifier l'intervention
{% endif %}
Résumé
{% if intervention.recurrence_month %} {% endif %} {% if intervention.cost %} {% endif %} {% if intervention.time_spent %} {% endif %} {% if intervention.started_at %} {% endif %} {% if intervention.completed_at %} {% endif %}
Type {% if intervention.type == 'curatif' %}🔧 Curatif{% else %}🛡️ Préventif{% endif %}
Priorité{{ intervention.priority_label }}
Statut{{ intervention.status_label }}
RécurrenceTous les {{ intervention.recurrence_month }} mois
Coût{{ "%.2f"|format(intervention.cost) }} €
Temps passé{{ intervention.time_spent }} min
Demandé le{{ intervention.requested_at.strftime('%d/%m/%Y') if intervention.requested_at else '—' }}
Débuté le{{ intervention.started_at.strftime('%d/%m/%Y') }}
Terminé le{{ intervention.completed_at.strftime('%d/%m/%Y') }}
{% if intervention.requester_name %}
Demandeur
{{ intervention.requester_name }} {% if intervention.requester_contact %}
{{ intervention.requester_contact }} {% endif %}
{% endif %} {% if intervention.type == 'preventif' and intervention.preventive_type %}
Détails préventif
Type : {{ intervention.preventive_type }} {% if intervention.recurrence_month %}
Récurrence : Tous les {{ intervention.recurrence_month }} mois {% endif %}
{% endif %}
Documents
{% if intervention.documents.all() %}
{% for doc in intervention.documents %}
{% set ext = doc.filename|lower %} {{ doc.filename }} {% if doc.description %}
{{ doc.description }} {% endif %}
{{ doc.uploaded_at.strftime('%d/%m/%Y') if doc.uploaded_at else '—' }}
{% endfor %}
{% else %}

Aucun document

{% endif %}
{% for doc in intervention.documents %} {% endfor %} {% endblock %}