{% extends "mobile/mobile_base.html" %} {% load static %} {% load i18n %} {% load tz %} {% load short_name %} {% load interventions_tags %} {% load mention_tags %} {% load document_viewer_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 %} {% if intervention.is_contract_blocked %} {% endif %}
{{ intervention.code }} {% if intervention.is_contract_blocked %} {% translate "Marché bloqué" %} {% endif %}
{% if intervention.lat and intervention.lon %}
{% endif %}
{% 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 et documents" %}
{% if total_items_count %} {{ total_documents_count }} {% if total_documents_count > 1 %}{% translate "docs" %}{% else %}{% translate "doc" %}{% endif %} • {{ total_notes_count }} {% if total_notes_count > 1 %}{% translate "notes" %}{% else %}{% translate "note" %}{% endif %} {% endif %}
{% if 'documents' in allowed_update_fields %}
{% endif %}
{% if total_items_count == 0 %}
{% translate "Aucun document ou note pour cette intervention." %}
{% else %} {% for block in sequenced_blocks %} {% if block.has_items %}
{{ block.title }} ({% if block.documents_count > 0 %}{{ block.documents_count }} {% if block.documents_count > 1 %}{% translate "fichiers" %}{% else %}{% translate "fichier" %}{% endif %}{% endif %}{% if block.documents_count > 0 and block.notes_count > 0 %}, {% endif %}{% if block.notes_count > 0 %}{{ block.notes_count }} {% if block.notes_count > 1 %}{% translate "notes" %}{% else %}{% translate "note" %}{% endif %}{% endif %})
{% if block.period_display %} {{ block.period_display }} {% endif %}
{% if block.documents %}
{% for document in block.documents %}
{% 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 %}
{% endif %} {% if block.notes %}
{% for note in block.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 %}
{% endif %}
{% endif %} {% endfor %} {% endif %} {% if all_sequenced_documents %} {% render_document_viewer all_sequenced_documents modal_id="interventionDocViewerModal" modal_only=True allow_delete=False %} {% endif %}
{% 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 can_create_preparation_order or preparation_orders %}
{% translate "Stock" %}
{% if preparation_orders %} {{ preparation_orders|length }} {% endif %} {% if can_create_preparation_order %} {% endif %}
{% if preparation_orders %}
{% for order in preparation_orders %}
#{{ order.order_number }} {{ order.get_status_display }} {{ order.get_priority_display }} {% if order.is_loan %} {% translate "Prêt" %} {% endif %}
{{ order.date|date:"d/m/Y H:i" }}
{% with items=order.preparationorderitem_set.all other_items=order.other_items.all %} {% if items or other_items %}
{% for item in items|slice:":3" %} {{ item.product.name }} × {{ item.quantity }} {% endfor %} {% for item in other_items|slice:":2" %} {{ item.name }} × {{ item.quantity }} {% endfor %} {% with total_count=items.count|add:other_items.count %} {% if total_count > 3 %} +{{ total_count|add:"-3" }} {% endif %} {% endwith %}
{% else %} {% translate "Aucun article" %} {% endif %} {% endwith %}
{% endfor %}
{% else %}

{% translate "Aucun bon de préparation créé pour cette intervention." %}

{% 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 or can_duplicate_intervention %}
{% translate "Interventions liées" %}
{% if can_duplicate_intervention %}
{% csrf_token %}
{% endif %}
{% for group in linked_groups %}

{{ group.label }}

{% empty %}

{% translate "Aucune intervention liée pour l'instant." %}

{% 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 %} {% include "interventions/includes/_gps_navigation_modal.html" %} {% 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 %}