|
{% extends "admin/base.html" %}
|
|
|
|
{% block title %}Отчеты анализа{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="admin-header">
|
|
<h1><i class="fas fa-chart-bar"></i> Отчеты анализа</h1>
|
|
<div class="admin-actions">
|
|
<form class="filter-form" method="get" action="{{ url_for('admin_bp.view_reports') }}">
|
|
<select class="form-select" name="emotion" onchange="this.form.submit()">
|
|
<option value="">Все эмоции</option>
|
|
{% for emotion in emotions %}
|
|
<option value="{{ emotion.emotion }}" {% if emotion.emotion == current_emotion %}selected{% endif %}>
|
|
{{ emotion_map.get(emotion.emotion, emotion.emotion) }}
|
|
</option>
|
|
{% endfor %}
|
|
</select>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Пользователь</th>
|
|
<th>Текст</th>
|
|
<th>Эмоция</th>
|
|
<th>Уверенность</th>
|
|
<th>Дата</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for report in reports.items %}
|
|
<tr>
|
|
<td>{{ report.id }}</td>
|
|
<td>{{ report.user.username }}</td>
|
|
<td class="text-truncate" style="max-width: 200px;" title="{{ report.content }}">
|
|
{{ report.content }}
|
|
</td>
|
|
<td>
|
|
<span class="badge" style="background: {{ get_emotion_color(report.emotion) }}">
|
|
{{ emotion_map.get(report.emotion, report.emotion) }}
|
|
</span>
|
|
</td>
|
|
<td>{{ (report.confidence * 100)|round(1) }}%</td>
|
|
<td>{{ report.created_at|datetimeformat }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
<nav aria-label="Page navigation">
|
|
<ul class="pagination justify-content-center">
|
|
{% if reports.has_prev %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('admin_bp.view_reports', page=reports.prev_num, emotion=current_emotion) }}">
|
|
«
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{% for page_num in reports.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=3) %}
|
|
{% if page_num %}
|
|
<li class="page-item {% if page_num == reports.page %}active{% endif %}">
|
|
<a class="page-link" href="{{ url_for('admin_bp.view_reports', page=page_num, emotion=current_emotion) }}">
|
|
{{ page_num }}
|
|
</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item disabled"><span class="page-link">...</span></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if reports.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('admin_bp.view_reports', page=reports.next_num, emotion=current_emotion) }}">
|
|
»
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
{% endblock %} |