{% extends 'layouts/base.html' %} {% load i18n %} {% block title %}{% trans "Inquiry" %} #{{ inquiry.reference_number|truncatechars:15 }} - PX360{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{% if source_user %} {% trans "My Inquiries" %} {% else %} {% trans "Inquiries" %} {% endif %} {{ inquiry.reference_number }} {{ inquiry.get_status_display }} {% if inquiry.priority %} {{ inquiry.get_priority_display }} {% endif %} {% if not inquiry.sent_to_department %} {% trans "Not Sent to Dept" %} {% endif %}

{{ inquiry.subject }}

{{ inquiry.created_at|date:"Y-m-d" }} {% if can_respond %} {% endif %}

{{ inquiry.message|linebreaks }}

{% if inquiry.short_description_en or inquiry.emotion %}
{% trans "AI Analysis" %}
{% if can_respond and not inquiry.short_description_en %} {% endif %}
{% if inquiry.emotion and inquiry.emotion != 'neutral' %}
{{ inquiry.get_emotion_display }} {% trans "Confidence" %}: {{ inquiry.emotion_confidence_percent|floatformat:0 }}% · {% trans "Intensity" %}: {{ inquiry.emotion_intensity|floatformat:2 }}/1.0
{% endif %}
{% if inquiry.short_description_en %}

{{ inquiry.short_description_en }}

{% if inquiry.short_description_ar %}

{{ inquiry.short_description_ar }}

{% endif %} {% else %}

{% trans "AI analysis is running. Please refresh the page shortly." %}

{% endif %}
{% endif %}
{% if inquiry.outgoing_department %}

{% blocktrans with dept=inquiry.outgoing_department.get_localized_name %}Response from {{ dept }}{% endblocktrans %}

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

English

{{ inquiry.department_response_en|linebreaks }}

{% endif %} {% if inquiry.department_response_ar %}

العربية

{{ inquiry.department_response_ar|linebreaks }}

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

{{ inquiry.department_response_summary_en }}

{% if inquiry.department_response_summary_ar %}

{{ inquiry.department_response_summary_ar }}

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

{{ inquiry.dept_response_acceptance_notes }}

{% endif %}
{% else %}

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

{% if inquiry.dept_response_sla_due_at %}

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

{% endif %} {% if can_respond %} {% endif %}
{% if can_send_reminder %}
{% csrf_token %}
{% if inquiry.dept_response_reminder_sent_at %}
{% csrf_token %}
{% endif %}
{% endif %} {% endif %}
{% endif %} {% if inquiry.response %}

{% trans "Response" %} {% if inquiry.response_sent_at %} {% trans "Sent to inquirer" %} {% endif %}

{% if inquiry.responded_by %}{{ inquiry.responded_by.get_full_name|default:inquiry.responded_by.email }}{% endif %} {% if inquiry.response_sent_at %}{{ inquiry.response_sent_at|date:"Y-m-d H:i" }}{% else %}{{ inquiry.responded_at|date:"Y-m-d H:i" }}{% endif %}
{% if inquiry.response_en %}

English

{{ inquiry.response_en|linebreaks }}

{% endif %} {% if inquiry.response_ar %}

العربية

{{ inquiry.response_ar|linebreaks }}

{% endif %} {% if not inquiry.response_en and not inquiry.response_ar %}

{{ inquiry.response|linebreaks }}

{% endif %}
{% endif %}

{% trans "Quick Actions" %}

{% if inquiry.status == 'open' and not inquiry.activated_at %} {% if can_edit %}
{% csrf_token %}
{% csrf_token %}
{% else %}

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

{% endif %} {% else %} {% if can_respond %} {% endif %} {% if inquiry.status == 'resolved' or inquiry.status == 'closed' %} {% if can_respond %}
{% csrf_token %}
{% endif %} {% endif %} {% if can_respond %} {% endif %} {% if can_edit and inquiry.status != 'closed' %} {% endif %} {% if can_edit and inquiry.status != 'closed' %} {% trans "Edit" %} {% endif %} {% if can_admin %} {% trans "RCA" %} {% trans "QI Project" %} {% endif %} {% if can_respond %} {% endif %} {% if can_edit and inquiry.status != 'closed' and inquiry.status != 'cancelled' %} {% endif %} {% endif %}
{% if can_edit and inquiry.status != 'closed' %} {% endif %} {% if inquiry.status == 'resolved' or inquiry.status == 'closed' %}

{% trans "Satisfaction" %}

{% if inquiry.satisfaction %}
{{ inquiry.get_satisfaction_display }}
{% endif %}
{% csrf_token %}
{% endif %}
{% include "components/send_to_modal.html" with users=send_to_users departments=hospital_departments %} {% include "components/department_response_modal.html" %} {% endblock %}