{% extends "mobile/mobile_base.html" %} {% load static %} {% load i18n %} {% load tz %} {% load short_name %} {% load interventions_tags %} {% load mention_tags %} {% get_current_language as LANGUAGE_CODE %} {% block extra_head %} {% if not is_technician %} {% endif %} {% if intervention.lat and intervention.lon %} {% endif %} {% endblock extra_head %} {% block upleft %} {{ back_label }} {% endblock upleft %} {% block title %} {{ intervention.get_status_display }} {% if intervention.prep_state == "processed" %} {% elif intervention.prep_state == "not_processed" %} {% endif %} {% endblock title %} {% block upright %} {% endblock upright %} {% block content %} {% if messages %}
{% for message in messages %} {% endfor %}
{% endif %}
{{ intervention.code }}
{% if intervention.contract and intervention.contract.uses_intervention_manager %}
{% translate "Gestionnaire :" %} {% if intervention.intervention_manager %} {{ intervention.intervention_manager.get_full_name|default:intervention.intervention_manager.username }} {% else %} {% translate "Aucun" %} {% endif %}
{% endif %} {% if intervention.assigned_member %}
{{ intervention.assigned_member.name }}
{% endif %}
{{ intervention.title }}

{{ intervention.planned_begin_time|date:"d/m/Y H:i"|default:"/" }}

{{ intervention.get_maintain_type_display }}

{% include "interventions/includes/_operation_comment_modal.html" %} {% if intervention.status == 'on_pause' and intervention.pause_reason %}
{{ intervention.get_pause_reason_display }} {% if intervention.pause_reason_other %} - {{ intervention.pause_reason_other }} {% endif %}
{% endif %}
{% if can_edit_intervention %}
{% csrf_token %} {% if back_history %}{% endif %} {% endif %}
{% translate "Notes" %}
{% if notes %} {% for note in notes %}
{{ note.get_note_type_display }} {{ note.note_time|timezone:"Europe/Paris"|date:"d-m-Y H:i" }} - {{ note.note_author|short_name }}

{{ note.content|safe|linebreaksbr }}

{% if note.id in editable_note_ids and can_edit_notes %}
{% endif %}
{% endfor %} {% else %}

{% translate "Aucune note pour le moment." %}

{% endif %}
{% translate "Documents" %}
{% if 'documents' in allowed_update_fields %}
{% endif %}
{% for document in intervention.documents.all %}
{% if 'documents' in allowed_update_fields and document.id in deletable_document_ids %} {% endif %} {% private_file_url document 'file' as document_file_url %}
{% if document.thumbnail %} {% private_file_url document 'thumbnail' as document_thumbnail_url %} {{ document.filename }} {% else %} {{ document.filename }} {% endif %}
{{ document.upload_date|date:"d/m/Y H:i" }}
{{ document.uploaded_by|short_name }}
{% endfor %}
{% translate "Compléter les opérations" %}
{% if operations_general_group or operations_asset_groups or guided_template %} {% if operations_general_group or operations_asset_groups %}
{% if can_edit_operation_comments %} {% endif %}
{% endif %} {% with general_group_count=operations_general_group.template_groups|length|default:0 %} {% if operations_general_group %}

{% translate "Opérations générales" %}

{% for template_group in operations_general_group.template_groups %}
{% if template_group.name %} {% endif %}
{% for op in template_group.operations %} {% include "interventions/includes/_mobile_operation_card.html" with op=op %} {% empty %}

{% translate "Aucune opération générale." %}

{% endfor %}
{% endfor %}
{% endif %} {% if operations_asset_groups %}

{% translate "Opérations par équipement" %}

{% for asset_group in operations_asset_groups %} {% with group_index=forloop.counter|add:general_group_count %}
{% for template_group in asset_group.template_groups %} {% if template_group.name %}

{{ template_group.name }}

{% endif %} {% for op in template_group.operations %} {% include "interventions/includes/_mobile_operation_card.html" with op=op %} {% empty %}

{% translate "Aucune opération pour cet équipement." %}

