HH/templates/analytics/kpi_list.html
2025-12-24 12:42:31 +03:00

130 lines
5.4 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}KPI Definitions - PX360{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h2 class="mb-1">
<i class="bi bi-speedometer text-primary me-2"></i>
KPI Definitions
</h2>
<p class="text-muted mb-0">Manage key performance indicators</p>
</div>
</div>
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead class="table-light">
<tr>
<th>Name</th>
<th>Category</th>
<th>Unit</th>
<th>Target</th>
<th>Thresholds</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for kpi in kpis %}
<tr>
<td>
<strong>{{ kpi.name }}</strong><br>
{% if kpi.description %}
<small class="text-muted">{{ kpi.description|truncatewords:15 }}</small>
{% endif %}
</td>
<td><span class="badge bg-secondary">{{ kpi.get_category_display }}</span></td>
<td><small>{{ kpi.unit }}</small></td>
<td>
{% if kpi.target_value %}
<strong>{{ kpi.target_value }}</strong>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
{% if kpi.warning_threshold or kpi.critical_threshold %}
<small>
{% if kpi.warning_threshold %}
<span class="badge bg-warning">Warning: {{ kpi.warning_threshold }}</span>
{% endif %}
{% if kpi.critical_threshold %}
<span class="badge bg-danger">Critical: {{ kpi.critical_threshold }}</span>
{% endif %}
</small>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
{% if kpi.is_active %}
<span class="badge bg-success">Active</span>
{% else %}
<span class="badge bg-secondary">Inactive</span>
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td colspan="6" class="text-center py-5">
<i class="bi bi-speedometer" style="font-size: 3rem; color: #ccc;"></i>
<p class="text-muted mt-3">No KPIs defined</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% if page_obj.has_other_pages %}
<nav aria-label="KPIs pagination" class="mt-4">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">
<i class="bi bi-chevron-left"></i>
</a>
</li>
{% endif %}
{% for num in page_obj.paginator.page_range %}
{% if page_obj.number == num %}
<li class="page-item active"><span class="page-link">{{ num }}</span></li>
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
<li class="page-item">
<a class="page-link" href="?page={{ num }}">{{ num }}</a>
</li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">
<i class="bi bi-chevron-right"></i>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
{% endblock %}
</final_file_content>
IMPORTANT: For any future changes to this file, use the final_file_content shown above as your reference. This content reflects the current state of the file, including any auto-formatting (e.g., if you used single quotes but the formatter converted them to double quotes). Always base your SEARCH/REPLACE operations on this final version to ensure accuracy.
</function_calls>
<function_calls>
<invoke name="read_file">
<parameter name="path">apps/analytics/urls.py