HH/templates/callcenter/interaction_list.html
2025-12-24 12:42:31 +03:00

159 lines
7.0 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}Call Center - 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-telephone text-success me-2"></i>
Call Center
</h2>
<p class="text-muted mb-0">Monitor call center interactions and satisfaction</p>
</div>
</div>
<!-- Statistics Cards -->
<div class="row mb-4">
<div class="col-md-4">
<div class="card border-left-primary">
<div class="card-body">
<h6 class="text-muted mb-1">Total Calls</h6>
<h3 class="mb-0">{{ stats.total }}</h3>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card border-left-success">
<div class="card-body">
<h6 class="text-muted mb-1">Avg Satisfaction</h6>
<h3 class="mb-0">{{ stats.avg_satisfaction|floatformat:1 }}/5.0</h3>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card border-left-danger">
<div class="card-body">
<h6 class="text-muted mb-1">Low Ratings</h6>
<h3 class="mb-0 text-danger">{{ stats.low_rating }}</h3>
</div>
</div>
</div>
</div>
<!-- Interactions Table -->
<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>Caller</th>
<th>Subject</th>
<th>Type</th>
<th>Agent</th>
<th>Rating</th>
<th>Duration</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for interaction in interactions %}
<tr onclick="window.location='{% url 'callcenter:interaction_detail' interaction.id %}'" style="cursor: pointer;">
<td>
{% if interaction.patient %}
<strong>{{ interaction.patient.get_full_name }}</strong><br>
<small class="text-muted">MRN: {{ interaction.patient.mrn }}</small>
{% else %}
<strong>{{ interaction.caller_name }}</strong><br>
<small class="text-muted">{{ interaction.caller_phone }}</small>
{% endif %}
</td>
<td>{{ interaction.subject|truncatewords:8 }}</td>
<td><span class="badge bg-info">{{ interaction.get_call_type_display }}</span></td>
<td>
{% if interaction.agent %}
<small>{{ interaction.agent.get_full_name }}</small>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
{% if interaction.satisfaction_rating %}
<span class="badge {% if interaction.is_low_rating %}bg-danger{% else %}bg-success{% endif %}">
{{ interaction.satisfaction_rating }}/5
</span>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
{% if interaction.call_duration_seconds %}
<small>{{ interaction.call_duration_seconds|floatformat:0 }}s</small>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td><small>{{ interaction.call_started_at|date:"M d, Y H:i" }}</small></td>
<td onclick="event.stopPropagation();">
<a href="{% url 'callcenter:interaction_detail' interaction.id %}"
class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="text-center py-5">
<i class="bi bi-telephone" style="font-size: 3rem; color: #ccc;"></i>
<p class="text-muted mt-3">No interactions found</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<!-- Pagination -->
{% if page_obj.has_other_pages %}
<nav aria-label="Interactions 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 }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}">
<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 }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}">
{{ 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 }}{% for key, value in filters.items %}&{{ key }}={{ value }}{% endfor %}">
<i class="bi bi-chevron-right"></i>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
{% endblock %}