{% endfor %} {% endfor %}
{% endwith %} {% endfor %} {% endif %} {% endwith %} {% if guided_template %} {# ── Bloc opérations guidées (intégré dans la carte Opérations) ── #}

{{ guided_template.getName }}
{% include "interventions/guided_operations/"|add:guided_template.slug|add:".html" %}
{% endif %} {% else %}

{% translate "Aucune opération à compléter pour le moment." %}

{% endif %}
{% if can_edit_intervention %}
{% translate "Ajouter une note" %}
{% translate "Ajouter des documents" %} {% if photos_required %} {% translate "Photos obligatoires" %} {% endif %}
{% endif %} {% if can_edit_intervention %}

{% endif %} {% if show_occupations %}
{% translate "Occupations" %} {% if occupations_required and not occupations %} {% translate "Obligatoire" %} {% endif %} {% if can_manage_occupations %} {% endif %}
{% for occupation in occupations %}
{{ occupation.member.name }}
{{ occupation.created_at|timezone:"Europe/Paris"|date:"d/m/Y H:i" }} {% if occupation.created_by %} — {{ occupation.created_by|short_name }} {% endif %}
{% if occupation.updated_by %}
{% translate "Mis à jour par" %} {{ occupation.updated_by|short_name }} ({{ occupation.updated_at|timezone:"Europe/Paris"|date:"d/m/Y H:i" }})
{% endif %}
{{ occupation.minutes|minutes_to_hours_minutes }} {% if can_manage_occupations %}
{% endif %}
{% endfor %}

{% translate "Aucune occupation enregistrée pour le moment." %}

{% if can_manage_occupations and occupation_form %} {% endif %} {% endif %} {% if intervention.status != 'in_preparation' %} {% if 'follow_up_reports' in allowed_update_fields %} {% endif %}
{% translate "Contrôles / Rapports de suivi" %} {% if 'follow_up_reports' in allowed_update_fields %} {% endif %}
{% if is_user_intern %}
{% translate "Résultat du contrôle" %}
{% if 'follow_up_reports' in allowed_update_fields %}
{% else %} {% if intervention.follow_up_performed == 'ok' %}OK{% elif intervention.follow_up_performed == 'attention' %}{% translate "Points d’attention" %}{% elif intervention.follow_up_performed == 'not_ok' %}Not OK{% else %}–{% endif %} {% endif %}
{% endif %} {% if visible_controls %} {% for control in visible_controls %} {% endfor %}
{% translate "Date" %} {% translate "Type" %} {% translate "Statut" %}
{{ control.updated_at|date:"d-m-Y" }} {{ control.get_control_type_display }} {{ control.get_status_display }}
{% else %}

{% translate "Aucun contrôle pour le moment." %}

{% endif %}
{% endif %} {% if 'documents' in allowed_update_fields %} {% endif %} {% if intervention.status in 'in_preparation,to_be_approved' %}
{% translate "Fiche d'intervention" %}
{% translate "Visualiser" %}
{% elif intervention.intervention_sheet %}
{% translate "Fiche d'intervention" %}
{% private_file_url intervention 'intervention_sheet' as intervention_sheet_url %} {% translate "Visualiser" %}
{% endif %} {% if assets or mobile_assets_enabled %}
{% translate "Équipements liés" %} {% if mobile_assets_enabled %}
{% endif %}
{% if assets %} {% else %}

{% translate "Aucun équipement n'est encore lié à cette intervention." %}

{% endif %} {% if mobile_assets_enabled and mobile_asset_location_labels %}
{% translate "Localisations de l'intervention" %}: {{ mobile_asset_location_labels|join:', ' }}
{% endif %}
{% endif %} {% if mobile_assets_enabled %} {# Modal pour créer un nouvel équipement (Mobile - simplifié) #} {% endif %} {% if mobile_assets_enabled and mobile_asset_replacement_data %} {% endif %} {% if intervention.status == 'to_be_processed' and can_take_over %} {% endif %} {% if intervention.status == 'assigned' and can_take_over %} {% endif %} {% if can_create_repair %}
{% csrf_token %} {% if assets %} {% endif %}
{% endif %} {% if linked_groups %}
{% translate "Interventions liées" %}
{% for group in linked_groups %}

{{ group.label }}

{% endfor %}
{% endif %} {% if linked_observations %}
{% translate "Observations liées" %} {{ linked_observations|length }}
{% endif %} {% if location_history_interventions %}
{% translate "Historique des interventions (3 mois)" %} {{ location_history_interventions|length }}

{% translate "Interventions récentes sur les mêmes localisations" %}

{% with total_items=location_history_interventions|length %} {% if total_items > 10 %}
{% else %} {% endif %} {% endwith %}
{% endif %} {% if can_edit_intervention %} {% endif %} {% if can_edit_intervention %} {% endif %} {% if 'processed_via_other_intervention' in allowed_update_fields %}
{% translate "Traitement via une autre intervention" %}
{% elif intervention.processed_via_other_intervention %}
{% translate "Le traitement est fait via une autre intervention" %}
{% endif %} {% if is_technician and not can_edit_intervention %} {# Formulaire minimal pour la prise en charge / démarrage sans droit d'édition #}
{% csrf_token %} {% if back_history %}{% endif %}
{% endif %} {% if intervention.lat and intervention.lon %} {% endif %} {% endblock content %} {% block footer %} {% if is_technician %} {# ── Techniciens : boutons d'action spécifiques ── #} {% if photos_required and intervention.status in 'in_progress,on_pause' and can_edit_intervention %}
{% endif %}
{% if intervention.status == 'to_be_processed' and can_take_over %} {% endif %} {% if intervention.status == 'assigned' and can_edit_intervention %} {% endif %} {% if intervention.status in 'to_be_processed,assigned' and can_take_over %} {% endif %} {% if intervention.status in 'on_pause' and can_edit_intervention %} {% endif %} {% if intervention.status == 'in_progress' and can_edit_intervention %} {% endif %} {% if intervention.status in 'in_progress,on_pause' and can_edit_intervention %} {% endif %} {% if intervention.status in 'to_be_processed,assigned,in_progress,on_pause' and can_edit_intervention %} {% endif %}
{% else %} {# ── Autres rôles : timeline de changement de statut ── #}
{% endif %} {% endblock footer %} {% block extra_scripts %} {% if not is_technician %} {# ── Modals timeline (rendus hors du footer position:fixed pour éviter le contexte d'empilement) ── #} {% endif %} {# ── Globals partagés (timeline + photo upload + suppression documents) ── #} {% if not is_technician %} {# ── jQuery + globals requis par timeline.js ── #} {{ status_choices|json_script:"status_choices" }} {% endif %}
{% if mobile_assets_enabled and mobile_assets_config %} {{ mobile_assets_config|json_script:"mobile-assets-config" }} {% endif %} {% if mobile_asset_replacement_data %} {{ mobile_asset_replacement_data|json_script:"mobile-asset-replacement-data" }} {% endif %} {% if intervention.lat and intervention.lon %} {% endif %} {% endblock extra_scripts %}