{% extends "base.html" %} {% from '_upsell.html' import crown_badge, max_badge, beta_pill %} {% block title %}{{ _("Dashboard") }}{% endblock %} {% block content %}

{{ _("Dashboard") }}

{% if last_order_sync %} — {{ _("last updated") }} {{ _("(update now)") }} {% endif %}
{# ── Date range filter for revenue/order charts ── #}
{{ _("to") }} {% if dash_filters.date_from or dash_filters.date_to %} {{ _("Clear") }} {% endif %} {% if has_feature('analytics') and has_feature('ratings_export') %} download {{ _("Export CSV") }} {% else %} {% endif %}
{# ── Ticket summary cards ── #} {% if last_msg_sync %}

{{ _("Messages last synced") }} {{ _("(sync now)") }}

{% endif %}

{{ _("Total Tickets") }}

{{ stats.total }}

{{ _("Unread") }}

{{ stats.unread }}

{{ _("Open") }}

{{ stats.open }}

{{ _("Avg Response (6mo · Addons)") }}

{% if stats.avg_response_hours is not none %}{{ stats.avg_response_hours }}h{% else %}—{% endif %}

{% if stats.avg_response_trend and stats.avg_response_trend.delta is not none %} {% set delta = stats.avg_response_trend.delta %} {% set prev_h = stats.avg_response_trend.prev_hours %} {% if delta <= -0.5 %} ▼ {{ (delta * -1)|round(1) }}h {% elif delta >= 0.5 %} ▲ +{{ delta }}h {% else %} ≈ {{ _("stable") }} {% endif %} {% endif %}
{# ── Revenue + Period cards ── #} {% if revenue_stats and revenue_stats.total_orders > 0 %}

{{ _("Net Revenue") }}

€{{ revenue_stats.total_revenue }}

{% set avg_order_value = revenue_stats.avg_order_value %}

{% trans %}Avg €{{ avg_order_value }}/order{% endtrans %}

{{ _("Period Orders") }}

{{ revenue_stats.total_orders }}

{{ _("New Tickets") }}

{{ period_ticket_stats.new_tickets }}

{{ _("Inbound Messages") }}

{{ period_ticket_stats.inbound_messages }}

{{ _("Values may slightly differ from the Addons website.") }}

{% endif %} {# ── Charts section ── #} {% if revenue_stats and revenue_stats.total_orders > 0 %}
{# Orders & Revenue trend #}

{{ _("Orders & Revenue Trend") }}

{# Top Products by Revenue #}

{{ _("Top Products by Revenue") }}

{# Top Countries by Orders — MAX feature #}

{{ _("Top Countries by Orders") }}{% if not has_feature('ratings_export') %}{{ max_badge() }}{% endif %}

{% if has_feature('ratings_export') %} {% else %}
public {{ _("Geography analytics available on MAX plan") }}
{% endif %}
{# Customer Value Segments — MAX feature #}

{{ _("Customer Value Segments") }}{% if not has_feature('ratings_export') %}{{ max_badge() }}{% endif %}

{% if has_feature('ratings_export') %} {% else %}
pie_chart {{ _("Value segmentation available on MAX plan") }}
{% endif %}
{% endif %}
{# ── Status breakdown ── #}

{{ _("By Status") }}

{% set max_status = [stats.open, stats.in_progress, stats.waiting_customer, stats.closed]|max or 1 %}
{{ _("Open") }}
{{ stats.open }}
{{ _("In Progress") }}
{{ stats.in_progress }}
{{ _("Waiting") }}
{{ stats.waiting_customer }}
{{ _("Closed") }}
{{ stats.closed }}
{# ── Priority breakdown ── #}

{{ _("By Priority") }}

{% set max_prio = [stats.p1, stats.p2, stats.p3, stats.p4]|max or 1 %}
{{ _("Critical") }}
{{ stats.p1 }}
{{ _("High") }}
{{ stats.p2 }}
{{ _("Normal") }}
{{ stats.p3 }}
{{ _("Low") }}
{{ stats.p4 }}
{# ── Support expiration alerts ── #} {% if expiring %}

warning {% set n_expiring = expiring|length %} {% trans count=n_expiring %}Expired Support ({{ count }} open ticket){% pluralize %}Expired Support ({{ count }} open tickets){% endtrans %}

{% endif %} {# ── Recent activity ── #}

{{ _("Recent Activity") }}

{% for t in recent %} {% else %} {% endfor %}
#{{ t.id }} {{ t.subject }} {% if t.status == 'open' %} {{ _("Open") }} {% elif t.status == 'in_progress' %} {{ _("In Progress") }} {% elif t.status == 'waiting_customer' %} {{ _("Waiting") }} {% elif t.status == 'closed' %} {{ _("Closed") }} {% endif %} {% if t.priority == 'p1' %} {{ _("Critical") }} {% elif t.priority == 'p2' %} {{ _("High") }} {% elif t.priority == 'p3' %} {{ _("Normal") }} {% else %} {{ _("Low") }} {% endif %} {{ t.last_activity_at|localdt('%Y-%m-%d %H:%M') if t.last_activity_at else '-' }}
{{ _("No tickets yet.") }}
{# ── Chart.js initialization ── #} {% if revenue_stats and revenue_stats.total_orders > 0 %} {% endif %} {% endblock %}