281 lines
15 KiB
HTML
281 lines
15 KiB
HTML
{% extends "layouts/source_user_base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% trans "My Inquiries" %} - {{ source.name_en }}{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.page-header-gradient {
|
|
background: linear-gradient(135deg, #005696 0%, #0069a8 50%, #007bbd 100%);
|
|
color: white;
|
|
padding: 1.5rem 2rem;
|
|
border-radius: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
box-shadow: 0 10px 15px -3px rgba(0, 86, 150, 0.2);
|
|
}
|
|
|
|
.section-card {
|
|
background: white;
|
|
border-radius: 1rem;
|
|
border: 2px solid #e2e8f0;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
overflow: hidden;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.section-card:hover {
|
|
border-color: #005696;
|
|
box-shadow: 0 10px 25px -5px rgba(0, 86, 150, 0.15);
|
|
}
|
|
|
|
.section-header {
|
|
padding: 1rem 1.5rem;
|
|
border-bottom: 2px solid #e2e8f0;
|
|
background: linear-gradient(to right, #f8fafc, #f1f5f9);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.section-icon {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 0.75rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
@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="page-header-gradient animate-in">
|
|
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
|
|
<div class="flex items-center gap-3">
|
|
<div class="section-icon bg-white/20">
|
|
<i data-lucide="help-circle" class="w-6 h-6 text-white"></i>
|
|
</div>
|
|
<div>
|
|
<h1 class="text-2xl font-bold">
|
|
{% trans "My Inquiries" %}
|
|
</h1>
|
|
<p class="text-white/80 text-sm">
|
|
{% trans "View all inquiries from your source" %}
|
|
<span class="inline-flex items-center px-2.5 py-0.5 bg-white/20 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-white text-navy rounded-xl font-bold hover:bg-gray-100 transition shadow-lg">
|
|
<i data-lucide="plus-circle" class="w-4 h-4"></i>
|
|
{% trans "Create Inquiry" %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filter Panel -->
|
|
<div class="section-card mb-8 animate-in">
|
|
<div class="section-header">
|
|
<div class="section-icon bg-blue-100">
|
|
<i data-lucide="filter" class="w-5 h-5 text-blue-600"></i>
|
|
</div>
|
|
<h2 class="text-lg font-bold text-navy">{% 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-navy text-white rounded-xl font-bold hover:bg-blue transition flex-grow shadow-lg">
|
|
<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="section-card animate-in">
|
|
<div class="section-header">
|
|
<div class="section-icon bg-cyan-100">
|
|
<i data-lucide="help-circle" class="w-5 h-5 text-cyan-600"></i>
|
|
</div>
|
|
<h2 class="text-lg font-bold text-navy">
|
|
{% 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-slate-100">
|
|
<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 %}
|