feat: Implement supervisor trainee management features, including search, add, and remove functionalities

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Ross
2026-04-29 22:27:09 +01:00
co-authored by Copilot
parent f63f3b3687
commit 89c8cd565f
10 changed files with 500 additions and 82 deletions
+62 -62
View File
@@ -2,11 +2,11 @@
{% load static %}
{% block css %}
{{ block.super }}
<style>
.collapse-chevron { transition: transform .2s ease; }
[aria-expanded="true"] .collapse-chevron { transform: rotate(-180deg); }
</style>
{{ block.super }}
<style>
.collapse-chevron { transition: transform .2s ease; }
[aria-expanded="true"] .collapse-chevron { transform: rotate(-180deg); }
</style>
{% endblock %}
{% block content %}
@@ -99,70 +99,70 @@
<i class="bi bi-chevron-down ms-2 small collapse-chevron" aria-hidden="true"></i>
</button>
<div class="collapse" id="group-{{ forloop.counter }}">
<div class="table-responsive mt-2">
<table class="table table-hover table-sm align-middle mb-0">
<thead class="table-dark">
<tr>
{% if group_by == 'user' %}
<th>Collection</th>
{% else %}
<th>Learner</th>
{% endif %}
<th>Started</th>
<th>Ended</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for attempt, collection in attempt_rows %}
<div class="table-responsive mt-2">
<table class="table table-hover table-sm align-middle mb-0">
<thead class="table-dark">
<tr>
{% if group_by == 'user' %}
<td>
{% if collection %}{{ collection.name }}{% else %}<span class="text-muted">Unknown</span>{% endif %}
</td>
<th>Collection</th>
{% else %}
<td>
{% if attempt.user_user %}
{{ attempt.user_user.get_full_name|default:attempt.user_user.username }}
{% if attempt.user_user.email %}
<br><span class="text-muted small">{{ attempt.user_user.email }}</span>
<th>Learner</th>
{% endif %}
<th>Started</th>
<th>Ended</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for attempt, collection in attempt_rows %}
<tr>
{% if group_by == 'user' %}
<td>
{% if collection %}{{ collection.name }}{% else %}<span class="text-muted">Unknown</span>{% endif %}
</td>
{% else %}
<td>
{% if attempt.user_user %}
{{ attempt.user_user.get_full_name|default:attempt.user_user.username }}
{% if attempt.user_user.email %}
<br><span class="text-muted small">{{ attempt.user_user.email }}</span>
{% endif %}
{% elif attempt.cid_user %}
CID {{ attempt.cid_user.cid }}
{% if attempt.cid_user.name %}<br><span class="text-muted small">{{ attempt.cid_user.name }}</span>{% endif %}
{% else %}
<span class="text-muted">Unknown</span>
{% endif %}
{% elif attempt.cid_user %}
CID {{ attempt.cid_user.cid }}
{% if attempt.cid_user.name %}<br><span class="text-muted small">{{ attempt.cid_user.name }}</span>{% endif %}
</td>
{% endif %}
<td class="small text-nowrap">{{ attempt.start_time|default:"-" }}</td>
<td class="small text-nowrap">{{ attempt.end_time|default:"-" }}</td>
<td>
{% if attempt.completed %}
<span class="badge bg-success">Completed</span>
{% else %}
<span class="text-muted">Unknown</span>
<span class="badge bg-warning text-dark">In progress</span>
{% endif %}
</td>
{% endif %}
<td class="small text-nowrap">{{ attempt.start_time|default:"-" }}</td>
<td class="small text-nowrap">{{ attempt.end_time|default:"-" }}</td>
<td>
{% if attempt.completed %}
<span class="badge bg-success">Completed</span>
{% else %}
<span class="badge bg-warning text-dark">In progress</span>
{% endif %}
</td>
<td>
{% if attempt.user_user_id and collection %}
<a class="btn btn-sm btn-outline-primary"
href="{% url 'atlas:collection_history_user' exam_id=collection.pk user_pk=attempt.user_user_id %}">
View attempt
</a>
{% else %}
<a class="btn btn-sm btn-outline-primary"
href="{% url 'atlas:collection_shared_attempt_overview' attempt.pk %}">
View attempt
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<td>
{% if attempt.user_user_id and collection %}
<a class="btn btn-sm btn-outline-primary"
href="{% url 'atlas:collection_history_user' exam_id=collection.pk user_pk=attempt.user_user_id %}">
View attempt
</a>
{% else %}
<a class="btn btn-sm btn-outline-primary"
href="{% url 'atlas:collection_shared_attempt_overview' attempt.pk %}">
View attempt
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>{# /collapse #}
</div>
{% endfor %}