{% extends 'layout/base.twig' %} {% set title = 'Dashboard' %} {% set pageTitle = 'Dashboard Overview' %} {% set pageDescription = 'Monitor your domains and expiration dates' %} {% set pageIcon = 'fas fa-chart-line' %} {% set topRegistrars = registrarCounts|default({})|slice(0, 8) %} {% set topTags = dashTags|default([])|filter(t => t.usage_count|default(0) > 0)|slice(0, 8) %} {% set domainsWithoutGroup = totalDomainCount|default(0) - domainsWithGroup|default(0) %} {% set totalGroupCount = groups|default([])|length %} {% block content %} {# Welcome Banner #}

Welcome back, {{ auth.fullName|default(auth.username)|default('User') }}!

{% if domainStats.expiring_soon|default(0) > 0 %} You have {{ domainStats.expiring_soon }} domain{{ domainStats.expiring_soon > 1 ? 's' : '' }} expiring within {{ domainStats.expiring_threshold|default(30) }} days. {% else %} All your domains are in good standing. No urgent actions needed. {% endif %}

{% if auth.isAdmin %} {# System Status Bar (Admin) #}
System Status
{% set statusColors = {'green': 'text-green-600 dark:text-green-400', 'yellow': 'text-yellow-600 dark:text-yellow-400', 'red': 'text-red-600 dark:text-red-400', 'gray': 'text-gray-600 dark:text-slate-400'} %} {% set statusDots = {'green': 'bg-green-500', 'yellow': 'bg-yellow-500', 'red': 'bg-red-500', 'gray': 'bg-gray-400'} %} Database {{ systemStatus.database.status|capitalize }} TLD Registry {{ systemStatus.whois.status|capitalize }} Notifications {{ systemStatus.notifications.status|capitalize }}
{% endif %} {# Statistics Cards #}
{# Total Domains Card #}

Total Domains

{{ domainStats.total|default(0) }}

{# Active Domains Card #}

Active

{{ domainStats.active|default(0) }}

{% if domainStats.total|default(0) > 0 %} {% set activePercent = ((domainStats.active|default(0) / domainStats.total) * 100)|round %} {{ activePercent }}% of total {% else %} No domains yet {% endif %}
{# Expiring Soon Card #}

Expiring Soon

{{ domainStats.expiring_soon|default(0) }}

within {{ domainStats.expiring_threshold|default(30) }} days
{# Inactive Domains Card #}

Inactive

{{ domainStats.inactive|default(0) }}

monitoring paused
{# Main Content: Recent Domains + Expiring Soon #}
{# Recent Domains #}

Recent Domains

View all
{% if recentDomains is not empty %}
{% for domain in recentDomains %}

{{ domain.domain_name }}

{{ domain.expiration_date ? domain.expiration_date|date('M d, Y') : 'Not set' }} {% if domain.registrar %} {{ domain.registrar }} {% endif %}
{{ domain.statusText }}
{% endfor %}
{% else %}

No domains added yet

Add Your First Domain
{% endif %}
{# Expiring Soon #}

Expiring Soon

{% if expiringCount|default(0) > 5 %} View all {{ expiringCount }} {% endif %}
{% if expiringThisMonth is not empty %}
{% for domain in expiringThisMonth %} {% set daysLeft = domain.daysLeft %} {% if daysLeft <= 7 %} {% set urgencyClass = 'text-red-600 dark:text-red-400' %} {% elseif daysLeft <= 30 %} {% set urgencyClass = 'text-orange-600 dark:text-orange-400' %} {% else %} {% set urgencyClass = 'text-yellow-600 dark:text-yellow-400' %} {% endif %}

{{ domain.domain_name }}

{{ domain.expiration_date ? domain.expiration_date|date('M d, Y') : 'Unknown' }} {{ daysLeft }} days

{% endfor %}
{% else %}

No domains expiring soon

within {{ domainStats.expiring_threshold|default(30) }} days

{% endif %}
{# Insights Row #}
{# Registrar Distribution #}

Registrar Distribution

{{ registrarCounts|default({})|length }} registrar{{ registrarCounts|default({})|length != 1 ? 's' : '' }}
{% if topRegistrars is not empty %}
{% for regName, regCount in topRegistrars %} {% set regPct = totalDomainCount|default(0) > 0 ? ((regCount / totalDomainCount) * 100)|round : 0 %}
{{ regName }} {{ regCount }} ({{ regPct }}%)
{% endfor %}
{% else %}

No registrar data

{% endif %}
{# Tag Usage #}

Tag Usage

{{ dashTags|default([])|length }} tag{{ dashTags|default([])|length != 1 ? 's' : '' }}
{% if topTags is not empty %}
{% for tt in topTags %} {% set pct = totalDomainCount|default(0) > 0 ? ((tt.usage_count / totalDomainCount) * 100)|round : 0 %}
{{ tt.name }} {{ tt.usage_count }} domain{{ tt.usage_count != 1 ? 's' : '' }} ({{ pct }}%)
{% endfor %}
{% else %}

No tags in use

{% endif %}
{# Notification Coverage #}

Notification Coverage

{{ totalGroupCount }} group{{ totalGroupCount != 1 ? 's' : '' }}, {{ totalChannels|default(0) }} channel{{ totalChannels|default(0) != 1 ? 's' : '' }}
{% if totalDomainCount|default(0) > 0 %} {% set coveragePct = ((domainsWithGroup|default(0) / totalDomainCount) * 100)|round %}
{{ coveragePct }}%

{{ domainsWithGroup|default(0) }}

With Notifications

{{ domainsWithoutGroup }}

Without Notifications

{% else %}

No domains to monitor

{% endif %}
{% endblock %}