307 lines
15 KiB
HTML
307 lines
15 KiB
HTML
{% extends "layouts/base.html" %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
|
|
{% block title %}{% trans "Physicians" %} - PX360{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.physician-row {
|
|
transition: all 0.2s ease;
|
|
border-left: 3px solid transparent;
|
|
}
|
|
.physician-row:hover {
|
|
background: #f8fafc;
|
|
border-left-color: #007bbd;
|
|
transform: translateX(2px);
|
|
}
|
|
.table-card {
|
|
transition: box-shadow 0.2s ease;
|
|
}
|
|
.table-card:hover {
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
}
|
|
.field-label {
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
color: #64748b;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="p-8">
|
|
<!-- Header -->
|
|
<header class="mb-8">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-navy flex items-center gap-3">
|
|
<div class="w-10 h-10 bg-blue-100 rounded-xl flex items-center justify-center">
|
|
<i data-lucide="stethoscope" class="w-5 h-5 text-blue"></i>
|
|
</div>
|
|
{% trans "Physicians" %}
|
|
</h1>
|
|
<p class="text-slate mt-2 text-sm">{% trans "Manage physician profiles and performance" %}</p>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<a href="{% url 'physicians:specialization_overview' %}"
|
|
class="px-4 py-2.5 border border-slate-200 text-slate rounded-xl font-semibold hover:bg-slate-50 hover:border-slate-300 transition flex items-center gap-2">
|
|
<i data-lucide="layers" class="w-4 h-4"></i>
|
|
{% trans "By Specialization" %}
|
|
</a>
|
|
<a href="{% url 'physicians:department_overview' %}"
|
|
class="px-4 py-2.5 border border-slate-200 text-slate rounded-xl font-semibold hover:bg-slate-50 hover:border-slate-300 transition flex items-center gap-2">
|
|
<i data-lucide="building-2" class="w-4 h-4"></i>
|
|
{% trans "By Department" %}
|
|
</a>
|
|
<a href="{% url 'physicians:leaderboard' %}"
|
|
class="px-4 py-2.5 border border-blue/30 text-blue rounded-xl font-semibold hover:bg-blue/5 transition flex items-center gap-2">
|
|
<i data-lucide="trophy" class="w-4 h-4"></i>
|
|
{% trans "Leaderboard" %}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Statistics Cards -->
|
|
<section class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
|
<div class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 hover:shadow-md transition">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="field-label text-slate mb-2">{% trans "Total Physicians" %}</p>
|
|
<h3 class="text-3xl font-bold text-navy">{{ stats.total|default:0 }}</h3>
|
|
</div>
|
|
<div class="w-14 h-14 bg-blue/10 rounded-xl flex items-center justify-center">
|
|
<i data-lucide="users" class="w-7 h-7 text-blue"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 hover:shadow-md transition">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<p class="field-label text-slate mb-2">{% trans "Active Physicians" %}</p>
|
|
<h3 class="text-3xl font-bold text-green-600">{{ stats.active|default:0 }}</h3>
|
|
</div>
|
|
<div class="w-14 h-14 bg-green-100 rounded-xl flex items-center justify-center">
|
|
<i data-lucide="user-check" class="w-7 h-7 text-green-600"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Filters -->
|
|
<section class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 mb-6">
|
|
<form method="get" class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
<div>
|
|
<label class="field-label">{% trans "Search" %}</label>
|
|
<div class="relative">
|
|
<i data-lucide="search" class="w-4 h-4 text-slate absolute left-3 top-1/2 -translate-y-1/2"></i>
|
|
<input type="text" name="search"
|
|
value="{{ filters.search|default:'' }}"
|
|
class="w-full pl-10 pr-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy/20 focus:border-navy outline-none transition"
|
|
placeholder="{% trans 'Name, license, specialization...' %}">
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="field-label">{% trans "Hospital" %}</label>
|
|
<select name="hospital" class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy/20 focus:border-navy outline-none transition">
|
|
<option value="">{% trans "All Hospitals" %}</option>
|
|
{% for hospital in hospitals %}
|
|
<option value="{{ hospital.id }}" {% if filters.hospital == hospital.id|stringformat:'s' %}selected{% endif %}>
|
|
{{ hospital.name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="field-label">{% trans "Department" %}</label>
|
|
<select name="department" class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy/20 focus:border-navy outline-none transition">
|
|
<option value="">{% trans "All Departments" %}</option>
|
|
{% for department in departments %}
|
|
<option value="{{ department.id }}" {% if filters.department == department.id|stringformat:'s' %}selected{% endif %}>
|
|
{{ department.name }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="field-label">{% trans "Status" %}</label>
|
|
<select name="status" class="w-full px-4 py-2.5 border border-slate-200 rounded-xl text-sm focus:ring-2 focus:ring-navy/20 focus:border-navy outline-none transition">
|
|
<option value="">{% trans "All Status" %}</option>
|
|
<option value="active" {% if filters.status == "active" %}selected{% endif %}>{% trans "Active" %}</option>
|
|
<option value="inactive" {% if filters.status == "inactive" %}selected{% endif %}>{% trans "Inactive" %}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="md:col-span-4 flex items-end gap-2">
|
|
<button type="submit" class="px-6 py-2.5 bg-navy text-white rounded-xl font-semibold shadow-md hover:bg-blue transition flex items-center gap-2">
|
|
<i data-lucide="search" class="w-4 h-4"></i>
|
|
{% trans "Filter" %}
|
|
</button>
|
|
<a href="{% url 'physicians:physician_list' %}" class="px-6 py-2.5 border border-slate-200 text-slate rounded-xl font-semibold hover:bg-slate-50 hover:border-slate-300 transition flex items-center gap-2">
|
|
<i data-lucide="x-circle" class="w-4 h-4"></i>
|
|
{% trans "Clear" %}
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<!-- Physicians Table -->
|
|
<section class="bg-white rounded-2xl shadow-sm border border-slate-100 table-card">
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full">
|
|
<thead>
|
|
<tr class="bg-slate-50 border-b border-slate-200">
|
|
<th class="p-4 text-left font-bold text-navy text-xs uppercase tracking-wider">{% trans "Physician" %}</th>
|
|
<th class="p-4 text-left font-bold text-navy text-xs uppercase tracking-wider">{% trans "License" %}</th>
|
|
<th class="p-4 text-left font-bold text-navy text-xs uppercase tracking-wider">{% trans "Specialization" %}</th>
|
|
<th class="p-4 text-left font-bold text-navy text-xs uppercase tracking-wider">{% trans "Department" %}</th>
|
|
<th class="p-4 text-left font-bold text-navy text-xs uppercase tracking-wider">{% trans "Hospital" %}</th>
|
|
<th class="p-4 text-left font-bold text-navy text-xs uppercase tracking-wider">{% trans "Current Rating" %}</th>
|
|
<th class="p-4 text-center font-bold text-navy text-xs uppercase tracking-wider">{% trans "Status" %}</th>
|
|
<th class="p-4 text-center font-bold text-navy text-xs uppercase tracking-wider">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
{% for physician in physicians %}
|
|
<tr class="physician-row cursor-pointer" onclick="window.location='{% url 'physicians:physician_detail' physician.id %}'">
|
|
<td class="p-4">
|
|
<div class="flex items-center gap-3 group">
|
|
<div class="w-10 h-10 rounded-lg bg-blue/10 flex items-center justify-center group-hover:bg-blue group-hover:text-white transition">
|
|
<i data-lucide="user" class="w-5 h-5 text-blue group-hover:text-white transition"></i>
|
|
</div>
|
|
<div>
|
|
<p class="font-bold text-navy group-hover:text-blue transition">{{ physician.get_full_name }}</p>
|
|
<p class="text-xs text-slate">{{ physician.email|default:"-" }}</p>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="p-4">
|
|
<span class="font-mono text-sm font-medium text-navy bg-slate-50 px-2 py-1 rounded">{{ physician.license_number }}</span>
|
|
</td>
|
|
<td class="p-4">
|
|
<span class="text-sm text-slate">{{ physician.specialization|default:"-" }}</span>
|
|
</td>
|
|
<td class="p-4">
|
|
<span class="text-sm text-slate">{{ physician.department.name|default:"-" }}</span>
|
|
</td>
|
|
<td class="p-4">
|
|
<div class="flex items-center gap-2">
|
|
<i data-lucide="building-2" class="w-4 h-4 text-slate"></i>
|
|
<span class="text-sm text-slate">{{ physician.hospital.name }}</span>
|
|
</div>
|
|
</td>
|
|
<td class="p-4">
|
|
{% if physician.current_rating %}
|
|
<div class="flex items-center gap-2">
|
|
<div class="flex items-center gap-1">
|
|
<i data-lucide="star" class="w-4 h-4 text-yellow-500 fill-yellow-500"></i>
|
|
<span class="font-bold text-navy">{{ physician.current_rating.average_rating|floatformat:2 }}</span>
|
|
</div>
|
|
<span class="text-xs text-slate bg-slate-100 px-2 py-1 rounded-full">
|
|
{{ physician.current_rating.total_surveys }} {% trans "surveys" %}
|
|
</span>
|
|
</div>
|
|
{% else %}
|
|
<span class="text-slate text-sm">{% trans "No data" %}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="p-4 text-center">
|
|
<span class="inline-flex px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider
|
|
{% if physician.status == 'active' %}bg-green-100 text-green-700
|
|
{% else %}bg-slate-100 text-slate-700{% endif %}">
|
|
{{ physician.get_status_display }}
|
|
</span>
|
|
</td>
|
|
<td class="p-4">
|
|
<div class="flex items-center justify-center gap-1" onclick="event.stopPropagation();">
|
|
<a href="{% url 'physicians:physician_detail' physician.id %}"
|
|
class="w-8 h-8 flex items-center justify-center rounded-lg bg-blue/10 text-blue hover:bg-blue hover:text-white transition"
|
|
title="{% trans 'View' %}">
|
|
<i data-lucide="eye" class="w-4 h-4"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="8" class="p-12 text-center">
|
|
<div class="flex flex-col items-center justify-center">
|
|
<div class="w-20 h-20 bg-slate-100 rounded-full flex items-center justify-center mb-4">
|
|
<i data-lucide="stethoscope" class="w-10 h-10 text-slate-300"></i>
|
|
</div>
|
|
<p class="text-slate font-medium mb-2">{% trans "No physicians found" %}</p>
|
|
<p class="text-slate text-sm">{% trans "Try adjusting your filters" %}</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if page_obj.has_other_pages %}
|
|
<div class="bg-slate-50 px-8 py-4 flex items-center justify-between border-t border-slate-200">
|
|
<div class="flex items-center gap-4">
|
|
<span class="text-xs text-slate font-medium">
|
|
{% trans "Showing" %} <span class="font-bold text-navy">{{ page_obj.start_index }}-{{ page_obj.end_index }}</span> {% trans "of" %} <span class="font-bold text-navy">{{ page_obj.paginator.count }}</span> {% trans "entries" %}
|
|
</span>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
{% if page_obj.has_previous %}
|
|
<a href="?page={{ page_obj.previous_page_number }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}"
|
|
class="w-8 h-8 flex items-center justify-center rounded-lg border bg-white hover:bg-slate-50 transition">
|
|
<i data-lucide="chevron-left" class="w-4 h-4 text-slate"></i>
|
|
</a>
|
|
{% else %}
|
|
<span class="w-8 h-8 flex items-center justify-center rounded-lg border bg-slate-100 text-slate-300 cursor-not-allowed">
|
|
<i data-lucide="chevron-left" class="w-4 h-4"></i>
|
|
</span>
|
|
{% endif %}
|
|
|
|
{% for num in page_obj.paginator.page_range %}
|
|
{% if num == page_obj.number %}
|
|
<span class="w-8 h-8 flex items-center justify-center rounded-lg bg-navy text-white text-xs font-bold">{{ num }}</span>
|
|
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
|
|
<a href="?page={{ num }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}"
|
|
class="w-8 h-8 flex items-center justify-center rounded-lg border bg-white hover:bg-slate-50 text-xs font-bold text-slate transition">
|
|
{{ num }}
|
|
</a>
|
|
{% elif num == 1 or num == page_obj.paginator.num_pages %}
|
|
<a href="?page={{ num }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}"
|
|
class="w-8 h-8 flex items-center justify-center rounded-lg border bg-white hover:bg-slate-50 text-xs font-bold text-slate transition">
|
|
{{ num }}
|
|
</a>
|
|
{% elif num == page_obj.number|add:'-3' or num == page_obj.number|add:'3' %}
|
|
<span class="w-8 h-8 flex items-center justify-center text-xs text-slate">...</span>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if page_obj.has_next %}
|
|
<a href="?page={{ page_obj.next_page_number }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}"
|
|
class="w-8 h-8 flex items-center justify-center rounded-lg border bg-white hover:bg-slate-50 transition">
|
|
<i data-lucide="chevron-right" class="w-4 h-4 text-slate"></i>
|
|
</a>
|
|
{% else %}
|
|
<span class="w-8 h-8 flex items-center justify-center rounded-lg border bg-slate-100 text-slate-300 cursor-not-allowed">
|
|
<i data-lucide="chevron-right" class="w-4 h-4"></i>
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</section>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block extra_js %}
|
|
<script>
|
|
lucide.createIcons();
|
|
</script>
|
|
{% endblock %} |