69 lines
3.5 KiB
HTML
69 lines
3.5 KiB
HTML
{% if kpis %}
|
|
<div class="row">
|
|
{% for kpi in kpis %}
|
|
<div class="col-lg-3 col-md-6 mb-3">
|
|
<div class="card border-{% if kpi.current_value >= kpi.target_value %}success{% elif kpi.current_value >= kpi.target_value|floatformat:0|mul:0.8 %}warning{% else %}danger{% endif %}">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div class="flex-grow-1">
|
|
<h6 class="card-title text-{% if kpi.current_value >= kpi.target_value %}success{% elif kpi.current_value >= kpi.target_value|floatformat:0|mul:0.8 %}warning{% else %}danger{% endif %}">
|
|
{{ kpi.kpi_name }}
|
|
</h6>
|
|
<h4 class="mb-1">
|
|
{% if kpi.unit == 'PERCENTAGE' %}
|
|
{{ kpi.current_value|floatformat:1 }}%
|
|
{% elif kpi.unit == 'CURRENCY' %}
|
|
${{ kpi.current_value|floatformat:0 }}
|
|
{% elif kpi.unit == 'COUNT' %}
|
|
{{ kpi.current_value|floatformat:0 }}
|
|
{% else %}
|
|
{{ kpi.current_value|floatformat:2 }}
|
|
{% endif %}
|
|
</h4>
|
|
<small class="text-muted">
|
|
Target:
|
|
{% if kpi.unit == 'PERCENTAGE' %}
|
|
{{ kpi.target_value|floatformat:1 }}%
|
|
{% elif kpi.unit == 'CURRENCY' %}
|
|
${{ kpi.target_value|floatformat:0 }}
|
|
{% elif kpi.unit == 'COUNT' %}
|
|
{{ kpi.target_value|floatformat:0 }}
|
|
{% else %}
|
|
{{ kpi.target_value|floatformat:2 }}
|
|
{% endif %}
|
|
</small>
|
|
</div>
|
|
<div class="text-end">
|
|
{% if kpi.current_value >= kpi.target_value %}
|
|
<i class="fas fa-arrow-up text-success"></i>
|
|
{% elif kpi.current_value >= kpi.target_value|floatformat:0|mul:0.8 %}
|
|
<i class="fas fa-minus text-warning"></i>
|
|
{% else %}
|
|
<i class="fas fa-arrow-down text-danger"></i>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="progress mt-2" style="height: 4px;">
|
|
{% widthratio kpi.current_value kpi.target_value 100 as progress_percent %}
|
|
<div class="progress-bar bg-{% if kpi.current_value >= kpi.target_value %}success{% elif kpi.current_value >= kpi.target_value|floatformat:0|mul:0.8 %}warning{% else %}danger{% endif %}"
|
|
role="progressbar"
|
|
style="width: {% if progress_percent > 100 %}100{% else %}{{ progress_percent }}{% endif %}%">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div class="text-center py-4">
|
|
<i class="fas fa-chart-line fa-3x text-muted mb-3"></i>
|
|
<h5 class="text-muted">No KPIs Configured</h5>
|
|
<p class="text-muted">Key Performance Indicators will be displayed here once configured.</p>
|
|
<a href="{% url 'analytics:kpi_list' %}" class="btn btn-outline-primary">
|
|
Configure KPIs
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
|