{# pages/dashboard.html — Tailwind-first dashboard (no legacy classes, no inline styles) #} {% extends "base.html" %} {% block title %}{{ title | default("Admin") }} — Dashboard{% endblock %} {% block content %} {% set _tile = { 'Categories': 'bg-teal-500/10 text-teal-500', 'Products': 'bg-violet-500/10 text-violet-500', 'Users': 'bg-blue-500/10 text-blue-500', 'Orders': 'bg-orange-500/10 text-orange-500', 'Order Items': 'bg-emerald-500/10 text-emerald-500', 'Admin Field Permissions': 'bg-yellow-500/10 text-yellow-500', 'Admin Permissions': 'bg-red-500/10 text-red-500', 'Admin Users': 'bg-indigo-500/10 text-indigo-500', 'Admin Audit Logs': 'bg-cyan-500/10 text-cyan-500', 'Admin Roles': 'bg-pink-500/10 text-pink-500' } %}
{# ─── Page Header ─── #}

Dashboard

Welcome back, Admin! Here's what's happening with your store today.

System Online
{# ─── Stat Cards ─── #}
{% for card in stat_cards %} {% set _color = _tile[card.title] | default('bg-teal-500/10 text-teal-500') %}
{{ icon(card.icon, size="20px") }}
{{ card.title }}
{{ card.count }}
Total {{ card.title | lower }} {% if card.has_trend %} {% if card.trend_direction == 'up' %}{{ icon('arrow-up', size="10px") }}{% else %}{{ icon('arrow-down', size="10px") }}{% endif %} {{ card.trend_pct }}% vs last 30 days {% endif %}
{# Wave decoration #}
{% endfor %}
{# ─── Bottom Grid: Activity + Quick Actions ─── #}
{# Recent Activity #}
{{ icon('clock', size="18px") }}

Recent Activity

Latest system activities will appear here

{% if recent_audit %} View all {{ icon('chevron-right', size="14px") }} {% endif %}
{% if recent_audit %}
{% for entry in recent_audit %}
{% if entry.action == 'CREATE' %}
{{ icon('plus', size="16px") }}
{% elif entry.action == 'UPDATE' %}
{{ icon('pencil', size="16px") }}
{% elif entry.action == 'DELETE' %}
{{ icon('trash', size="16px") }}
{% endif %}
{{ entry.user_email | default("System") }} {{ entry.action | lower }}d {{ entry.model_name }} #{{ entry.object_id }}
{{ entry.timestamp }}
{% endfor %}
{% else %}
{{ icon('clock', size="32px") }}

No recent Activity

System activities will appear here

{% endif %}
{# Quick Actions #}
{{ icon('bolt', size="18px") }}

Quick Actions

Common actions at your fingertips

{% set _action_colors = { 'Categories': 'bg-teal-500/10 text-teal-500', 'Products': 'bg-violet-500/10 text-violet-500', 'Users': 'bg-blue-500/10 text-blue-500', 'Orders': 'bg-orange-500/10 text-orange-500', 'Order Items': 'bg-emerald-500/10 text-emerald-500', 'Admin Audit Logs': 'bg-cyan-500/10 text-cyan-500', 'Audit Logs': 'bg-cyan-500/10 text-cyan-500', 'Admin Roles': 'bg-pink-500/10 text-pink-500', 'Roles': 'bg-pink-500/10 text-pink-500', 'Admin Users': 'bg-indigo-500/10 text-indigo-500', 'Admin Permissions': 'bg-red-500/10 text-red-500', 'Permissions': 'bg-red-500/10 text-red-500', 'Admin Field Permissions': 'bg-yellow-500/10 text-yellow-500', 'Refresh Tokens': 'bg-purple-500/10 text-purple-500', '2FA Tokens': 'bg-teal-500/10 text-teal-500', 'Login Attempts': 'bg-orange-500/10 text-orange-500' } %} {% if recent_activity_models %} {% for registered in recent_activity_models %} {% set _ac = _action_colors[registered.verbose_name_plural] | default('bg-emerald-500/10 text-emerald-600') %}
{{ icon(registered.admin.icon | default('cube'), size="18px") }}
{{ registered.verbose_name_plural }}
Manage {{ registered.verbose_name | lower }}
{{ icon('chevron-right', size="18px", class="shrink-0 text-slate-400 dark:text-slate-500") }}
{% endfor %} {% else %} {# Fallback: show first 5 admin-tagged models if no activity yet #} {% set ns = namespace(count=0) %} {% for registered in registered_models %} {% if ns.count < 5 and registered.admin.tag | default('') == 'admin' %} {% set ns.count = ns.count + 1 %} {% set _ac = _action_colors[registered.verbose_name_plural] | default('bg-emerald-500/10 text-emerald-600') %}
{{ icon(registered.admin.icon | default('cube'), size="18px") }}
{{ registered.verbose_name_plural }}
Manage {{ registered.verbose_name | lower }}
{{ icon('chevron-right', size="18px", class="shrink-0 text-slate-400 dark:text-slate-500") }}
{% endif %} {% endfor %} {% endif %} {# Extra: System Logs link #}
{{ icon('document-text', size="18px") }}
System Logs
View system audit logs
{{ icon('chevron-right', size="18px", class="shrink-0 text-slate-400 dark:text-slate-500") }}
{# ─── Charts ─── #} {% if overview_data and show_charts %}

Charts

{{ icon('chart-bar') }}
System Overview
{% for item in overview_data %} {% if item.value > 0 %}
{{ item.label }} {{ item.value }}
{% endif %} {% endfor %}
Total {{ overview_total }}
{% endif %}
{% endblock %}