236 lines
14 KiB
HTML
236 lines
14 KiB
HTML
{% extends "layouts/source_user_base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "My Inquiries" %} - {{ source.name_en }}{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(20px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
.animate-in {
|
|
animation: fadeIn 0.5s ease-out forwards;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="p-6 md:p-8 bg-gradient-to-br from-light to-blue-50 min-h-screen">
|
|
<!-- Page Header -->
|
|
<div class="flex flex-wrap justify-between items-center gap-4 mb-8 animate-in">
|
|
<div class="flex items-center gap-3">
|
|
<div class="flex items-center justify-center w-14 h-14 bg-gradient-to-br from-cyan-500 to-blue-500 rounded-2xl shadow-lg shadow-cyan-200">
|
|
<i data-lucide="help-circle" class="w-8 h-8 text-white"></i>
|
|
</div>
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-navy">
|
|
{% trans "My Inquiries" %}
|
|
</h1>
|
|
<p class="text-slate text-sm">
|
|
{% trans "View all inquiries from your source" %}
|
|
<span class="inline-flex items-center px-2.5 py-0.5 bg-cyan-500 text-white rounded-full text-xs font-bold ml-2">{{ inquiries_count }}</span>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{% if source_user.can_create_inquiries %}
|
|
<a href="{% url 'complaints:inquiry_create' %}"
|
|
class="inline-flex items-center gap-2 px-5 py-2.5 bg-gradient-to-r from-cyan-500 to-blue-500 text-white rounded-xl font-semibold hover:from-cyan-600 hover:to-blue-600 transition shadow-lg shadow-cyan-200">
|
|
<i data-lucide="plus-circle" class="w-4 h-4"></i>
|
|
{% trans "Create Inquiry" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Filter Panel -->
|
|
<div class="bg-white rounded-2xl shadow-sm border border-blue-100 mb-8 animate-in">
|
|
<div class="px-6 py-5 border-b border-blue-100 bg-gradient-to-r from-blue-50 to-transparent">
|
|
<h2 class="text-sm font-bold text-navy flex items-center gap-2">
|
|
<i data-lucide="filter" class="w-4 h-4 text-blue"></i>
|
|
{% trans "Filters" %}
|
|
</h2>
|
|
</div>
|
|
<div class="p-6">
|
|
<form method="get" class="grid grid-cols-1 md:grid-cols-12 gap-5">
|
|
<!-- Search -->
|
|
<div class="md:col-span-5">
|
|
<label class="block text-sm font-bold text-navy mb-2">{% trans "Search" %}</label>
|
|
<div class="relative">
|
|
<input type="text"
|
|
class="w-full pl-10 pr-4 py-2.5 border-2 border-blue-100 rounded-xl text-navy focus:ring-2 focus:ring-blue focus:border-transparent transition"
|
|
name="search"
|
|
placeholder="{% trans 'Subject, contact name...' %}"
|
|
value="{{ search|default:'' }}">
|
|
<i data-lucide="search" class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate"></i>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Status -->
|
|
<div class="md:col-span-3">
|
|
<label class="block text-sm font-bold text-navy mb-2">{% trans "Status" %}</label>
|
|
<select class="w-full px-3 py-2.5 border-2 border-blue-100 rounded-xl text-navy focus:ring-2 focus:ring-blue focus:border-transparent transition bg-white">
|
|
<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-bold text-navy mb-2">{% trans "Category" %}</label>
|
|
<select class="w-full px-3 py-2.5 border-2 border-blue-100 rounded-xl text-navy focus:ring-2 focus:ring-blue focus:border-transparent transition bg-white">
|
|
<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" %}</option>
|
|
<option value="billing" {% if category_filter == 'billing' %}selected{% endif %}>{% trans "Billing" %}</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.5 bg-gradient-to-r from-navy to-blue text-white rounded-xl font-semibold hover:from-navy hover:to-blue transition flex-grow shadow-lg shadow-blue-200">
|
|
<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.5 border-2 border-slate-200 text-slate rounded-xl hover:bg-slate-50 transition"
|
|
title="{% trans 'Clear filters' %}">
|
|
<i data-lucide="x-circle" class="w-5 h-5"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Inquiries Table -->
|
|
<div class="bg-white rounded-2xl shadow-sm border border-blue-100 overflow-hidden animate-in">
|
|
<div class="px-6 py-5 border-b border-blue-100 bg-gradient-to-r from-blue-50 to-transparent">
|
|
<h2 class="text-lg font-bold text-navy flex items-center gap-2">
|
|
<i data-lucide="help-circle" class="w-5 h-5 text-cyan-500"></i>
|
|
{% trans "All Inquiries" %}
|
|
<span class="inline-flex items-center px-2.5 py-0.5 bg-cyan-100 text-cyan-700 rounded-full text-xs font-bold ml-2">{{ inquiries_count }}</span>
|
|
</h2>
|
|
</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full">
|
|
<thead class="bg-blue-50">
|
|
<tr>
|
|
<th class="px-6 py-4 text-left text-xs font-bold text-blue-800 uppercase tracking-wider">{% trans "Reference" %}</th>
|
|
<th class="text-left py-4 px-6 text-xs font-bold text-blue-800 uppercase tracking-wider">{% trans "Subject" %}</th>
|
|
<th class="text-left py-4 px-6 text-xs font-bold text-blue-800 uppercase tracking-wider">{% trans "From" %}</th>
|
|
<th class="text-left py-4 px-6 text-xs font-bold text-blue-800 uppercase tracking-wider">{% trans "Contact" %}</th>
|
|
<th class="text-center py-4 px-6 text-xs font-bold text-blue-800 uppercase tracking-wider">{% trans "Status" %}</th>
|
|
<th class="text-left py-4 px-6 text-xs font-bold text-blue-800 uppercase tracking-wider">{% trans "Created" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-blue-50">
|
|
{% for inquiry in inquiries %}
|
|
<tr class="hover:bg-blue-50/50 transition">
|
|
<td class="px-6 py-4 text-sm font-mono text-slate font-medium">{{ inquiry.reference_number|default:inquiry.id|truncatechars:12 }}</td>
|
|
<td class="px-6 py-4">
|
|
<a href="{% url 'complaints:inquiry_detail' inquiry.pk %}"
|
|
class="text-navy font-semibold hover:text-blue transition">
|
|
{{ inquiry.subject|truncatechars:35 }}
|
|
</a>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-slate">{{ inquiry.contact_name|default:"-" }}</td>
|
|
<td class="px-6 py-4 text-sm text-slate">
|
|
{% if inquiry.contact_email %}
|
|
<i data-lucide="mail" class="w-3 h-3 inline mr-1"></i>
|
|
{{ inquiry.contact_email|truncatechars:20 }}
|
|
{% elif inquiry.contact_phone %}
|
|
<i data-lucide="phone" class="w-3 h-3 inline mr-1"></i>
|
|
{{ inquiry.contact_phone }}
|
|
{% else %}-{% endif %}
|
|
</td>
|
|
<td class="px-6 py-4 text-center">
|
|
{% if inquiry.status == 'open' %}
|
|
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-yellow-100 text-yellow-700">
|
|
<i data-lucide="circle" class="w-2 h-2 fill-current"></i>
|
|
{% trans "Open" %}
|
|
</span>
|
|
{% elif inquiry.status == 'in_progress' %}
|
|
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-blue-100 text-blue-700">
|
|
<i data-lucide="loader" class="w-2 h-2"></i>
|
|
{% trans "In Progress" %}
|
|
</span>
|
|
{% elif inquiry.status == 'resolved' %}
|
|
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-emerald-100 text-emerald-700">
|
|
<i data-lucide="check-circle" class="w-2 h-2"></i>
|
|
{% trans "Resolved" %}
|
|
</span>
|
|
{% else %}
|
|
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-bold bg-slate-100 text-slate-700">{{ inquiry.get_status_display }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-slate">{{ inquiry.created_at|date:"M d, Y" }}</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="6" class="px-6 py-12 text-center">
|
|
<div class="flex flex-col items-center">
|
|
<div class="w-16 h-16 bg-gradient-to-br from-cyan-100 to-blue-100 rounded-full flex items-center justify-center mb-4">
|
|
<i data-lucide="help-circle" class="w-8 h-8 text-cyan-500"></i>
|
|
</div>
|
|
<p class="text-slate font-medium">{% trans "No inquiries found" %}</p>
|
|
{% if source_user.can_create_inquiries %}
|
|
<a href="{% url 'complaints:inquiry_create' %}" class="mt-3 text-blue font-semibold hover:underline">
|
|
{% trans "Create your first inquiry" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if inquiries.has_other_pages %}
|
|
<div class="px-6 py-4 border-t border-blue-100 bg-gradient-to-r from-blue-50 to-transparent">
|
|
<div class="flex items-center justify-between">
|
|
<p class="text-sm text-slate">
|
|
{% blocktrans with start=inquiries.start_index end=inquiries.end_index total=inquiries.paginator.count %}
|
|
Showing {{ start }} to {{ end }} of {{ total }} inquiries
|
|
{% endblocktrans %}
|
|
</p>
|
|
<div class="flex gap-2">
|
|
{% if inquiries.has_previous %}
|
|
<a href="?page={{ inquiries.previous_page_number }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if search %}&search={{ search }}{% endif %}"
|
|
class="px-4 py-2 border-2 border-blue-200 text-blue rounded-xl font-semibold hover:bg-blue-50 transition">
|
|
{% trans "Previous" %}
|
|
</a>
|
|
{% endif %}
|
|
|
|
<span class="px-4 py-2 bg-navy text-white rounded-xl font-semibold">
|
|
{% blocktrans with num=inquiries.number total=inquiries.paginator.num_pages %}Page {{ num }} of {{ total }}{% endblocktrans %}
|
|
</span>
|
|
|
|
{% if inquiries.has_next %}
|
|
<a href="?page={{ inquiries.next_page_number }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if category_filter %}&category={{ category_filter }}{% endif %}{% if search %}&search={{ search }}{% endif %}"
|
|
class="px-4 py-2 border-2 border-blue-200 text-blue rounded-xl font-semibold hover:bg-blue-50 transition">
|
|
{% trans "Next" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
lucide.createIcons();
|
|
});
|
|
</script>
|
|
{% endblock %}
|