{% extends "base.html" %} {% load static %} {% load i18n %} {% load observation_tags %} {% load short_name %} {% load mention_tags %} {% block head %} {% endblock head %} {% block content %}
{% if messages %} {% for message in messages %} {% endfor %} {% endif %}

{% translate "Détail de l'observation" %}

{{ observation.code }} {% if can_edit or can_delete %}
{% if can_edit %} {% if observation.status == 'in_preparation' or observation.status == 'to_process' or observation.status == 'to_redirect' %} {% translate "Modifier" %} {% endif %} {% endif %} {% if can_delete %} {% endif %}
{% endif %}
{% if observation.observation_type == 'incident' %} {% elif observation.observation_type == 'inventory' %} {% elif observation.observation_type == 'remark' %} {% else %}{% endif %} {{ observation.get_observation_type_display }} {% if observation.status == 'in_preparation' %} {{ observation.get_status_display }} {% elif observation.status == 'to_process' %} {{ observation.get_status_display }} {% elif observation.status == 'in_progress' %} {{ observation.get_status_display }} {% elif observation.status == 'processed' %} {{ observation.get_status_display }} {% elif observation.status == 'not_relevant' %} {{ observation.get_status_display }} {% elif observation.status == 'to_redirect' %} {{ observation.get_status_display }} {% elif observation.status == 'duplicate' %} {{ observation.get_status_display }} {% elif observation.status == 'closed' %} {{ observation.get_status_display }} {% elif observation.status == 'archived' %} {{ observation.get_status_display }} {% endif %}
{% translate "Description" %}

{{ observation.description|default:"-" }}

{% if observation.address %}
{% translate "Adresse" %}

{{ observation.address }}

{% endif %}
{% translate "Thématique" %}

{% if observation.thematic %} {{ observation.thematic.name }} {% else %} - {% endif %}

{% translate "Catégorie" %}

{% if observation.category %} {% if observation.category.parent %} {{ observation.category.parent.get_name }} - {{ observation.category.get_name }} {% else %} {{ observation.category.get_name }} {% endif %} {% else %} - {% endif %}

{% if observation.symptom %}
{% translate "Symptôme" %}

{{ observation.symptom }}

{% endif %} {% if checklist_template and checklist_items_with_responses %}
{{ checklist_template.get_name }}
{% for item_data in checklist_items_with_responses %} {% endfor %}
{% translate "Élément" %} {% translate "Valeur" %} {% translate "Commentaire" %}
{{ item_data.item.get_name }}
{% if item_data.item.get_description %} {{ item_data.item.get_description }} {% endif %}
{% if item_data.response %} {% if item_data.item.item_type == 'boolean' %} {% if item_data.response.value_boolean %} {% translate "Oui" %} {% elif item_data.response.value_boolean == False %} {% translate "Non" %} {% else %} - {% endif %} {% elif item_data.item.item_type == 'text' %} {{ item_data.response.value_text|default:"-"|truncatewords:10 }} {% elif item_data.item.item_type == 'number' %} {{ item_data.response.value_number|default:"-" }} {% elif item_data.item.item_type == 'choice' %} {% display_choice_value item_data.item item_data.response.value_choice %} {% elif item_data.item.item_type == 'choice_multiple' %} {% display_choice_value item_data.item item_data.response.value_choices %} {% endif %} {% else %} - {% endif %} {% if item_data.response and item_data.response.comment %} {{ item_data.response.comment }} {% else %} - {% endif %}
{% endif %} {% if visible_interventions %}
{% if visible_interventions|length > 1 %} {% translate "Interventions associées" %} {% else %} {% translate "Intervention liée" %} {% endif %} {{ visible_interventions|length }}
{% if can_link and observation.intervention %}
{% csrf_token %}
{% endif %}
{% for item in visible_interventions %} {% with itv=item.intervention %}
{% if item.can_view_detail %} {{ itv.code|default:itv.id }} {% else %} {{ itv.code|default:itv.id }} {% endif %} – {{ itv.title }}
{{ itv.get_status_display }} {% if item.can_view_summary %} {% endif %}
{% endwith %} {% endfor %}
{% elif observation.intervention %}
{% translate "Intervention liée" %}
{% if can_link %}
{% csrf_token %}
{% endif %}
{{ observation.intervention.get_status_display }} {% if can_view_intervention_summary_modal %} {% endif %} {% if can_view_intervention_detail %} {{ observation.intervention.code|default:observation.intervention.id }} {% else %} {{ observation.intervention.code|default:observation.intervention.id }} {% endif %}
{% endif %} {% if observation.project %}
{% translate "Projet lié" %}
{% if can_link %}
{% csrf_token %}
{% endif %}
{{ observation.project.get_status_display }} {{ observation.project.code }} – {{ observation.project.name }}
{% endif %}
{% translate "Créé le" %}

