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

206 lines
12 KiB
HTML

{% extends "layouts/source_user_base.html" %}
{% load i18n %}
{% block title %}{% trans "Source User Dashboard" %} - {{ source.name_en }} - PX360{% 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="radio" class="w-8 h-8 text-blue"></i>
{{ source.name_en }}
</h1>
<p class="text-slate mt-1">
{% trans "Welcome" %}, {{ request.user.get_full_name }}!
{% trans "You're managing feedback from this source." %}
</p>
</div>
<div class="flex gap-2">
<a href="{% url 'px_sources:source_user_complaint_list' %}"
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="file-text" class="w-4 h-4"></i>
{% trans "All Complaints" %}
</a>
<a href="{% url 'px_sources:source_user_inquiry_list' %}"
class="inline-flex items-center gap-2 px-4 py-2 bg-blue text-white rounded-lg hover:bg-navy transition">
<i data-lucide="help-circle" class="w-4 h-4"></i>
{% trans "All Inquiries" %}
</a>
</div>
</div>
<!-- Statistics Cards -->
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
<div class="bg-gradient-to-br from-navy to-blue rounded-xl p-4 text-white shadow-lg shadow-navy/20">
<div class="flex items-center justify-between">
<div>
<p class="text-white/80 text-sm">{% trans "Total Complaints" %}</p>
<p class="text-2xl font-bold">{{ total_complaints }}</p>
</div>
<i data-lucide="file-text" class="w-10 h-10 text-white/30"></i>
</div>
</div>
<div class="bg-gradient-to-br from-yellow-500 to-orange-500 rounded-xl p-4 text-white shadow-lg shadow-yellow/20">
<div class="flex items-center justify-between">
<div>
<p class="text-white/80 text-sm">{% trans "Open Complaints" %}</p>
<p class="text-2xl font-bold">{{ open_complaints }}</p>
</div>
<i data-lucide="alert-circle" class="w-10 h-10 text-white/30"></i>
</div>
</div>
<div class="bg-gradient-to-br from-cyan-500 to-blue-500 rounded-xl p-4 text-white shadow-lg shadow-cyan/20">
<div class="flex items-center justify-between">
<div>
<p class="text-white/80 text-sm">{% trans "Total Inquiries" %}</p>
<p class="text-2xl font-bold">{{ total_inquiries }}</p>
</div>
<i data-lucide="help-circle" class="w-10 h-10 text-white/30"></i>
</div>
</div>
<div class="bg-gradient-to-br from-slate-500 to-slate-600 rounded-xl p-4 text-white shadow-lg shadow-slate/20">
<div class="flex items-center justify-between">
<div>
<p class="text-white/80 text-sm">{% trans "Open Inquiries" %}</p>
<p class="text-2xl font-bold">{{ open_inquiries }}</p>
</div>
<i data-lucide="message-circle" class="w-10 h-10 text-white/30"></i>
</div>
</div>
</div>
<!-- Recent Complaints -->
<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 flex justify-between items-center">
<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 "Recent Complaints" %} ({{ complaints|length }})
</h2>
</div>
<div class="p-4">
{% if complaints %}
<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 "Created" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
{% for complaint in complaints|slice:":10" %}
<tr class="hover:bg-slate-50 transition">
<td class="py-3 px-4 text-sm font-mono text-slate">{{ complaint.reference_number|default:complaint.id|truncatechars:12 }}</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|truncatechars:40 }}
</a>
</td>
<td class="py-3 px-4 text-sm text-slate">{{ complaint.patient.get_full_name|default:"-" }}</td>
<td class="py-3 px-4 text-sm text-slate">{{ complaint.category|default:"-" }}</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">{{ complaint.get_status_display }}</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">{{ complaint.created_at|date:"Y-m-d" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-8 text-slate">
<i data-lucide="file-text" class="w-12 h-12 mx-auto mb-3 opacity-30"></i>
<p>{% trans "No complaints found from this source." %}</p>
</div>
{% endif %}
</div>
</div>
<!-- Recent Inquiries -->
<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 flex justify-between items-center">
<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 "Recent Inquiries" %} ({{ inquiries|length }})
</h2>
</div>
<div class="p-4">
{% if inquiries %}
<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 "From" %}</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 "Created" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
{% for inquiry in inquiries|slice:":10" %}
<tr class="hover:bg-slate-50 transition">
<td class="py-3 px-4 text-sm font-mono text-slate">{{ inquiry.reference_number|default:inquiry.id|truncatechars:12 }}</td>
<td class="py-3 px-4">
<span class="text-navy font-medium">{{ inquiry.subject|truncatechars:40 }}</span>
</td>
<td class="py-3 px-4 text-sm text-slate">{{ inquiry.name }}</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">{{ inquiry.get_status_display }}</span>
{% endif %}
</td>
<td class="py-3 px-4 text-sm text-slate">{{ inquiry.created_at|date:"Y-m-d" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-8 text-slate">
<i data-lucide="help-circle" class="w-12 h-12 mx-auto mb-3 opacity-30"></i>
<p>{% trans "No inquiries found from this source." %}</p>
</div>
{% endif %}
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
lucide.createIcons();
});
</script>
{% endblock %}