hospital-management/templates/extras/lab_test_list.html
2025-08-12 13:33:25 +03:00

176 lines
9.8 KiB
HTML

{% extends 'base.html' %}
{% load static %}
{% block title %}Laboratory Tests{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">Laboratory Tests</h1>
<a href="{% url 'laboratory:lab_test_create' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> Add New Test
</a>
</div>
</div>
</div>
<!-- Search and Filter Form -->
<div class="row mb-4">
<div class="col-12">
<div class="card">
<div class="card-body">
<form method="get" class="row">
<div class="col-md-4">
<input type="text" name="search" class="form-control"
placeholder="Search tests..." value="{{ search_query }}">
</div>
<div class="col-md-3">
<select name="category" class="form-control">
<option value="">All Categories</option>
{% for value, label in categories %}
<option value="{{ value }}" {% if request.GET.category == value %}selected{% endif %}>
{{ label }}
</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<div class="form-check">
<input type="checkbox" name="active_only" class="form-check-input"
{% if request.GET.active_only %}checked{% endif %}>
<label class="form-check-label">Active Only</label>
</div>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-outline-primary">
<i class="fas fa-search"></i> Search
</button>
<a href="{% url 'laboratory:lab_test_list' %}" class="btn btn-outline-secondary">
<i class="fas fa-times"></i> Clear
</a>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Tests Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
{% if lab_tests %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Test Code</th>
<th>Test Name</th>
<th>Category</th>
<th>Specimen Type</th>
<th>Turnaround Time</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for test in lab_tests %}
<tr>
<td>
<strong>{{ test.test_code }}</strong>
</td>
<td>
<a href="{% url 'laboratory:lab_test_detail' test.pk %}">
{{ test.test_name }}
</a>
{% if test.test_description %}
<br><small class="text-muted">{{ test.test_description|truncatechars:50 }}</small>
{% endif %}
</td>
<td>
<span class="badge badge-secondary">{{ test.get_category_display }}</span>
</td>
<td>{{ test.get_specimen_type_display }}</td>
<td>{{ test.turnaround_time_hours }} hours</td>
<td>
{% if test.is_active %}
<span class="badge badge-success">Active</span>
{% else %}
<span class="badge badge-secondary">Inactive</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'laboratory:lab_test_detail' test.pk %}"
class="btn btn-outline-info" title="View Details">
<i class="fas fa-eye"></i>
</a>
<a href="{% url 'laboratory:lab_test_update' test.pk %}"
class="btn btn-outline-primary" title="Edit">
<i class="fas fa-edit"></i>
</a>
{% if test.is_active %}
<a href="{% url 'laboratory:lab_test_delete' test.pk %}"
class="btn btn-outline-danger" title="Deactivate">
<i class="fas fa-ban"></i>
</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if is_paginated %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.category %}&category={{ request.GET.category }}{% endif %}{% if request.GET.active_only %}&active_only=on{% endif %}">First</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.category %}&category={{ request.GET.category }}{% endif %}{% if request.GET.active_only %}&active_only=on{% endif %}">Previous</a>
</li>
{% endif %}
<li class="page-item active">
<span class="page-link">
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
</span>
</li>
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.category %}&category={{ request.GET.category }}{% endif %}{% if request.GET.active_only %}&active_only=on{% endif %}">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.category %}&category={{ request.GET.category }}{% endif %}{% if request.GET.active_only %}&active_only=on{% endif %}">Last</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<div class="text-center py-4">
<i class="fas fa-vial fa-3x text-muted mb-3"></i>
<h5 class="text-muted">No laboratory tests found</h5>
<p class="text-muted">Start by adding your first laboratory test.</p>
<a href="{% url 'laboratory:lab_test_create' %}" class="btn btn-primary">
<i class="fas fa-plus"></i> Add First Test
</a>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}