HH/templates/px_sources/source_user_inquiry_list.html
2026-02-25 04:47:05 +03:00

248 lines
15 KiB
HTML

{% extends "layouts/source_user_base.html" %}
{% load i18n %}
{% block title %}{% trans "My Inquiries" %} - {{ 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="help-circle" class="w-8 h-8 text-cyan-500"></i>
{% trans "My Inquiries" %}
<span class="inline-flex items-center px-3 py-1 bg-blue text-white rounded-full text-sm font-medium">{{ inquiries_count }}</span>
</h1>
<p class="text-slate mt-1">
{% trans "View all inquiries from your source" %}
</p>
</div>
{% if source_user.can_create_inquiries %}
<a href="{% url 'complaints:inquiry_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 Inquiry" %}
</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-5">
<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 'Subject, contact name...' %}"
value="{{ search|default:'' }}">
</div>
<!-- Status -->
<div class="md:col-span-3">
<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>
<!-- 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_inquiry_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>
<!-- Inquiries 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="help-circle" class="w-5 h-5 text-slate"></i>
{% trans "Inquiries 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 "Subject" %}</th>
<th class="text-left py-3 px-4 text-sm font-semibold text-navy">{% trans "Contact" %}</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-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 inquiry in inquiries %}
<tr class="hover:bg-slate-50 transition">
<td class="py-3 px-4 text-sm font-mono text-slate">{{ inquiry.id|slice:":8" }}</td>
<td class="py-3 px-4">
<a href="{% url 'complaints:inquiry_detail' inquiry.pk %}"
class="text-navy font-semibold hover:text-blue transition">
{{ inquiry.subject|truncatewords:8 }}
</a>
</td>
<td class="py-3 px-4">
{% if inquiry.patient %}
<div class="font-medium text-slate">{{ inquiry.patient.get_full_name }}</div>
<div class="text-xs text-slate/70">{% trans "MRN" %}: {{ inquiry.patient.mrn }}</div>
{% else %}
<div class="font-medium text-slate">{{ inquiry.contact_name|default:"-" }}</div>
<div class="text-xs text-slate/70">{{ inquiry.contact_email|default:"-" }}</div>
{% 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">
{{ inquiry.get_category_display }}
</span>
</td>
<td class="py-3 px-4 text-center">
{% if inquiry.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 inquiry.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 inquiry.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-sm text-slate">
{% if inquiry.assigned_to %}
{{ inquiry.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">{{ inquiry.created_at|date:"Y-m-d" }}</td>
<td class="py-3 px-4 text-center">
<a href="{% url 'complaints:inquiry_detail' inquiry.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="8" 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 inquiries found for your source." %}</p>
{% if source_user.can_create_inquiries %}
<a href="{% url 'complaints:inquiry_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 Inquiry" %}
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Pagination -->
{% if inquiries.has_other_pages %}
<nav aria-label="Inquiries pagination" class="mt-6">
<ul class="flex justify-center items-center gap-2">
{% if inquiries.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 }}&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={{ inquiries.previous_page_number }}&search={{ search }}&status={{ status_filter }}&category={{ category_filter }}">
<i data-lucide="chevron-left" class="w-4 h-4"></i>
</a>
</li>
{% endif %}
{% for num in inquiries.paginator.page_range %}
{% if inquiries.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 > inquiries.number|add:'-3' and num < inquiries.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 }}&category={{ category_filter }}">
{{ num }}
</a>
</li>
{% endif %}
{% endfor %}
{% if inquiries.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={{ inquiries.next_page_number }}&search={{ search }}&status={{ status_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={{ inquiries.paginator.num_pages }}&search={{ search }}&status={{ status_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 %}