All checks were successful
Build and Push Docker Image / build (push) Successful in 4m14s
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.
172 lines
11 KiB
HTML
172 lines
11 KiB
HTML
{% extends "layouts/base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{{ department.get_localized_name }} - {% trans "Observations" %} - PX360{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="p-6">
|
|
<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>
|
|
<span class="text-navy font-semibold">{% trans "Observations" %}</span>
|
|
</div>
|
|
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-navy">{% trans "Department Observations" %}</h1>
|
|
<p class="text-sm text-slate mt-1">{{ department.get_localized_name }} · {{ department.hospital.name }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="get" class="bg-white rounded-t-2xl border border-slate-200 border-b-0 px-4 py-3">
|
|
<div class="flex flex-wrap items-center gap-3">
|
|
<div class="relative flex-1 min-w-[200px]">
|
|
<i data-lucide="search" class="w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"></i>
|
|
<input type="text" name="search" value="{{ search_query|default:'' }}" placeholder="{% trans 'Search observations...' %}"
|
|
class="pl-9 pr-4 py-2 w-full border border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-navy/20 outline-none">
|
|
</div>
|
|
<select name="status" onchange="this.form.submit()"
|
|
class="px-3 py-2 border border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-navy/20 outline-none">
|
|
<option value="">{% trans "All Statuses" %}</option>
|
|
<option value="new" {% if status_filter == 'new' %}selected{% endif %}>{% trans "New" %}</option>
|
|
<option value="triaged" {% if status_filter == 'triaged' %}selected{% endif %}>{% trans "Triaged" %}</option>
|
|
<option value="in_progress" {% if status_filter == 'in_progress' %}selected{% endif %}>{% trans "In Progress" %}</option>
|
|
<option value="resolved" {% if status_filter == 'resolved' %}selected{% endif %}>{% trans "Resolved" %}</option>
|
|
<option value="closed" {% if status_filter == 'closed' %}selected{% endif %}>{% trans "Closed" %}</option>
|
|
</select>
|
|
<select name="severity" onchange="this.form.submit()"
|
|
class="px-3 py-2 border border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-navy/20 outline-none">
|
|
<option value="">{% trans "All Severities" %}</option>
|
|
<option value="low" {% if severity_filter == 'low' %}selected{% endif %}>{% trans "Low" %}</option>
|
|
<option value="medium" {% if severity_filter == 'medium' %}selected{% endif %}>{% trans "Medium" %}</option>
|
|
<option value="high" {% if severity_filter == 'high' %}selected{% endif %}>{% trans "High" %}</option>
|
|
<option value="critical" {% if severity_filter == 'critical' %}selected{% endif %}>{% trans "Critical" %}</option>
|
|
</select>
|
|
<input type="date" name="date_from" value="{{ date_from }}" placeholder="{% trans 'From' %}"
|
|
class="px-3 py-2 border border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-navy/20 outline-none">
|
|
<input type="date" name="date_to" value="{{ date_to }}" placeholder="{% trans 'To' %}"
|
|
class="px-3 py-2 border border-slate-200 rounded-lg text-sm focus:ring-2 focus:ring-navy/20 outline-none">
|
|
<button type="submit" class="px-3 py-2 bg-navy text-white rounded-lg text-sm font-semibold hover:bg-blue transition">
|
|
<i data-lucide="filter" class="w-3 h-3 inline"></i> {% trans "Filter" %}
|
|
</button>
|
|
{% if search_query or status_filter or severity_filter or date_from or date_to %}
|
|
<a href="?" class="text-xs text-slate-400 hover:text-red-500 transition font-semibold">
|
|
<i data-lucide="x" class="w-3 h-3 inline"></i> {% trans "Clear" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
|
|
{% include "partials/list_stats_bar.html" %}
|
|
|
|
<div class="bg-white border-x border-slate-200">
|
|
<table class="w-full">
|
|
<thead class="bg-slate-50 border-b">
|
|
<tr>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Tracking Code" %}</th>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Title" %}</th>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Severity" %}</th>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Assigned To" %}</th>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Status" %}</th>
|
|
<th class="px-4 py-3 text-center text-[10px] font-bold text-slate uppercase">{% trans "Response SLA" %}</th>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Created" %}</th>
|
|
<th class="px-4 py-3 text-left text-[10px] font-bold text-slate uppercase">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
{% for o in observations %}
|
|
<tr class="hover:bg-slate-50 transition border-l-3 border-transparent hover:border-navy">
|
|
<td class="px-4 py-3 text-sm font-mono text-navy">{{ o.tracking_code }}</td>
|
|
<td class="px-4 py-3 text-sm text-slate-700 max-w-xs truncate">{{ o.title|default:"-" }}</td>
|
|
<td class="px-4 py-3">
|
|
<span class="px-2 py-1 rounded-full text-[10px] font-bold uppercase
|
|
{% if o.severity == 'critical' %}bg-gray-800 text-white
|
|
{% elif o.severity == 'high' %}bg-red-50 text-red-700
|
|
{% elif o.severity == 'medium' %}bg-amber-50 text-amber-700
|
|
{% else %}bg-green-50 text-green-700{% endif %}">
|
|
{{ o.get_severity_display }}
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-3 text-sm text-slate">{{ o.assigned_to.get_full_name|default:"-" }}</td>
|
|
<td class="px-4 py-3">
|
|
<span class="px-2 py-1 rounded-full text-[10px] font-bold uppercase bg-slate-50 text-slate-600">
|
|
{{ o.get_status_display }}
|
|
</span>
|
|
</td>
|
|
<td class="px-4 py-3 text-center">
|
|
{% if o.dept_response_sla_due_at and not o.department_responded_at %}
|
|
<span class="sla-timer text-[10px] font-bold" data-due-at="{{ o.dept_response_sla_due_at|date:'c' }}" data-overdue="{{ o.dept_response_is_overdue|yesno:'true,false' }}"></span>
|
|
{% elif o.dept_response_is_overdue %}
|
|
<span class="text-[10px] font-bold text-red-600">{% trans "Overdue" %}</span>
|
|
{% elif o.department_responded_at %}
|
|
<span class="text-[10px] text-green-600 font-semibold">✓</span>
|
|
{% else %}
|
|
<span class="text-[10px] text-slate-400">-</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="px-4 py-3 text-xs text-slate">{{ o.created_at|date:"Y-m-d" }}</td>
|
|
<td class="px-4 py-3">
|
|
<a href="{% url 'organizations:department_observation_detail' department.pk o.pk %}" class="text-xs text-navy font-semibold hover:underline">{% trans "View" %}</a>
|
|
{% if can_respond and not o.department_responded_at %}
|
|
<a href="#" onclick="return openDeptResponseModal('observation', '{{ o.pk }}', '{% url 'observations:observation_department_response' pk=o.pk %}', '{{ o.tracking_code }}', '{% if o.title %}{{ o.title|escapejs }}{% else %}{{ o.description|truncatewords:10|escapejs }}{% endif %}', '{{ o.department_response_en|default:'' }}', '{{ o.department_response_ar|default:'' }}')" class="text-xs text-green-600 font-semibold hover:underline ml-2">{% trans "Respond" %}</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr><td colspan="8" class="px-4 py-12 text-center text-slate">{% trans "No observations found" %}</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% include "partials/pagination.html" %}
|
|
|
|
{% include "components/department_response_modal.html" %}
|
|
</div>
|
|
|
|
<script>
|
|
(function() {
|
|
var timers = document.querySelectorAll('.sla-timer');
|
|
if (!timers.length) return;
|
|
function updateTimers() {
|
|
var now = Date.now();
|
|
timers.forEach(function(el) {
|
|
var dueAt = new Date(el.dataset.dueAt).getTime();
|
|
var diff = dueAt - now;
|
|
if (diff <= 0) {
|
|
var overMs = Math.abs(diff);
|
|
var overD = Math.floor(overMs / 86400000);
|
|
var overH = Math.floor((overMs % 86400000) / 3600000);
|
|
var overM = Math.floor((overMs % 3600000) / 60000);
|
|
var txt = '{% trans "Overdue" %} ';
|
|
if (overD > 0) txt += overD + 'd ';
|
|
txt += overH + 'h ' + overM + 'm';
|
|
el.textContent = txt;
|
|
el.className = 'sla-timer text-[10px] font-bold text-red-600';
|
|
return;
|
|
}
|
|
var d = Math.floor(diff / 86400000);
|
|
var h = Math.floor((diff % 86400000) / 3600000);
|
|
var m = Math.floor((diff % 3600000) / 60000);
|
|
var parts = [];
|
|
if (d > 0) parts.push(d + 'd');
|
|
parts.push(h + 'h');
|
|
parts.push(m + 'm');
|
|
el.textContent = parts.join(' ');
|
|
if (diff < 21600000) {
|
|
el.className = 'sla-timer text-[10px] font-bold text-red-600';
|
|
} else if (diff < 86400000) {
|
|
el.className = 'sla-timer text-[10px] font-bold text-orange-600';
|
|
} else {
|
|
el.className = 'sla-timer text-[10px] font-bold text-green-600';
|
|
}
|
|
});
|
|
}
|
|
updateTimers();
|
|
setInterval(updateTimers, 60000);
|
|
})();
|
|
</script>
|
|
{% endblock %}
|