{% extends "layouts/base.html" %} {% load i18n %} {% load survey_filters %} {% block title %}{{ department.get_localized_name }} - {% trans "Department" %} - PX360{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{% trans "Departments" %} {{ department.get_localized_name }}

{{ department.get_localized_name }}

{% if department.name_ar %}

{{ department.name_ar }}

{% endif %}
{{ department.code }} {% if department.category %} {% if department.category == 'nursing' %} {% elif department.category == 'support_services' %} {% elif department.category == 'medical' %} {% elif department.category == 'non_medical' %} {% endif %} {{ department.get_category_display }} {% endif %} {{ department.hospital.name }} {% if department.location %} {{ department.location }} {% endif %} {% if department.phone %} {{ department.phone }} {% endif %} {% if department.email %} {{ department.email }} {% endif %} {% if department.parent %} {% trans "Sub of" %} {{ department.parent.get_localized_name }} {% endif %}
{% if can_edit %} {% trans "Edit Department" %} {% endif %}

{% trans "Staff" %}

{{ stats.staff_count }}

{% trans "Open Complaints" %}

{{ stats.open_complaints }}

{{ stats.total_complaints }} {% trans "total" %}

{% trans "Pending Inquiries" %}

{{ stats.pending_inquiries }}

{{ stats.total_inquiries }} {% trans "total" %}

{% trans "Open Observations" %}

{{ stats.open_observations }}

{{ stats.total_observations }} {% trans "total" %}

{% if pending_actions and can_respond %}

{% trans "Pending Actions" %}

{{ pending_actions_count }} {% trans "items awaiting response" %}

{% for action in pending_actions %} {% endfor %}
{% trans "Type" %} {% trans "Reference" %} {% trans "Subject" %} {% trans "SLA Deadline" %} {% trans "Action" %}
{{ action.type_label }} {{ action.reference }} {{ action.subject|truncatechars:50 }} {% if action.sla_due_at %} {% if action.is_overdue %} {{ action.sla_due_at|date:"M d, H:i" }} {% else %} {{ action.sla_due_at|date:"M d, H:i" }} {% endif %} {% else %} - {% endif %}
{% if action.type == 'complaint_department_response' %} {% if action.explanation_url and action.explanation_url != '#' %} {% trans "Respond" %} {% else %} {% endif %} {% if action.routing_inv_id %} {% endif %} {% elif action.type == 'observation_response' %} {% elif action.type == 'inquiry_response' %} {% trans "Handle" %} {% else %} {% trans "Respond" %} {% endif %}
{% if pending_actions_has_more %}
{% trans "Showing 10 of" %} {{ pending_actions_count }} — {% trans "respond to items to see more" %}
{% endif %}
{% endif %} {% if dept_appreciations_count > 0 %}

{% trans "Appreciations Received" %}

{{ dept_appreciations_count }}
{% endif %} {% if can_respond and pending_routing_involvements %} {% for inv in pending_routing_involvements %} {% endfor %} {% endif %} {% if active_investigations and can_respond %}

{% trans "Active Investigations" %}

{{ active_investigations|length }} {% trans "investigation(s) in progress" %}

{% for inv in active_investigations %}

{{ inv.complaint.reference_number }}

{{ inv.complaint.title|truncatechars:60 }}

{{ inv.get_status_display }}
{{ inv.questions.count }} {% trans "questions" %} {% with answered=inv.responses.all|length %} {{ answered }} {% trans "staff" %} {% endwith %}
{% for resp in inv.responses.all %}
{% if resp.is_completed %} {{ resp.staff.get_full_name }} {{ resp.completed_at|date:"M d, H:i" }} {% else %} {{ resp.staff.get_full_name }} {% trans "Pending" %} {% endif %}
{% endfor %}
{% if inv.explanation.token %} {% if inv.status == 'answers_received' %} {% trans "Review & Submit Reply" %} {% else %} {% trans "View progress" %} {% endif %} {% endif %}
{% endfor %}
{% endif %} {% if my_pending_responses or my_assigned_complaints %}

{% trans "Action Required From You" %}

{% trans "Items assigned to you that need your response" %}

{% for resp in my_pending_responses %}
{{ resp.investigation.complaint.reference_number }}

{{ resp.investigation.complaint.title|truncatechars:60 }}

{% trans "Investigation" %}
{{ resp.investigation.questions.count }} {% trans "questions to answer" %} {% if resp.investigation.champion %} {{ resp.investigation.champion.get_full_name }} {% endif %}
{% trans "Answer Questions" %}
{% endfor %} {% for c in my_assigned_complaints %}
{{ c.reference_number }}

{{ c.title|truncatechars:60 }}

{% trans "Assigned to You" %}
{{ c.get_severity_display }} {% if c.is_overdue %} {% trans "Overdue" %} {% else %} {{ c.due_at|date:"M d, H:i" }} {% endif %}
{% trans "View Complaint" %}
{% endfor %}
{% endif %} {% if staff_head %}
{{ staff_head.first_name|truncatechars:1 }}{{ staff_head.last_name|truncatechars:1 }}
{{ staff_head.get_localized_name }} {% trans "Department Head" %}

{{ staff_head.get_localized_job_title }} · {{ staff_head.employee_id }}

{% endif %}
{% if can_manage_roles %} {% endif %}
{% if search_query or complaint_status_filter or inquiry_status_filter or observation_status_filter or suggestion_status_filter or appreciation_status_filter %} {% trans "Clear" %} {% endif %}
{% for s in staff_list %} {% empty %} {% endfor %}
{% trans "Name" %} {% trans "Job Title" %} {% trans "Employee ID" %} {{ department.get_category_display }} {% trans "User Account" %} {% trans "Complaints" %}
{{ s.first_name|truncatechars:1 }}{{ s.last_name|truncatechars:1 }}
{{ s.get_localized_name }} {% if s.is_head %} {% trans "HEAD" %} {% endif %}
{{ s.get_localized_job_title }} {{ s.employee_id }} {{ s.get_department_type_display }} {% if s.user %} {% for g in s.user.groups.all %} {{ g.name }} {% endfor %} {% else %} {% trans "No account" %} {% endif %} {% with count=staff_complaint_counts|get_item:s.pk %} {% if count %} {{ count }} {% else %} 0 {% endif %} {% endwith %}
{% trans "No staff members in this department" %}
{% if can_manage_roles %}

{% trans "Department Roles" %}

{% trans "Manage who receives complaints, inquiries, and observations for this department." %}

{% for role in role_data %}

{{ role.label }}

{% if role.field == 'champion' %} {% trans "Primary Contact" %} {% endif %}
{% if role.staff %}
{{ role.staff.get_full_name|first|upper }}

{{ role.staff.get_full_name }}

{{ role.staff.email|default:"No email" }}

{% else %}
{% trans "Not assigned" %}
{% endif %}
{% if can_manage_roles %}
{% endif %}
{% endfor %}
{% endif %}

{% trans "Department Sections" %}

{% trans "Add Section" %}
{% for sec in org_sections %} {% empty %} {% endfor %}
{% trans "Section Name" %} {% trans "Location" %} {% trans "Champion" %} {% trans "Supervisor" %} {% trans "Deputy" %} {% trans "Sub-Sections" %} {% trans "Status" %} {% trans "Actions" %}
{{ sec.name_en }} {% if sec.name_ar %}
{{ sec.name_ar }}{% endif %}
{{ sec.location_type|default:"-" }}{% if sec.sub_location %} / {{ sec.sub_location }}{% endif %} {{ sec.champion.get_full_name|default:"-" }} {{ sec.supervisor.get_full_name|default:"-" }} {{ sec.deputy_supervisor.get_full_name|default:"-" }} {{ sec.subsections.count }} {% if sec.status == 'active' %} {% trans "Active" %} {% else %} {% trans "Inactive" %} {% endif %}
{% trans "No sections in this department" %}
{% for c in complaints %} {% empty %} {% endfor %}
{% trans "Reference" %} {% trans "Classification" %} {% trans "Staff" %} {% trans "Patient" %} {% trans "Assigned To" %} {% trans "Status" %} {% trans "Created" %}
{{ c.reference_number }}
{% if c.domain %}{{ c.domain.get_localized_name }}{% endif %} {% if c.category %}{{ c.category.get_localized_name }}{% endif %} {% if c.subcategory_obj %}{{ c.subcategory_obj.get_localized_name }}{% endif %} {% if c.classification_obj %}{{ c.classification_obj.get_localized_name }}{% endif %} {% if not c.domain and not c.category and not c.subcategory_obj and not c.classification_obj %}-{% endif %}
{% if c.involved_staff.all %} {% for inv in c.involved_staff.all %}
{{ inv.staff.get_localized_name }}
{% endfor %} {% elif c.staff %}
{{ c.staff.get_localized_name }}
{% else %} - {% endif %}
{{ c.patient.mrn|default:"-" }} {{ c.assigned_to.get_full_name|default:"-" }} {{ c.get_status_display }} {{ c.created_at|date:"Y-m-d" }}
{% trans "No complaints for this department" %}
{% if stats.total_complaints > 0 %} {% endif %}
{% for i in inquiries %} {% empty %} {% endfor %}
{% trans "Reference" %} {% trans "Subject" %} {% trans "Contact" %} {% trans "Department" %} {% trans "Outgoing Dept" %} {% trans "Assigned To" %} {% trans "Status" %} {% trans "Created" %} {% trans "Actions" %}
{{ i.reference_number }} {{ i.subject }} {{ i.contact_name|default:"-" }} {{ i.department.name|default:"-" }} {{ i.outgoing_department.name|default:"-" }} {{ i.assigned_to.get_full_name|default:"-" }} {{ i.get_status_display }} {% if i.contact_status == 'contacted_no_response' %} {% trans "No Response" %} {% elif i.contact_status == 'contacted' %} {% trans "Contacted" %} {% endif %} {{ i.created_at|date:"Y-m-d" }}
{% trans "View" %} {% if can_respond and i.handling_department_id == department.pk and i.status in 'open,in_progress' %} {% trans "Handle" %} {% endif %}
{% trans "No inquiries for this department" %}
{% if stats.total_inquiries > 0 %} {% endif %}
{% for o in observations %} {% empty %} {% endfor %}
{% trans "Tracking Code" %} {% trans "Title" %} {% trans "Severity" %} {% trans "Assigned To" %} {% trans "Status" %} {% trans "Created" %} {% trans "Actions" %}
{{ o.tracking_code }} {{ o.title|default:"-" }} {{ o.get_severity_display }} {{ o.assigned_to.get_full_name|default:"-" }} {{ o.get_status_display }} {{ o.created_at|date:"Y-m-d" }}
{% trans "View" %} {% if can_respond and not o.department_responded_at %} {% trans "Respond" %} {% endif %}
{% trans "No observations for this department" %}
{% if stats.total_observations > 0 %} {% endif %}
{% for s in suggestions %} {% empty %} {% endfor %}
{% trans "Reference" %} {% trans "Title" %} {% trans "Priority" %} {% trans "Category" %} {% trans "Contact" %} {% trans "Assigned To" %} {% trans "Status" %} {% trans "Created" %}
{{ s.pk|truncatechars:8 }} {{ s.title|default:"-" }} {{ s.get_priority_display }} {{ s.get_category_display|default:"-" }} {% if s.is_anonymous %} {% trans "Anonymous" %} {% else %} {{ s.contact_name|default:"-" }} {% endif %} {{ s.assigned_to.get_full_name|default:"-" }} {{ s.get_status_display }} {{ s.created_at|date:"Y-m-d" }}
{% trans "No suggestions for this department" %}
{% for a in appreciations %} {% empty %} {% endfor %}
{% trans "Reference" %} {% trans "Category" %} {% trans "Sender" %} {% trans "Recipient" %} {% trans "Status" %} {% trans "Sent" %} {% trans "Created" %}
{{ a.pk|truncatechars:8 }} {% if a.category %} {{ a.category.name_en }} {% else %} - {% endif %} {% if a.is_anonymous %} {% trans "Anonymous" %} {% elif a.sender %} {{ a.sender.get_full_name }} {% else %} - {% endif %} {{ a.get_recipient_name|default:"-" }} {{ a.get_status_display }} {{ a.sent_at|date:"Y-m-d"|default:"-" }} {{ a.created_at|date:"Y-m-d" }}
{% trans "No appreciations for this department" %}

{% trans "Loading analytics..." %}

{% for item in standards_data %} {% empty %} {% endfor %}
{% trans "Code" %} {% trans "Title" %} {% trans "Activity Type" %} {% trans "Status" %} {% trans "Evidence" %}
{{ item.standard.code }} {{ item.standard.title }} {% if item.standard.activity_type %} {{ item.standard.activity_type.name }} {% else %} - {% endif %} {% if not item.standard.is_assessable or item.standard.is_heading %} {% trans "Informational" %} {% else %} {% endif %} {% if not item.standard.is_assessable or item.standard.is_heading %} - {% else %} {% endif %}
{% trans "No standards for this department" %}
{% for p in projects %} {% empty %} {% endfor %}
{% trans "Project" %} {% trans "Status" %} {% trans "Lead" %} {% trans "Team" %} {% trans "Created" %}
{{ p.name }} {{ p.get_status_display }} {{ p.project_lead.get_full_name|default:"-" }} {{ p.team_members.all|length }} {{ p.created_at|date:"Y-m-d" }}
{% trans "No projects for this department" %}
{% if stats.total_projects > 0 %} {% endif %}
{% include "components/department_response_modal.html" %} {% endblock %}