153 lines
7.6 KiB
HTML
153 lines
7.6 KiB
HTML
{% extends "layouts/base.html" %}
|
|
|
|
{% block title %}Patient Comments - PX360{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid py-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<div>
|
|
<h2>Step 1 — Classified Patient Comments</h2>
|
|
<p class="text-muted">Classified comments with categories and sentiment</p>
|
|
</div>
|
|
<div class="d-flex gap-2">
|
|
<a href="{% url 'feedback:export_comments_step1' %}?{{ request.GET.urlencode }}"
|
|
class="btn btn-outline-primary btn-sm">
|
|
<i class="bi bi-download me-1"></i> Export Classification
|
|
</a>
|
|
<a href="{% url 'feedback:export_comments_step2' %}?{{ request.GET.urlencode }}"
|
|
class="btn btn-outline-success btn-sm">
|
|
<i class="bi bi-download me-1"></i> Export by Dept
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<form method="get" class="row g-3 align-items-end">
|
|
<div class="col-md-2">
|
|
<label class="form-label">Classification</label>
|
|
<select name="classification" class="form-select">
|
|
<option value="">All</option>
|
|
{% for val, label in classifications %}
|
|
<option value="{{ val }}" {% if selected_classification == val %}selected{% endif %}>{{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label class="form-label">Sub-Category</label>
|
|
<select name="sub_category" class="form-select">
|
|
<option value="">All</option>
|
|
{% for val, label in sub_categories %}
|
|
<option value="{{ val }}" {% if selected_sub_category == val %}selected{% endif %}>{{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label class="form-label">Sentiment</label>
|
|
<select name="sentiment" class="form-select">
|
|
<option value="">All</option>
|
|
{% for val, label in sentiments %}
|
|
<option value="{{ val }}" {% if selected_sentiment == val %}selected{% endif %}>{{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<label class="form-label">Source</label>
|
|
<select name="source_category" class="form-select">
|
|
<option value="">All</option>
|
|
{% for val, label in source_categories %}
|
|
<option value="{{ val }}" {% if selected_source_category == val %}selected{% endif %}>{{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<label class="form-label">Year</label>
|
|
<select name="year" class="form-select">
|
|
<option value="">All</option>
|
|
{% for y in years_range %}
|
|
<option value="{{ y }}" {% if selected_year == y %}selected{% endif %}>{{ y }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<label class="form-label">Month</label>
|
|
<select name="month" class="form-select">
|
|
<option value="">All</option>
|
|
{% for m in months_range %}
|
|
<option value="{{ m }}" {% if selected_month == m %}selected{% endif %}>{{ m }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<button type="submit" class="btn btn-outline-primary w-100">
|
|
<i class="bi bi-funnel me-1"></i> Filter
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
Comments ({{ page_obj.paginator.count }} total)
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Source</th>
|
|
<th>Comment</th>
|
|
<th>Classification</th>
|
|
<th>Sub-Category</th>
|
|
<th>Sentiment</th>
|
|
<th>Negative</th>
|
|
<th>Positive</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for c in page_obj %}
|
|
<tr>
|
|
<td>{{ c.serial_number }}</td>
|
|
<td>{{ c.get_source_category_display }}</td>
|
|
<td class="text-truncate" style="max-width:250px" title="{{ c.comment_text }}">{{ c.comment_text }}</td>
|
|
<td><span class="badge bg-info">{{ c.get_classification_display }}</span></td>
|
|
<td>{{ c.get_sub_category_display }}</td>
|
|
<td>
|
|
{% if c.sentiment == 'negative' %}<span class="badge bg-danger">{% elif c.sentiment == 'positive' %}<span class="badge bg-success">{% elif c.sentiment == 'neutral' %}<span class="badge bg-warning">{% else %}<span class="badge bg-secondary">{% endif %}{{ c.get_sentiment_display }}</span>
|
|
</td>
|
|
<td class="text-truncate" style="max-width:150px">{{ c.negative_keywords }}</td>
|
|
<td class="text-truncate" style="max-width:150px">{{ c.positive_keywords }}</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr><td colspan="8" class="text-center text-muted py-4">No comments found.</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{% if page_obj.has_other_pages %}
|
|
<div class="card-footer d-flex justify-content-between">
|
|
<span class="text-muted">Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
|
|
<nav>
|
|
<ul class="pagination pagination-sm mb-0">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}&{{ request.GET.urlencode }}">«</a></li>
|
|
{% endif %}
|
|
{% for num in page_obj.paginator.page_range %}
|
|
<li class="page-item {% if page_obj.number == num %}active{% endif %}">
|
|
<a class="page-link" href="?page={{ num }}&{{ request.GET.urlencode }}">{{ num }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
{% if page_obj.has_next %}
|
|
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}&{{ request.GET.urlencode }}">»</a></li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|