HH/templates/px_sources/communication_request_list.html
ismail c5f76b3855
Some checks are pending
Build and Push Docker Image / build (push) Waiting to run
updates
2026-05-11 14:45:30 +03:00

186 lines
9.8 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% block title %}{% trans "Communication Requests" %} - PX360{% endblock %}
{% block extra_css %}
<style>
.page-header-gradient {
background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
color: white; padding: 1.5rem 2rem; border-radius: 1rem; margin-bottom: 1.5rem;
box-shadow: 0 10px 15px -3px rgba(13, 148, 136, 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;
}
.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;
}
.status-tab {
padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600;
transition: all 0.2s; cursor: pointer;
}
.status-tab:hover { background: #f1f5f9; }
.status-tab.active { background: #0d9488; color: white; }
@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">
<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="message-square" class="w-6 h-6 text-white"></i>
</div>
<div>
<h1 class="text-2xl font-bold">{% trans "Communication Requests" %}</h1>
<p class="text-white/80 text-sm">
{% trans "Manage patient communication requests" %}
<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">{{ total_count }}</span>
</p>
</div>
</div>
</div>
</div>
{% if pending_count > 0 %}
<div class="bg-amber-50 border border-amber-200 rounded-xl p-4 mb-6 flex items-center gap-3">
<i data-lucide="alert-circle" class="w-5 h-5 text-amber-600"></i>
<span class="text-amber-800 font-medium text-sm">
{% blocktrans count counter=pending_count %}
{{ counter }} pending request requires attention
{% plural %}
{{ counter }} pending requests require attention
{% endblocktrans %}
</span>
</div>
{% endif %}
<div class="flex gap-2 mb-6 animate-in">
<a href="{% url 'px_sources:communication_request_list' %}"
class="status-tab {% if not status_filter %}active{% endif %}">
{% trans "All" %} <span class="ml-1 text-xs opacity-75">({{ all_total_count }})</span>
</a>
<a href="{% url 'px_sources:communication_request_list' %}?status=pending"
class="status-tab {% if status_filter == 'pending' %}active{% endif %}">
{% trans "Pending" %}
</a>
<a href="{% url 'px_sources:communication_request_list' %}?status=contacted"
class="status-tab {% if status_filter == 'contacted' %}active{% endif %}">
{% trans "Contacted" %}
</a>
<a href="{% url 'px_sources:communication_request_list' %}?status=resolved"
class="status-tab {% if status_filter == 'resolved' %}active{% endif %}">
{% trans "Resolved" %}
</a>
<a href="{% url 'px_sources:communication_request_list' %}?status=closed"
class="status-tab {% if status_filter == 'closed' %}active{% endif %}">
{% trans "Closed" %}
</a>
</div>
<div class="section-card animate-in">
<div class="section-header">
<div class="section-icon bg-teal-100">
<i data-lucide="inbox" class="w-5 h-5 text-teal-600"></i>
</div>
<h2 class="text-lg font-bold text-navy">
{% trans "Requests" %}
<span class="inline-flex items-center px-2.5 py-0.5 bg-teal-100 text-teal-700 rounded-full text-xs font-bold ml-2">{{ total_count }}</span>
</h2>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-teal-50">
<tr>
<th class="px-6 py-4 text-left text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Source User" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Reason" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Patient" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Message" %}</th>
<th class="text-center py-4 px-6 text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Status" %}</th>
<th class="text-left py-4 px-6 text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Created" %}</th>
<th class="text-center py-4 px-6 text-xs font-bold text-teal-800 uppercase tracking-wider">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody class="divide-y divide-teal-50">
{% for req in comm_requests %}
<tr class="hover:bg-teal-50/50 transition">
<td class="px-6 py-4">
<div class="text-sm font-semibold text-navy">{{ req.source_user.user.get_full_name }}</div>
<div class="text-xs text-slate-400">{{ req.source_user.source.name_en }}</div>
</td>
<td class="px-6 py-4">
<span class="text-navy font-semibold text-sm">{{ req.get_reason_display }}</span>
</td>
<td class="px-6 py-4 text-sm text-slate">
{% if req.patient_name %}
{{ req.patient_name }}
{% if req.patient_mrn %}<br><span class="text-xs text-slate-400">MRN: {{ req.patient_mrn }}</span>{% endif %}
{% else %}<span class="text-slate-400">-</span>{% endif %}
</td>
<td class="px-6 py-4 text-sm text-slate max-w-xs truncate">{{ req.message|truncatechars:60 }}</td>
<td class="px-6 py-4 text-center">
{% if req.status == 'pending' %}
<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="clock" class="w-3 h-3"></i> {% trans "Pending" %}
</span>
{% elif req.status == 'contacted' %}
<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="phone" class="w-3 h-3"></i> {% trans "Contacted" %}
</span>
{% elif req.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-3 h-3"></i> {% trans "Resolved" %}
</span>
{% elif req.status == 'closed' %}
<span class="inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-bold bg-slate-100 text-slate-600">
<i data-lucide="archive" class="w-3 h-3"></i> {% trans "Closed" %}
</span>
{% endif %}
</td>
<td class="px-6 py-4 text-sm text-slate">{{ req.created_at|date:"M d, Y H:i" }}</td>
<td class="px-6 py-4 text-center">
<a href="{% url 'px_sources:communication_request_detail' req.pk %}"
class="inline-flex items-center gap-1 px-3 py-1.5 bg-teal-600 text-white text-xs font-semibold rounded-lg hover:bg-teal-700 transition">
<i data-lucide="eye" class="w-3 h-3"></i> {% trans "View" %}
</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="7" 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-teal-100 to-cyan-100 rounded-full flex items-center justify-center mb-4">
<i data-lucide="message-square" class="w-8 h-8 text-teal-500"></i>
</div>
<p class="text-slate font-medium">{% trans "No communication requests found" %}</p>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
lucide.createIcons();
});
</script>
{% endblock %}