{{ observation.created_at|date:"d/m/Y H:i" }}

{% translate "Créé par" %}

{% if observation.created_by %} {{ observation.created_by|short_name }}{% with comp=observation.created_by|user_company %}{% if comp %} ({{ comp }}){% endif %}{% endwith %} {% else %} - {% endif %}

{% if photos %}
{% translate "Photos" %} ({{ photos|length }})
{% for photo in photos %} {% private_file_url photo 'photo' as photo_url %} {% private_file_url photo 'thumbnail' as thumb_url %} Photo {% endfor %}
{% endif %}
{% translate "Commentaires" %}
{% if comments %}
{% for c in comments %}
{{ c.author|short_name }}{% with comp=c.author|user_company %}{% if comp %} ({{ comp }}){% endif %}{% endwith %}
{{ c.created_at|date:"d/m/Y H:i" }}
{{ c.comment|linebreaksbr }}
{% endfor %}
{% else %}

{% translate "Aucun commentaire." %}

{% endif %}
{% translate "Actions" %}
{% if observation.intervention and observation.intervention.status == 'canceled' %} {% endif %} {% if can_take_action and observation.status == 'to_process' %}
{% if observation.observation_type == 'inventory' or observation.observation_type == 'remark' %} {% else %}
{% csrf_token %}
{% endif %} {% if not observation.intervention %} {% endif %} {% if not observation.project %} {% endif %}
{% endif %} {% if is_creator or 'admin' in user_roles %} {% if observation.status == 'in_preparation' or not observation.status %}
{% csrf_token %}
{% endif %} {% endif %} {% if 'admin' in user_roles %} {% if observation.status == 'processed' or observation.status == 'not_relevant' or observation.status == 'to_redirect' or observation.status == 'duplicate' %}
{% csrf_token %}
{% endif %} {% endif %}
{% if observation.thematic and observation.category and observation.latitude and observation.longitude %}
{% endif %} {% if observation.intervention and can_view_intervention_summary_modal %} {% endif %} {% if geom_geojson %} {{ geom_geojson|json_script:"geom-data" }} {% endif %}
{% translate "Messages" %}
{% if discussion_messages %}
{% for msg in discussion_messages %}
{% if msg.author != request.user %}
{{ msg.author|short_name|first|upper|default:msg.author.username|first|upper }}
{% endif %}
{% if msg.author != request.user %}
{{ msg.author|short_name }}{% with comp=msg.author|user_company %}{% if comp %} ({{ comp }}){% endif %}{% endwith %} · {{ msg.created_at|date:"d/m/Y H:i" }}
{% else %}
{{ msg.created_at|date:"d/m/Y H:i" }}
{% endif %}
{{ msg.content|render_mentions }} {% if msg.attachments.exists %}
{% for att in msg.attachments.all %} {% if att.is_image %} {{ att.name }} {% else %} {{ att.name|truncatechars:20 }} {% endif %} {% endfor %}
{% endif %}
{% endfor %}
{% else %}

{% translate "Aucun message." %}

{% endif %} {% if can_post_discussion_message %}
{% csrf_token %}
{% endif %}
{% if can_delete %} {% endif %} {% endblock content %} {% block script %} {{ detail_symptoms_autocomplete|json_script:"detail-symptoms-list" }} {% endblock script %}