{% extends "layouts/base.html" %} {% load i18n %} {% load static %} {% block title %}{{ observation.tracking_code }} - {% trans "Observation Detail" %} - PX360{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{% trans "Observations" %} {{ observation.tracking_code }} {{ observation.get_status_display }} {{ observation.get_severity_display }} {% if observation.is_anonymous %} {% trans "Anonymous" %} {% endif %} {% if observation.is_overdue %} {% trans "Overdue" %} {% endif %} {% if not observation.sent_to_department %} {% trans "Not Sent to Dept" %} {% endif %}

{% if observation.title %}{{ observation.title }}{% else %}{{ observation.description|truncatewords:10 }}{% endif %}

{% trans "PDF" %}
{% include "core/workflow_stepper.html" %}

{{ observation.description }}

{% if observation.description_en %}

{{ observation.description_en }}

{% endif %} {% if observation.emotion or observation.short_description_en or observation.suggested_actions or observation.suggested_action_en %}
{% trans "AI Analysis" %}
{% if observation.emotion and observation.emotion != 'neutral' %}
{{ observation.emotion|title }} {% trans "Confidence" %}: {{ observation.emotion_confidence_percent|floatformat:0 }}%
{% endif %} {% if observation.short_description_en %}

{{ observation.short_description_en }}

{% if observation.short_description_ar %}

{{ observation.short_description_ar }}

{% endif %} {% elif observation.suggested_action_en %}

{{ observation.suggested_action_en }}

{% if observation.suggested_action_ar %}

{{ observation.suggested_action_ar }}

{% endif %}
{% elif observation.suggested_actions %}
{% for action in observation.suggested_actions %}
{{ action.priority }}

{{ action.action_en }}

{% endfor %}
{% endif %}
{% endif %}

{% trans "Category" %}

{{ observation.category.get_localized_name|default:"-" }}

{% trans "Location" %}

{% if observation.legacy_location %}{{ observation.legacy_location.name_en }}{% elif observation.location_text %}{{ observation.location_text }}{% else %}-{% endif %}

{% if observation.legacy_main_section %}

{{ observation.legacy_main_section.name_en }}{% if observation.legacy_subsection %} > {{ observation.legacy_subsection.name_en }}{% endif %}

{% endif %}

{% trans "Incident" %}

{{ observation.incident_datetime|date:"d M Y" }}

{% trans "Deadline" %}

{% if observation.due_at %}{{ observation.due_at|date:"d M Y" }}{% else %}-{% endif %} {% if observation.is_overdue %}{% endif %}

{% if observation.taxonomy_domain or observation.taxonomy_category or observation.taxonomy_subcategory or observation.taxonomy_classification %}
{% trans "Taxonomy" %}: {% if observation.taxonomy_domain %}{{ observation.taxonomy_domain.name_en }}{% endif %} {% if observation.taxonomy_category %}{{ observation.taxonomy_category.name_en }}{% endif %} {% if observation.taxonomy_subcategory %}{{ observation.taxonomy_subcategory.name_en }}{% endif %} {% if observation.taxonomy_classification %}{{ observation.taxonomy_classification.name_en }}{% endif %}
{% endif %}
{% if observation.is_anonymous %}
{% trans "Anonymous submission" %}
{% else %}
{% if observation.reporter_name %} {{ observation.reporter_name }} {% endif %} {% if observation.reporter_phone %} | {{ observation.reporter_phone }} {% endif %} {% if observation.reporter_email %} | {{ observation.reporter_email }} {% endif %} {% if not observation.reporter_name and not observation.reporter_phone and not observation.reporter_email %} {% trans "Reporter info not available" %} {% endif %}
{% endif %}
{% if observation.sent_to_department and observation.assigned_department %}

{% blocktrans with dept=observation.assigned_department.get_localized_name|default:observation.assigned_department.name %}Response from {{ dept }}{% endblocktrans %}

{% if observation.department_responded_at %} {% trans "Received" %} {% elif observation.dept_response_is_overdue %} {% trans "OVERDUE" %} {% else %} {% trans "Awaiting" %} {% endif %}
{% if observation.forwarded_to_dept_at %}
{% trans "Sent:" %} {{ observation.forwarded_to_dept_at|date:"Y-m-d H:i" }} {% if observation.dept_response_sla_due_at and not observation.department_responded_at %} {% trans "Deadline:" %} {{ observation.dept_response_sla_due_at|date:"Y-m-d H:i" }} {% endif %}
{% endif %} {% if observation.department_responded_at %}
{{ observation.department_responded_by.get_full_name|default:"-" }} {{ observation.department_responded_at|date:"Y-m-d H:i" }}
{% if observation.department_response_en %}

English

{{ observation.department_response_en|linebreaks }}

{% endif %} {% if observation.department_response_ar %}

العربية

{{ observation.department_response_ar|linebreaks }}

{% endif %} {% if observation.department_response_summary_en %}
{% trans "AI Summary" %}

{{ observation.department_response_summary_en }}

{% if observation.department_response_summary_ar %}

{{ observation.department_response_summary_ar }}

{% endif %}
{% endif %} {% if observation.dept_response_acceptance_status %}
{% if observation.dept_response_acceptance_status == 'acceptable' %} {% trans "Accepted" %} {% elif observation.dept_response_acceptance_status == 'not_acceptable' %} {% trans "Not Acceptable" %} {% else %} {% trans "Pending Review" %} {% endif %} {% if observation.dept_response_accepted_by %} by {{ observation.dept_response_accepted_by.get_full_name }} {% endif %}
{% if can_review_dept_response and observation.dept_response_acceptance_status == 'pending' %}
{% csrf_token %}
{% csrf_token %}
{% endif %}
{% if observation.dept_response_acceptance_notes %}

{{ observation.dept_response_acceptance_notes }}

{% endif %}
{% endif %} {% else %}

{% trans "Waiting for department response..." %}

{% if observation.dept_response_sla_due_at %}

{% trans "Deadline:" %} {{ observation.dept_response_sla_due_at|date:"Y-m-d H:i" }}

{% endif %}
{% if can_send_reminder %}
{% csrf_token %}
{% if observation.dept_response_reminder_sent_at %}
{% csrf_token %}
{% endif %}
{% endif %} {% if can_respond_to_department %}
{% endif %} {% endif %}
{% else %}

{% trans "No department assigned to this observation" %}

{% endif %} {% if observation.responded_at and observation.response %}

{% trans "Response to Reporter" %}

{% trans "Response Sent" %} {% if observation.responded_by %} — {{ observation.responded_by.get_full_name }} • {{ observation.responded_at|date:"M d, Y H:i" }} {% endif %}

{{ observation.response|linebreaks }}

{% endif %}
{% if observation.status not in 'resolved,closed' %}

{% trans "Quick Actions" %}

{% if observation.status == 'open' and not observation.activated_at %} {% if can_convert %}
{% csrf_token %}
{% csrf_token %}
{% else %}

{% trans "Activate this observation to perform actions" %}

{% endif %} {% else %} {% if can_convert and observation.status not in 'closed,cancelled' %} {% endif %} {% if can_convert %} {% endif %} {% if can_admin and not observation.action_id %} {% trans "Convert" %} {% endif %} {% if can_send_to_department and not observation.department_responded_at %} {% endif %} {% if can_convert and observation.status == 'in_progress' %}
{% csrf_token %}
{% endif %} {% if can_triage and observation.status != 'closed' and observation.status != 'cancelled' and observation.status != 'rejected' %} {% endif %} {% if can_admin %} {% trans "RCA" %} {% trans "QI Project" %} {% endif %} {% if observation.status == 'resolved' or observation.status == 'closed' %} {% if can_triage %}
{% csrf_token %}
{% endif %} {% endif %} {% if can_delete %}
{% csrf_token %}
{% endif %} {% endif %}
{% endif %} {% if can_convert %} {% endif %}

{% trans "Assignment" %}

  • {% trans "Department" %} {{ observation.assigned_department.get_localized_name|default:_("Not assigned") }}
  • {% trans "Assigned To" %} {{ observation.assigned_to.get_full_name|default:_("Not assigned") }}
{% if observation.person_noted or observation.department_noted or observation.communication_method or observation.communication_datetime or observation.patient_file_number %}

{% trans "Communication" %}

    {% if observation.patient_file_number %}
  • {% trans "File Number" %} {{ observation.patient_file_number }}
  • {% endif %} {% if observation.person_noted %}
  • {% trans "Person Noted" %} {{ observation.person_noted }}
  • {% endif %} {% if observation.department_noted %}
  • {% trans "Department Noted" %} {{ observation.department_noted.get_localized_name }}
  • {% endif %} {% if observation.communication_method %}
  • {% trans "Via" %} {{ observation.communication_method }}
  • {% endif %} {% if observation.communication_datetime %}
  • {% trans "Contacted At" %} {{ observation.communication_datetime|date:"M d, Y H:i" }}
  • {% endif %}
{% endif %} {% if px_action %}

{% trans "Linked PX Action" %}

{{ px_action.title|truncatewords:10 }}

{% trans "View Action" %}
{% endif %} {% if can_triage %}

{% trans "Triage" %}

{% csrf_token %}
{{ triage_form.assigned_department }}
{{ triage_form.assigned_to }}
{{ triage_form.status }}
{{ triage_form.note }}
{% endif %}
{% include "components/send_to_modal.html" with users=assignable_users departments=departments %} {% include "components/department_response_modal.html" %} {% endblock %}