{% extends "base.html" %} {% block title %}Dashboard{% endblock %} {% block body %}
{% with messages = get_flashed_messages(with_categories=true) %} {% for cat, msg in messages %}
{{ msg }}
{% endfor %} {% endwith %} {# ── ADMIN DASHBOARD ──────────────────────────────────────────────────── #} {% if role == 'admin' %}

βš™οΈ Admin Panel

{{ admin_cards.students }}
Total Students
Manage β†’
{{ admin_cards.teachers }}
Teachers
Manage β†’
{{ admin_cards.no_class }}
No-Class UIDs
View β†’
{{ admin_cards.logs }}
System Logs
View β†’
✏️
Manual Attendance Override
Manually set attendance for any student in case of damaged ID cards, QR code issues, or any other related circumstances.
πŸ“
Audit Trail
View all manually recorded changes made for any reason in this section.
{# ── PRINCIPAL + TEACHER DASHBOARD ───────────────────────────────────── #} {% else %}
⚠️ Notice: Attendance records are retained on the server for a maximum period of 90 days only. Download reports before automatic deletion.
{% if role == 'principal' %} {% endif %}
{% if role == 'principal' %} {% endif %}
{{ total }}
Total Students
{{ present }}
Present
{{ absent }}
Absent
{{ late }}
Late Entry
{# ── PRINCIPAL CLASS-WISE SUMMARY (RESTORED) ───────────────────────── #} {% if role == 'principal' and class_summary %}

πŸ“š Class-wise Summary β€” {{ date }}{% if selected_class %} (Class {{ selected_class }}){% endif %}{% if selected_section %} (Section {{ selected_section }}){% endif %}

{% for i, row in enumerate(class_summary, 1) %} {% endfor %}
# Class Section Present
{{ i }} {{ row["class"] }} {{ row["section"] or "–" }} {{ row["cnt"] }}
{% endif %}

πŸ“‹ Attendance β€” {{ date }} ({{ rows|length }} records) {% if role == 'teacher' %} | Class {{ user_class }}{% endif %}

{% for i, row in enumerate(rows, 1) %} {% set st = row["status"] or "Absent" %} {% set _ds = ((row["roll_no"]|string if row["roll_no"] else "") ~ " " ~ (row["name"] or "") ~ " " ~ (row["class"]|string if row["class"] else "") ~ " " ~ (row["section"] or "") ~ " " ~ st ~ " " ~ (row["remark"] or ""))|lower %} {% else %} {% endfor %}
# Roll Name Class Sec Gate Time In Time Out Status Remark
{{ i }} {{ row["roll_no"] or "–" }} {{ row["name"] or "-" }} {{ row["class"] }} {{ row["section"] or "–" }} {% set g = row["gate"] or "" %} {% if g == "Gate-1" %} {{ g }} {% elif g == "Gate-2" %} {{ g }} {% elif g == "Gate-3" %} {{ g }} {% elif g %} {{ g }} {% else %} – {% endif %} {{ row["time_in"] or "–" }} {{ row["time_out"] or "–" }} {{ st }} {{ row["remark"] or "" }}
No students found for {{ date }}
{% if role == 'principal' %}

❓ No UID Match (No-Class) β€” {{ no_class_count }} total  View All

{% endif %} {% endif %}{# end admin/non-admin #}
{% endblock %}