HH/templates/complaints/adverse_action_list.html
2026-02-22 08:35:53 +03:00

189 lines
11 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% block title %}{% trans "Complaint Adverse Actions" %} - PX360{% endblock %}
{% block content %}
<div class="p-6">
<!-- Header -->
<div class="mb-6">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl font-bold text-[#005696]">{% trans "Complaint Adverse Actions" %}</h1>
<p class="text-[#64748b] mt-1">{% trans "Track and manage adverse actions or damages to patients related to complaints" %}</p>
</div>
<a href="{% url 'complaints:complaint_list' %}" class="px-4 py-2 border border-gray-200 rounded-lg text-gray-600 hover:bg-gray-50 transition flex items-center gap-2">
<i data-lucide="arrow-left" class="w-4 h-4"></i>
{% trans "Back to Complaints" %}
</a>
</div>
</div>
<!-- Filters -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-4 mb-6">
<form method="get" class="flex flex-wrap gap-4">
<div class="flex-1 min-w-[200px]">
<input type="text" name="search" value="{{ filters.search|default:'' }}"
class="w-full px-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#005696] focus:border-transparent"
placeholder="{% trans 'Search by reference or description...' %}">
</div>
<div>
<select name="status" class="px-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#005696] focus:border-transparent">
<option value="">{% trans "All Statuses" %}</option>
{% for value, label in status_choices %}
<option value="{{ value }}" {% if filters.status == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
<div>
<select name="severity" class="px-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#005696] focus:border-transparent">
<option value="">{% trans "All Severities" %}</option>
{% for value, label in severity_choices %}
<option value="{{ value }}" {% if filters.severity == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
<div>
<select name="action_type" class="px-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#005696] focus:border-transparent">
<option value="">{% trans "All Types" %}</option>
{% for value, label in action_type_choices %}
<option value="{{ value }}" {% if filters.action_type == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
<button type="submit" class="px-4 py-2 bg-[#005696] text-white rounded-lg hover:bg-[#007bbd] transition flex items-center gap-2">
<i data-lucide="filter" class="w-4 h-4"></i>
{% trans "Filter" %}
</button>
</form>
</div>
<!-- Adverse Actions Table -->
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-[#64748b] uppercase">{% trans "Complaint" %}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-[#64748b] uppercase">{% trans "Type" %}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-[#64748b] uppercase">{% trans "Severity" %}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-[#64748b] uppercase">{% trans "Date" %}</th>
<th class="px-6 py-3 text-left text-xs font-medium text-[#64748b] uppercase">{% trans "Status" %}</th>
<th class="px-6 py-3 text-center text-xs font-medium text-[#64748b] uppercase">{% trans "Escalated" %}</th>
<th class="px-6 py-3 text-right text-xs font-medium text-[#64748b] uppercase">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
{% for action in page_obj %}
<tr class="hover:bg-gray-50">
<td class="px-6 py-4">
<a href="{% url 'complaints:complaint_detail' action.complaint.id %}" class="font-medium text-[#005696] hover:text-[#007bbd]">
{{ action.complaint.reference_number }}
</a>
<p class="text-sm text-[#64748b] truncate max-w-[200px]">{{ action.complaint.title }}</p>
</td>
<td class="px-6 py-4">
<span class="text-sm text-gray-900">{{ action.get_action_type_display }}</span>
</td>
<td class="px-6 py-4">
{% if action.severity == 'critical' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
{{ action.get_severity_display }}
</span>
{% elif action.severity == 'high' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-orange-100 text-orange-800">
{{ action.get_severity_display }}
</span>
{% elif action.severity == 'medium' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
{{ action.get_severity_display }}
</span>
{% else %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
{{ action.get_severity_display }}
</span>
{% endif %}
</td>
<td class="px-6 py-4 text-sm text-gray-900">
{{ action.incident_date|date:"Y-m-d" }}
</td>
<td class="px-6 py-4">
{% if action.status == 'reported' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800">
{{ action.get_status_display }}
</span>
{% elif action.status == 'under_investigation' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
{{ action.get_status_display }}
</span>
{% elif action.status == 'verified' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
{{ action.get_status_display }}
</span>
{% elif action.status == 'resolved' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
{{ action.get_status_display }}
</span>
{% else %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600">
{{ action.get_status_display }}
</span>
{% endif %}
</td>
<td class="px-6 py-4 text-center">
{% if action.is_escalated %}
<i data-lucide="alert-triangle" class="w-5 h-5 text-red-500 mx-auto"></i>
{% else %}
<span class="text-gray-300">-</span>
{% endif %}
</td>
<td class="px-6 py-4 text-right">
<a href="{% url 'complaints:complaint_detail' action.complaint.id %}" class="text-[#005696] hover:text-[#007bbd] font-medium text-sm">
{% trans "View" %}
</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="7" class="px-6 py-8 text-center text-[#64748b]">
<i data-lucide="shield-check" class="w-12 h-12 mx-auto mb-3 text-gray-300"></i>
<p>{% trans "No adverse actions found." %}</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if page_obj.has_other_pages %}
<div class="px-6 py-4 border-t border-gray-100 flex items-center justify-between">
<p class="text-sm text-[#64748b]">
{% blocktrans with page_obj.number as page and page_obj.paginator.num_pages as total %}
Page {{ page }} of {{ total }}
{% endblocktrans %}
</p>
<div class="flex gap-2">
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}&{{ filters.urlencode }}" class="px-3 py-1 border border-gray-200 rounded hover:bg-gray-50">
<i data-lucide="chevron-left" class="w-4 h-4"></i>
</a>
{% endif %}
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}&{{ filters.urlencode }}" class="px-3 py-1 border border-gray-200 rounded hover:bg-gray-50">
<i data-lucide="chevron-right" class="w-4 h-4"></i>
</a>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
lucide.createIcons();
});
</script>
{% endblock %}