{% 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 observation.title %} {{ observation.title }} {% else %} {{ observation.description|truncatewords:10 }} {% endif %}

{% trans "Description" %}

{{ observation.description }}

{% if observation.description_en %}

English

{{ observation.description_en }}

{% endif %}
{% include "observations/partials/ai_panel.html" %}

{% trans "Details" %}

{% trans "Category" %}

{{ observation.category.get_localized_name|default:_("Not specified") }}

{% if observation.sub_category %}

{% trans "Sub-Category" %}

{{ observation.sub_category.get_localized_name }}

{% endif %} {% if observation.taxonomy_domain or observation.taxonomy_category or observation.taxonomy_subcategory or observation.taxonomy_classification %}

{% trans "SHCT Taxonomy" %}

{{ observation.taxonomy_domain.name_en|default:"" }} {% 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 %}

{% trans "Location" %}

{% if observation.location %}{{ observation.location.name_en }}{% elif observation.location_text %}{{ observation.location_text }}{% else %}{% trans "Not specified" %}{% endif %}

{% if observation.main_section %}

{% trans "Section" %}

{{ observation.main_section.name_en }}

{% endif %} {% if observation.subsection %}

{% trans "Subsection" %}

{{ observation.subsection.name_en }}

{% endif %}

{% trans "Incident Date/Time" %}

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

{% trans "Submitted" %}

{{ observation.created_at|date:"M d, Y H:i" }}

{% trans "Last Updated" %}

{{ observation.updated_at|date:"M d, Y H:i" }}

{% if observation.due_at %}

{% trans "Response Deadline" %}

{{ observation.due_at|date:"M d, Y H:i" }} {% if observation.is_overdue %}{% endif %}

{% endif %} {% if observation.triaged_at %}

{% trans "Triaged" %}

{{ observation.triaged_at|date:"M d, Y H:i" }} {% if observation.triaged_by %}({{ observation.triaged_by.get_full_name }}){% endif %}

{% endif %}

{% trans "Reporter Information" %}

{% if observation.is_anonymous %}

{% trans "This observation was submitted anonymously" %}

{% else %}
{% if observation.reporter_staff_id %}

{% trans "Staff ID" %}

{{ observation.reporter_staff_id }}

{% endif %} {% if observation.reporter_name %}

{% trans "Name" %}

{{ observation.reporter_name }}

{% endif %} {% if observation.reporter_phone %}

{% trans "Phone" %}

{{ observation.reporter_phone }}

{% endif %} {% if observation.reporter_email %}

{% trans "Email" %}

{{ observation.reporter_email }}

{% endif %}
{% endif %}
{% if attachments %}

{% trans "Attachments" %} ({{ attachments.count }})

{% for attachment in attachments %}
{{ attachment.filename }}
{{ attachment.file_type }} - {{ attachment.file_size|filesizeformat }}
{% endfor %}
{% endif %}

{% trans "Timeline" %}

{% if timeline %}
{% for item in timeline %}
{% if item.type == 'status_change' %}{% trans "Status Changed" %} {% elif item.type == 'note' %}{% trans "Note" %}{% endif %} {% if item.item.created_by %} {% trans "by" %} {{ item.item.created_by.get_full_name }} {% elif item.item.changed_by %} {% trans "by" %} {{ item.item.changed_by.get_full_name }} {% endif %}
{{ item.created_at|date:"M d, Y H:i" }}
{% if item.type == 'status_change' %}
{% if item.item.from_status %} {{ item.item.from_status }} {% endif %} {{ item.item.to_status }}
{% elif item.type == 'note' %}

{{ item.item.note }}

{% endif %} {% if item.item.comment %}

{{ item.item.comment }}

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

{% trans "No timeline entries yet" %}

{% endif %}
{% include "partials/stage_timeline.html" with stage_timeline=stage_timeline %}

{% trans "Assignment" %}

{% trans "Department" %}
{{ observation.assigned_department.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.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 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 %} {% endif %} {% if can_respond_to_department %} {% endif %}
{% endif %} {% if px_action %}

{% trans "Linked PX Action" %}

{{ px_action.title|truncatewords:10 }}

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

{% trans "Root Cause Analyses" %}

{% endif %} {% if can_triage %}

{% trans "Triage" %}

{% csrf_token %}
{{ triage_form.assigned_department }}
{{ triage_form.assigned_to }}
{{ triage_form.status }}
{{ triage_form.note }}
{% endif %}

{% trans "Add Note" %}

{% csrf_token %}
{{ note_form.note }}

{% trans "Quick Status Change" %}

{% csrf_token %}
{{ status_form.status }}
{{ status_form.comment }}
{% if observation.status == 'resolved' or observation.status == 'closed' %} {% if can_triage %}

{% trans "Reopen Observation" %}

{% csrf_token %}
{% endif %} {% endif %} {% if can_send_to_department and not observation.department_responded_at %}
{% endif %} {% if can_convert %}

{% if observation.assigned_to %}{% trans "Reassign" %}{% else %}{% trans "Assign" %}{% endif %}

{% csrf_token %}
{% endif %} {% if can_delete %}

{% trans "Delete" %}

{% csrf_token %}
{% endif %}
{% include "components/send_to_modal.html" with users=assignable_users departments=departments %} {% endblock %}