studentperformanceml / templates /admin_dashboard.html
triflix's picture
Upload 22 files
9173642 verified
{% extends "base.html" %}
{% block title %}Admin Dashboard{% endblock %}
{% block content %}
<div class="bg-white p-6 rounded shadow">
<h2 class="text-2xl font-bold mb-4">Admin Panel</h2>
<p class="mb-4"><strong>Total Users:</strong> {{ total_users }}</p>
<table class="w-full table-auto border-collapse">
<thead>
<tr class="bg-gray-100">
<th class="p-2">ID</th>
<th class="p-2">Name</th>
<th class="p-2">Email</th>
<th class="p-2">Last CGPA</th>
<th class="p-2">Actions</th>
</tr>
</thead>
<tbody>
{% for u in users %}
{% set last = u.id | tojson | int and (crud.get_predictions(u.id)|last) %}
<tr class="hover:bg-gray-50">
<td class="p-2">{{ u.id }}</td>
<td class="p-2">{{ u.name }}</td>
<td class="p-2">{{ u.email }}</td>
<td class="p-2 text-center">
{% if last %}
<span class="px-2 py-1 rounded
{% if last.predicted < 6 %}bg-red-200 text-red-800{% else %}bg-green-200 text-green-800{% endif %}">
{{ last.predicted | round(2) }}
</span>
{% else %}
β€”
{% endif %}
</td>
<td class="p-2 space-x-2">
<form class="inline" method="post" action="/admin/user/delete">
<input type="hidden" name="user_id" value="{{ u.id }}">
<button class="px-2 py-1 bg-red-600 text-white rounded hover:bg-red-700">
Delete
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}