HH/templates/callcenter/complaint_list.html
2026-03-09 16:10:24 +03:00

237 lines
13 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Complaints" %} - {% trans "Call Center" %} - PX360{% endblock %}
{% block extra_css %}
<style>
.badge-status-open { background: #e0f2fe; color: #075985; }
.badge-status-in_progress { background: #fef9c3; color: #854d0e; }
.badge-status-resolved { background: #dcfce7; color: #166534; }
.badge-status-closed { background: #f3f4f6; color: #6b7280; }
.badge-severity-critical { background: #fee2e2; color: #991b1b; }
.badge-severity-high { background: #ffedd5; color: #9a3412; }
.badge-severity-medium { background: #fef9c3; color: #854d0e; }
.badge-severity-low { background: #dcfce7; color: #166534; }
</style>
{% endblock %}
{% block content %}
<!-- Header -->
<header class="mb-6">
<div class="flex justify-between items-start">
<div>
<h1 class="text-2xl font-bold text-navy flex items-center gap-3">
<i data-lucide="phone" class="w-7 h-7 text-blue"></i>
{% trans "Call Center Complaints" %}
</h1>
<p class="text-sm text-slate mt-1">{% trans "Complaints created via call center" %}</p>
</div>
<a href="{% url 'callcenter:create_complaint' %}" class="bg-navy text-white px-5 py-2.5 rounded-xl text-sm font-bold shadow-lg shadow-navy/20 hover:bg-blue flex items-center gap-2 transition">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Create Complaint" %}
</a>
</div>
</header>
<!-- Statistics -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
<div class="bg-blue-500 text-white p-5 rounded-2xl shadow-sm">
<div class="flex justify-between items-center">
<div>
<p class="text-blue-100 text-xs font-bold uppercase tracking-wider mb-1">{% trans "Total Complaints" %}</p>
<p class="text-2xl font-black">{{ stats.total }}</p>
</div>
<i data-lucide="file-text" class="w-8 h-8 opacity-50"></i>
</div>
</div>
<div class="bg-cyan-500 text-white p-5 rounded-2xl shadow-sm">
<div class="flex justify-between items-center">
<div>
<p class="text-cyan-100 text-xs font-bold uppercase tracking-wider mb-1">{% trans "Open" %}</p>
<p class="text-2xl font-black">{{ stats.open }}</p>
</div>
<i data-lucide="inbox" class="w-8 h-8 opacity-50"></i>
</div>
</div>
<div class="bg-amber-500 text-white p-5 rounded-2xl shadow-sm">
<div class="flex justify-between items-center">
<div>
<p class="text-amber-100 text-xs font-bold uppercase tracking-wider mb-1">{% trans "In Progress" %}</p>
<p class="text-2xl font-black">{{ stats.in_progress }}</p>
</div>
<i data-lucide="clock" class="w-8 h-8 opacity-50"></i>
</div>
</div>
<div class="bg-emerald-500 text-white p-5 rounded-2xl shadow-sm">
<div class="flex justify-between items-center">
<div>
<p class="text-emerald-100 text-xs font-bold uppercase tracking-wider mb-1">{% trans "Resolved" %}</p>
<p class="text-2xl font-black">{{ stats.resolved }}</p>
</div>
<i data-lucide="check-circle" class="w-8 h-8 opacity-50"></i>
</div>
</div>
</div>
<!-- Filters -->
<div class="bg-white rounded-2xl shadow-sm border-2 border-slate-200 mb-6">
<div class="px-6 py-4 border-b-2 border-slate-200 flex justify-between items-center bg-gradient-to-r from-slate-50 to-slate-100">
<h3 class="font-bold text-navy flex items-center gap-2">
<i data-lucide="filter" class="w-5 h-5 text-navy"></i>
{% trans "Filters" %}
</h3>
</div>
<div class="p-5">
<form method="get" class="grid grid-cols-1 md:grid-cols-5 gap-4">
<div class="md:col-span-1">
<label class="block text-xs font-bold text-slate uppercase mb-2">{% trans "Search" %}</label>
<input type="text" name="search"
class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy focus:border-transparent transition"
placeholder="{% trans 'Search...' %}" value="{{ filters.search }}">
</div>
<div>
<label class="block text-xs font-bold text-slate uppercase mb-2">{% trans "Status" %}</label>
<select name="status" class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy focus:border-transparent transition">
<option value="">{% trans "All" %}</option>
<option value="open" {% if filters.status == 'open' %}selected{% endif %}>{% trans "Open" %}</option>
<option value="in_progress" {% if filters.status == 'in_progress' %}selected{% endif %}>{% trans "In Progress" %}</option>
<option value="resolved" {% if filters.status == 'resolved' %}selected{% endif %}>{% trans "Resolved" %}</option>
<option value="closed" {% if filters.status == 'closed' %}selected{% endif %}>{% trans "Closed" %}</option>
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate uppercase mb-2">{% trans "Severity" %}</label>
<select name="severity" class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy focus:border-transparent transition">
<option value="">{% trans "All" %}</option>
<option value="critical" {% if filters.severity == 'critical' %}selected{% endif %}>{% trans "Critical" %}</option>
<option value="high" {% if filters.severity == 'high' %}selected{% endif %}>{% trans "High" %}</option>
<option value="medium" {% if filters.severity == 'medium' %}selected{% endif %}>{% trans "Medium" %}</option>
<option value="low" {% if filters.severity == 'low' %}selected{% endif %}>{% trans "Low" %}</option>
</select>
</div>
<div>
<label class="block text-xs font-bold text-slate uppercase mb-2">{% trans "Hospital" %}</label>
<select name="hospital" class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy focus:border-transparent transition">
<option value="">{% trans "All" %}</option>
{% for hospital in hospitals %}
<option value="{{ hospital.id }}" {% if filters.hospital == hospital.id|stringformat:"s" %}selected{% endif %}>
{{ hospital.name_en }}
</option>
{% endfor %}
</select>
</div>
<div class="flex items-end">
<button type="submit" class="w-full bg-navy text-white px-4 py-2.5 rounded-xl text-sm font-bold hover:bg-blue transition flex items-center justify-center gap-2">
<i data-lucide="filter" class="w-4 h-4"></i> {% trans "Filter" %}
</button>
</div>
</form>
</div>
</div>
<!-- Complaints Table -->
<div class="bg-white rounded-2xl shadow-sm border-2 border-slate-200 overflow-hidden">
<div class="px-6 py-4 border-b-2 border-slate-200 bg-gradient-to-r from-slate-50 to-slate-100 flex justify-between items-center">
<h3 class="font-bold text-navy flex items-center gap-2">
<i data-lucide="message-square-warning" class="w-5 h-5 text-red-500"></i>
{% trans "Complaints" %}
</h3>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "ID" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Title" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Patient" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Hospital" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Category" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Severity" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Status" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Created" %}</th>
<th class="px-6 py-4 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
{% for complaint in complaints %}
<tr class="hover:bg-gray-50 transition">
<td class="px-6 py-4">
<small class="text-gray-400">#{{ complaint.id|slice:":8" }}</small>
</td>
<td class="px-6 py-4">
<strong class="text-gray-800">{{ complaint.title|truncatewords:8 }}</strong>
</td>
<td class="px-6 py-4">
{% if complaint.patient %}
<span class="text-gray-800">{{ complaint.patient.get_full_name }}</span><br>
<small class="text-gray-400">MRN: {{ complaint.patient.mrn }}</small>
{% else %}
<span class="text-gray-400">{% trans "N/A" %}</span>
{% endif %}
</td>
<td class="px-6 py-4 text-gray-600">{{ complaint.hospital.name_en }}</td>
<td class="px-6 py-4">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold bg-slate-100 text-slate">
{{ complaint.get_category_display }}
</span>
</td>
<td class="px-6 py-4">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold badge-severity-{{ complaint.severity }}">
{{ complaint.get_severity_display }}
</span>
</td>
<td class="px-6 py-4">
<span class="inline-flex items-center px-2.5 py-1 rounded-lg text-xs font-bold badge-status-{{ complaint.status }}">
{{ complaint.get_status_display }}
</span>
</td>
<td class="px-6 py-4">
<small class="text-gray-500">{{ complaint.created_at|date:"Y-m-d H:i" }}</small>
</td>
<td class="px-6 py-4">
<a href="{% url 'complaints:complaint_detail' complaint.id %}"
class="inline-flex items-center gap-1 px-3 py-2 text-navy bg-light rounded-lg hover:bg-light transition font-medium text-sm">
<i data-lucide="eye" class="w-4 h-4"></i>
</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="9" class="text-center py-8 text-gray-500">
<i data-lucide="inbox" class="w-12 h-12 mx-auto mb-3 text-gray-300"></i>
<p>{% trans "No complaints 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 justify-center">
<div class="flex items-center gap-2">
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}"
class="px-3 py-2 rounded-lg border border-slate-200 text-slate hover:bg-light transition">
{% trans "Previous" %}
</a>
{% endif %}
<span class="px-4 py-2 rounded-lg bg-navy text-white text-sm font-bold">
{% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ page_obj.paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}"
class="px-3 py-2 rounded-lg border border-slate-200 text-slate hover:bg-light transition">
{% trans "Next" %}
</a>
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endblock %}