HH/templates/organizations/department_observation_detail.html
ismail 7369d08012
All checks were successful
Build and Push Docker Image / build (push) Successful in 4m14s
feat: unified reference numbers + feedback modules QA audit
Reference numbers (unified scheme PREFIX-YYYYMM-HOSP-NNNN, e.g. CMP-202606-HHN-0001):
- new ReferenceSequence model + generate_reference() helper (apps/core)
- Complaint/Inquiry/Observation/Appreciation/Suggestion emit unified refs via save()
- prefix-based auto-routing in public track API (CMP/INQ/OBS trackable; APR/SGT internal-only)
- removed legacy CMP-/INQ- generators in ui_views, integrations, px_sources
- migrations: core.0003_referencesequence, appreciation.0006, feedback.0008, observations.0012
- unit tests (format, sanitization, monthly reset, 40-thread concurrency)

QA audit:
- isolated E2E hospital sandbox mirroring HH-N + 10 role users (create_e2e_isolated_env)
- feedback-modules-audit.spec.ts + audit helper (headed, run-to-completion)
- reports/feedback-modules-qa-report.md

Also bundles accumulated in-progress work across complaints, observations,
organizations, templates, and other modules.
2026-06-14 14:29:23 +03:00

143 lines
8.3 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% block title %}{{ observation.tracking_code }} - {{ department.get_localized_name }} - PX360{% endblock %}
{% block content %}
<div class="p-6 max-w-5xl mx-auto">
<div class="flex items-center gap-2 text-sm text-slate-500 mb-4">
<a href="{% url 'organizations:department_list' %}" class="hover:text-navy transition">{% trans "Departments" %}</a>
<i data-lucide="chevron-right" class="w-4 h-4"></i>
<a href="{% url 'organizations:department_detail' department.pk %}" class="hover:text-navy transition">{{ department.get_localized_name }}</a>
<i data-lucide="chevron-right" class="w-4 h-4"></i>
<a href="{% url 'organizations:department_observations_list' department.pk %}" class="hover:text-navy transition">{% trans "Observations" %}</a>
<i data-lucide="chevron-right" class="w-4 h-4"></i>
<span class="text-navy font-semibold">{{ observation.tracking_code }}</span>
</div>
<div class="flex items-center justify-between mb-2">
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-purple-50 rounded-xl flex items-center justify-center">
<i data-lucide="eye" class="w-5 h-5 text-purple-600"></i>
</div>
<div>
<div class="flex items-center gap-2">
<h1 class="text-xl font-bold text-navy">{{ observation.tracking_code }}</h1>
<span class="px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase bg-slate-50 text-slate-600">
{{ observation.get_status_display }}
</span>
{% if observation.severity %}
<span class="px-2.5 py-0.5 rounded-full text-[10px] font-bold uppercase
{% if observation.severity == 'critical' %}bg-gray-800 text-white
{% elif observation.severity == 'high' %}bg-red-50 text-red-700
{% elif observation.severity == 'medium' %}bg-amber-50 text-amber-700
{% else %}bg-green-50 text-green-700{% endif %}">
{{ observation.get_severity_display }}
</span>
{% endif %}
</div>
<p class="text-sm text-slate-500">{% trans "Observation" %}</p>
</div>
</div>
<div class="flex items-center gap-3">
{% if can_respond and not observation.department_responded_at %}
<button onclick="openDeptResponseModal('observation', '{{ observation.pk }}', '{% url 'observations:observation_department_response' pk=observation.pk %}', '{{ observation.tracking_code }}', '{% if observation.title %}{{ observation.title|escapejs }}{% else %}{{ observation.description|truncatewords:10|escapejs }}{% endif %}', '{{ observation.department_response_en|default:'' }}', '{{ observation.department_response_ar|default:'' }}')"
class="px-4 py-2 bg-navy text-white rounded-xl text-sm font-semibold hover:bg-blue transition flex items-center gap-2">
<i data-lucide="message-square" class="w-4 h-4"></i> {% trans "Respond" %}
</button>
{% endif %}
<a href="{% url 'organizations:department_observations_list' department.pk %}" class="text-sm text-slate hover:text-navy transition flex items-center gap-1">
<i data-lucide="arrow-left" class="w-4 h-4"></i> {% trans "Back to observations" %}
</a>
</div>
</div>
{% if observation.title %}
<h2 class="text-lg font-semibold text-navy mt-4 mb-6">{{ observation.title }}</h2>
{% endif %}
<div class="space-y-6 mt-6">
<div class="bg-white rounded-2xl border border-slate-200 p-6">
<h3 class="text-sm font-bold text-navy mb-3 flex items-center gap-2">
<i data-lucide="file-text" class="w-4 h-4"></i> {% trans "Description" %}
</h3>
<p class="text-sm text-slate-700 whitespace-pre-wrap leading-relaxed">{{ observation.description|default:"—" }}</p>
</div>
<div class="bg-white rounded-2xl border border-slate-200 p-6">
<h3 class="text-sm font-bold text-navy mb-4 flex items-center gap-2">
<i data-lucide="info" class="w-4 h-4"></i> {% trans "Details" %}
</h3>
<div class="grid grid-cols-2 md:grid-cols-3 gap-4">
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Assigned Department" %}</p>
<p class="text-sm font-medium text-navy">{{ observation.assigned_department.get_localized_name|default:"—" }}</p>
</div>
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Assigned To" %}</p>
<p class="text-sm font-medium text-navy">{{ observation.assigned_to.get_full_name|default:"—" }}</p>
</div>
{% if observation.category %}
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Category" %}</p>
<p class="text-sm font-medium text-navy">{{ observation.category.name }}</p>
</div>
{% endif %}
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Created" %}</p>
<p class="text-sm font-medium text-navy">{{ observation.created_at|date:"Y-m-d H:i" }}</p>
</div>
{% if observation.forwarded_to_dept_at %}
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Forwarded At" %}</p>
<p class="text-sm font-medium text-navy">{{ observation.forwarded_to_dept_at|date:"Y-m-d H:i" }}</p>
</div>
{% endif %}
{% if observation.dept_response_sla_due_at %}
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "SLA Deadline" %}</p>
<p class="text-sm font-medium {% if observation.dept_response_sla_due_at and observation.dept_response_sla_due_at < now %}text-red-600{% else %}text-navy{% endif %}">
{{ observation.dept_response_sla_due_at|date:"Y-m-d H:i" }}
</p>
</div>
{% endif %}
{% if observation.is_anonymous %}
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Reporter" %}</p>
<p class="text-sm text-slate-400 italic">{% trans "Anonymous" %}</p>
</div>
{% else %}
{% if observation.reporter_name %}
<div>
<p class="text-[10px] text-slate-400 uppercase font-bold mb-0.5">{% trans "Reporter" %}</p>
<p class="text-sm font-medium text-navy">{{ observation.reporter_name }}</p>
</div>
{% endif %}
{% endif %}
</div>
</div>
{% if observation.department_response_en or observation.department_response_ar %}
<div class="bg-green-50 rounded-2xl border border-green-100 p-6">
<h3 class="text-sm font-bold text-green-700 mb-3 flex items-center gap-2">
<i data-lucide="check-circle" class="w-4 h-4"></i> {% trans "Department Response" %}
{% if observation.department_responded_at %}
<span class="text-[10px] text-green-600 font-normal ml-2">{{ observation.department_responded_at|date:"Y-m-d H:i" }}</span>
{% endif %}
</h3>
{% if observation.department_response_en %}
<p class="text-sm text-slate-700 whitespace-pre-wrap mb-2">{{ observation.department_response_en }}</p>
{% endif %}
{% if observation.department_response_ar %}
<p class="text-sm text-slate-700 whitespace-pre-wrap" dir="rtl">{{ observation.department_response_ar }}</p>
{% endif %}
</div>
{% endif %}
{% include "partials/notes_panel.html" %}
</div>
</div>
{% include "components/department_response_modal.html" %}
{% endblock %}