HH/templates/physicians/department_overview.html
Marwan Alwali 867f60fed7 update
2026-01-08 20:56:18 +03:00

178 lines
8.5 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Department Overview" %} - {% trans "Physicians" %} - PX360{% endblock %}
{% block content %}
<div class="container-fluid">
<!-- Header -->
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'physicians:physician_list' %}">{% trans "Physicians" %}</a></li>
<li class="breadcrumb-item active">{% trans "Department Overview" %}</li>
</ol>
</nav>
<h2 class="mb-1">
<i class="bi bi-building text-primary me-2"></i>
{% trans "Department Overview" %}
</h2>
<p class="text-muted mb-0">{% trans "Performance by department for" %} {{ year }}-{{ month|stringformat:"02d" }}</p>
</div>
<div>
<a href="{% url 'physicians:specialization_overview' %}" class="btn btn-outline-secondary me-2">
<i class="bi bi-diagram-3 me-2"></i>{% trans "Specialization View" %}
</a>
<a href="{% url 'physicians:physician_list' %}" class="btn btn-outline-primary">
<i class="bi bi-arrow-left me-2"></i>{% trans "Back to Physicians" %}
</a>
</div>
</div>
<!-- Filters -->
<div class="card mb-4">
<div class="card-body">
<form method="get" class="row g-3">
<div class="col-md-3">
<label class="form-label">{% trans "Year" %}</label>
<input type="number" name="year" class="form-control"
value="{{ year }}" min="2020" max="2030">
</div>
<div class="col-md-3">
<label class="form-label">{% trans "Month" %}</label>
<select name="month" class="form-select">
{% for m in "123456789012"|make_list %}
<option value="{{ forloop.counter }}" {% if month == forloop.counter %}selected{% endif %}>
{{ forloop.counter|stringformat:"02d" }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-4">
<label class="form-label">{% trans "Hospital" %}</label>
<select name="hospital" class="form-select">
<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 class="col-md-2 d-flex align-items-end">
<button type="submit" class="btn btn-primary w-100">
<i class="bi bi-search me-2"></i>{% trans "Filter" %}
</button>
</div>
</form>
</div>
</div>
<!-- Departments -->
{% if departments %}
{% for dept_data in departments %}
<div class="card mb-4">
<div class="card-header bg-light">
<div class="row align-items-center">
<div class="col-md-4">
<h5 class="mb-0">
<i class="bi bi-building text-primary me-2"></i>
{{ dept_data.department.name }}
</h5>
<small class="text-muted">{{ dept_data.department.hospital.name }}</small>
</div>
<div class="col-md-8">
<div class="row text-center">
<div class="col-3">
<strong class="text-success fs-4">{{ dept_data.average_rating|floatformat:2 }}</strong>
<br><small class="text-muted">{% trans "Avg Rating" %}</small>
</div>
<div class="col-3">
<strong class="fs-4">{{ dept_data.total_physicians }}</strong>
<br><small class="text-muted">{% trans "Physicians" %}</small>
</div>
<div class="col-3">
<strong class="fs-4">{{ dept_data.total_surveys }}</strong>
<br><small class="text-muted">{% trans "Surveys" %}</small>
</div>
<div class="col-3">
<div class="d-flex gap-1 justify-content-center">
<span class="badge bg-success">{{ dept_data.positive_count }}</span>
<span class="badge bg-warning">{{ dept_data.neutral_count }}</span>
<span class="badge bg-danger">{{ dept_data.negative_count }}</span>
</div>
<small class="text-muted">{% trans "Sentiment" %}</small>
</div>
</div>
</div>
</div>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover table-sm mb-0">
<thead class="table-light">
<tr>
<th>{% trans "Rank" %}</th>
<th>{% trans "Physician" %}</th>
<th>{% trans "Specialization" %}</th>
<th>{% trans "Rating" %}</th>
<th>{% trans "Surveys" %}</th>
<th>{% trans "Dept Rank" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for rating in dept_data.physicians %}
<tr onclick="window.location='{% url 'physicians:physician_detail' rating.staff.id %}'" style="cursor: pointer;">
<td>
{% if forloop.counter <= 3 %}
<strong class="text-primary">#{{ forloop.counter }}</strong>
{% else %}
<span class="text-muted">#{{ forloop.counter }}</span>
{% endif %}
</td>
<td>
<strong>{{ rating.staff.get_full_name }}</strong><br>
<small class="text-muted">{{ rating.staff.license_number }}</small>
</td>
<td>{{ rating.staff.specialization }}</td>
<td>
<strong class="text-success">{{ rating.average_rating|floatformat:2 }}</strong>
</td>
<td>
<span class="badge bg-light text-dark">{{ rating.total_surveys }}</span>
</td>
<td>
{% if rating.department_rank %}
<span class="badge bg-info">#{{ rating.department_rank }}</span>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td onclick="event.stopPropagation();">
<a href="{% url 'physicians:physician_detail' rating.staff.id %}"
class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="card">
<div class="card-body text-center py-5">
<i class="bi bi-inbox" style="font-size: 3rem; color: #ccc;"></i>
<p class="text-muted mt-3">{% trans "No department data available for this period" %}</p>
</div>
</div>
{% endif %}
</div>
{% endblock %}