269 lines
17 KiB
HTML
269 lines
17 KiB
HTML
{% extends "layouts/source_user_base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "My Complaints" %} - {{ source.name_en }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="p-6">
|
|
<!-- Page Header -->
|
|
<div class="flex flex-wrap justify-between items-center gap-4 mb-6">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-navy flex items-center gap-3">
|
|
<i data-lucide="alert-triangle" class="w-8 h-8 text-yellow-500"></i>
|
|
{% trans "My Complaints" %}
|
|
<span class="inline-flex items-center px-3 py-1 bg-navy text-white rounded-full text-sm font-medium">{{ complaints_count }}</span>
|
|
</h1>
|
|
<p class="text-slate mt-1">
|
|
{% trans "View all complaints from your source" %}
|
|
</p>
|
|
</div>
|
|
{% if source_user.can_create_complaints %}
|
|
<a href="{% url 'complaints:complaint_create' %}"
|
|
class="inline-flex items-center gap-2 px-4 py-2 bg-navy text-white rounded-lg hover:bg-blue transition shadow-lg shadow-navy/20">
|
|
<i data-lucide="plus-circle" class="w-4 h-4"></i>
|
|
{% trans "Create Complaint" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Filter Panel -->
|
|
<div class="bg-white rounded-xl shadow-sm border border-slate-200 mb-6">
|
|
<div class="p-4 border-b border-slate-200 bg-slate-50/50 rounded-t-xl">
|
|
<h2 class="text-sm font-semibold text-navy flex items-center gap-2">
|
|
<i data-lucide="filter" class="w-4 h-4 text-slate"></i>
|
|
{% trans "Filters" %}
|
|
</h2>
|
|
</div>
|
|
<div class="p-4">
|
|
<form method="get" class="grid grid-cols-1 md:grid-cols-12 gap-4">
|
|
<!-- Search -->
|
|
<div class="md:col-span-4">
|
|
<label class="block text-sm font-medium text-slate mb-1">{% trans "Search" %}</label>
|
|
<input type="text"
|
|
class="w-full px-3 py-2 border border-slate-200 rounded-lg focus:ring-2 focus:ring-blue focus:border-blue outline-none transition"
|
|
name="search"
|
|
placeholder="{% trans 'Title, patient name...' %}"
|
|
value="{{ search|default:'' }}">
|
|
</div>
|
|
|
|
<!-- Status -->
|
|
<div class="md:col-span-2">
|
|
<label class="block text-sm font-medium text-slate mb-1">{% trans "Status" %}</label>
|
|
<select class="w-full px-3 py-2 border border-slate-200 rounded-lg focus:ring-2 focus:ring-blue focus:border-blue outline-none transition bg-white"
|
|
name="status">
|
|
<option value="">{% trans "All Statuses" %}</option>
|
|
<option value="open" {% if status_filter == 'open' %}selected{% endif %}>{% trans "Open" %}</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>
|
|
</div>
|
|
|
|
<!-- Priority -->
|
|
<div class="md:col-span-2">
|
|
<label class="block text-sm font-medium text-slate mb-1">{% trans "Priority" %}</label>
|
|
<select class="w-full px-3 py-2 border border-slate-200 rounded-lg focus:ring-2 focus:ring-blue focus:border-blue outline-none transition bg-white"
|
|
name="priority">
|
|
<option value="">{% trans "All Priorities" %}</option>
|
|
<option value="low" {% if priority_filter == 'low' %}selected{% endif %}>{% trans "Low" %}</option>
|
|
<option value="medium" {% if priority_filter == 'medium' %}selected{% endif %}>{% trans "Medium" %}</option>
|
|
<option value="high" {% if priority_filter == 'high' %}selected{% endif %}>{% trans "High" %}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Category -->
|
|
<div class="md:col-span-2">
|
|
<label class="block text-sm font-medium text-slate mb-1">{% trans "Category" %}</label>
|
|
<select class="w-full px-3 py-2 border border-slate-200 rounded-lg focus:ring-2 focus:ring-blue focus:border-blue outline-none transition bg-white"
|
|
name="category">
|
|
<option value="">{% trans "All Categories" %}</option>
|
|
<option value="clinical_care" {% if category_filter == 'clinical_care' %}selected{% endif %}>{% trans "Clinical Care" %}</option>
|
|
<option value="staff_behavior" {% if category_filter == 'staff_behavior' %}selected{% endif %}>{% trans "Staff Behavior" %}</option>
|
|
<option value="facility" {% if category_filter == 'facility' %}selected{% endif %}>{% trans "Facility & Environment" %}</option>
|
|
<option value="wait_time" {% if category_filter == 'wait_time' %}selected{% endif %}>{% trans "Wait Time" %}</option>
|
|
<option value="billing" {% if category_filter == 'billing' %}selected{% endif %}>{% trans "Billing" %}</option>
|
|
<option value="communication" {% if category_filter == 'communication' %}selected{% endif %}>{% trans "Communication" %}</option>
|
|
<option value="other" {% if category_filter == 'other' %}selected{% endif %}>{% trans "Other" %}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="md:col-span-2 flex items-end">
|
|
<div class="flex gap-2 w-full">
|
|
<button type="submit"
|
|
class="inline-flex items-center justify-center gap-2 px-4 py-2 bg-navy text-white rounded-lg hover:bg-blue transition flex-grow">
|
|
<i data-lucide="search" class="w-4 h-4"></i>
|
|
{% trans "Filter" %}
|
|
</button>
|
|
<a href="{% url 'px_sources:source_user_complaint_list' %}"
|
|
class="inline-flex items-center justify-center p-2 border border-slate-200 rounded-lg hover:bg-slate-50 transition text-slate">
|
|
<i data-lucide="x-circle" class="w-4 h-4"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Complaints Table -->
|
|
<div class="bg-white rounded-xl shadow-sm border border-slate-200">
|
|
<div class="p-4 border-b border-slate-200 bg-slate-50/50 rounded-t-xl">
|
|
<h2 class="text-lg font-semibold text-navy flex items-center gap-2">
|
|
<i data-lucide="file-text" class="w-5 h-5 text-slate"></i>
|
|
{% trans "Complaints List" %}
|
|
</h2>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full">
|
|
<thead>
|
|
<tr class="border-b border-slate-200">
|
|
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "ID" %}</th>
|
|
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "Title" %}</th>
|
|
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "Patient" %}</th>
|
|
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "Category" %}</th>
|
|
<th class="text-center py-3 px-4 text-sm font-semibold text-navy">{% trans "Status" %}</th>
|
|
<th class="text-center py-3 px-4 text-sm font-semibold text-navy">{% trans "Priority" %}</th>
|
|
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "Assigned To" %}</th>
|
|
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "Created" %}</th>
|
|
<th class="text-center py-3 px-4 text-sm font-semibold text-navy">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
{% for complaint in complaints %}
|
|
<tr class="hover:bg-slate-50 transition">
|
|
<td class="py-3 px-4 text-sm font-mono text-slate">{{ complaint.id|slice:":8" }}</td>
|
|
<td class="py-3 px-4">
|
|
<a href="{% url 'complaints:complaint_detail' complaint.pk %}"
|
|
class="text-navy font-semibold hover:text-blue transition">
|
|
{{ complaint.title|truncatewords:8 }}
|
|
</a>
|
|
</td>
|
|
<td class="py-3 px-4">
|
|
{% if complaint.patient %}
|
|
<div class="font-medium text-slate">{{ complaint.patient.get_full_name }}</div>
|
|
<div class="text-xs text-slate/70">{% trans "MRN" %}: {{ complaint.patient.mrn }}</div>
|
|
{% else %}
|
|
<span class="text-slate/60 italic">{% trans "Not specified" %}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="py-3 px-4">
|
|
<span class="inline-flex items-center px-2 py-1 bg-slate-100 text-slate-600 rounded text-xs font-medium">
|
|
{{ complaint.get_category_display }}
|
|
</span>
|
|
</td>
|
|
<td class="py-3 px-4 text-center">
|
|
{% if complaint.status == 'open' %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-yellow-100 text-yellow-700 rounded text-xs font-medium">{% trans "Open" %}</span>
|
|
{% elif complaint.status == 'in_progress' %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs font-medium">{% trans "In Progress" %}</span>
|
|
{% elif complaint.status == 'resolved' %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-green-100 text-green-700 rounded text-xs font-medium">{% trans "Resolved" %}</span>
|
|
{% else %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-slate-100 text-slate-600 rounded text-xs font-medium">{% trans "Closed" %}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="py-3 px-4 text-center">
|
|
{% if complaint.priority == 'high' %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-red-100 text-red-700 rounded text-xs font-medium">{% trans "High" %}</span>
|
|
{% elif complaint.priority == 'medium' %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-yellow-100 text-yellow-700 rounded text-xs font-medium">{% trans "Medium" %}</span>
|
|
{% else %}
|
|
<span class="inline-flex items-center px-2 py-1 bg-green-100 text-green-700 rounded text-xs font-medium">{% trans "Low" %}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="py-3 px-4 text-sm text-slate">
|
|
{% if complaint.assigned_to %}
|
|
{{ complaint.assigned_to.get_full_name }}
|
|
{% else %}
|
|
<span class="text-slate/60 italic">{% trans "Unassigned" %}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="py-3 px-4 text-sm text-slate">{{ complaint.created_at|date:"Y-m-d" }}</td>
|
|
<td class="py-3 px-4 text-center">
|
|
<a href="{% url 'complaints:complaint_detail' complaint.pk %}"
|
|
class="inline-flex items-center justify-center p-2 bg-blue text-white rounded-lg hover:bg-navy transition"
|
|
title="{% trans 'View' %}">
|
|
<i data-lucide="eye" class="w-4 h-4"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="9" class="text-center py-12">
|
|
<i data-lucide="inbox" class="w-16 h-16 mx-auto text-slate/30 mb-4"></i>
|
|
<p class="text-slate mb-4">{% trans "No complaints found for your source." %}</p>
|
|
{% if source_user.can_create_complaints %}
|
|
<a href="{% url 'complaints:complaint_create' %}"
|
|
class="inline-flex items-center gap-2 px-4 py-2 bg-navy text-white rounded-lg hover:bg-blue transition">
|
|
<i data-lucide="plus-circle" class="w-4 h-4"></i>
|
|
{% trans "Create Complaint" %}
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if complaints.has_other_pages %}
|
|
<nav aria-label="Complaints pagination" class="mt-6">
|
|
<ul class="flex justify-center items-center gap-2">
|
|
{% if complaints.has_previous %}
|
|
<li>
|
|
<a class="inline-flex items-center justify-center w-10 h-10 border border-slate-200 rounded-lg hover:bg-slate-50 transition text-slate"
|
|
href="?page=1&search={{ search }}&status={{ status_filter }}&priority={{ priority_filter }}&category={{ category_filter }}">
|
|
<i data-lucide="chevrons-left" class="w-4 h-4"></i>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a class="inline-flex items-center justify-center w-10 h-10 border border-slate-200 rounded-lg hover:bg-slate-50 transition text-slate"
|
|
href="?page={{ complaints.previous_page_number }}&search={{ search }}&status={{ status_filter }}&priority={{ priority_filter }}&category={{ category_filter }}">
|
|
<i data-lucide="chevron-left" class="w-4 h-4"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{% for num in complaints.paginator.page_range %}
|
|
{% if complaints.number == num %}
|
|
<li>
|
|
<span class="inline-flex items-center justify-center w-10 h-10 bg-navy text-white rounded-lg font-medium">{{ num }}</span>
|
|
</li>
|
|
{% elif num > complaints.number|add:'-3' and num < complaints.number|add:'3' %}
|
|
<li>
|
|
<a class="inline-flex items-center justify-center w-10 h-10 border border-slate-200 rounded-lg hover:bg-slate-50 transition text-slate"
|
|
href="?page={{ num }}&search={{ search }}&status={{ status_filter }}&priority={{ priority_filter }}&category={{ category_filter }}">
|
|
{{ num }}
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if complaints.has_next %}
|
|
<li>
|
|
<a class="inline-flex items-center justify-center w-10 h-10 border border-slate-200 rounded-lg hover:bg-slate-50 transition text-slate"
|
|
href="?page={{ complaints.next_page_number }}&search={{ search }}&status={{ status_filter }}&priority={{ priority_filter }}&category={{ category_filter }}">
|
|
<i data-lucide="chevron-right" class="w-4 h-4"></i>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a class="inline-flex items-center justify-center w-10 h-10 border border-slate-200 rounded-lg hover:bg-slate-50 transition text-slate"
|
|
href="?page={{ complaints.paginator.num_pages }}&search={{ search }}&status={{ status_filter }}&priority={{ priority_filter }}&category={{ category_filter }}">
|
|
<i data-lucide="chevrons-right" class="w-4 h-4"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
lucide.createIcons();
|
|
});
|
|
</script>
|
|
{% endblock %}
|