{% extends "layouts/base.html" %} {% load i18n %} {% block title %}{% trans "Executive Summary" %} — PX360{% endblock %} {% block content %}
{# Hidden fields for HTMX analysis requests #} {% if selected_hospital %}{% endif %} {# ── Header & Filters ── #}

{% trans "Executive Summary" %}

{% if selected_hospital %}{{ selected_hospital.name }}{% else %}{% trans "All Hospitals" %}{% endif %} · {% trans "Updated" %} {{ last_updated }}

{% if is_px_admin %} {% endif %}
{% trans "Analytics" %}
{# ── Tabs ── #}
{# ═══════════════ OVERVIEW ═══════════════ #}
{# KPI Cards #}
{% for key, card in kpi_cards.items %}

{% if key == "complaints" %}{% trans "Complaints" %}{% elif key == "surveys" %}{% trans "Satisfaction" %}{% elif key == "actions" %}{% trans "PX Actions" %}{% endif %}

{% if key == "surveys" %}{{ card.satisfaction|floatformat:1 }}/5 {% else %}{{ card.total }}{% endif %}

{% if card.variance.percentage %} {% if card.variance.direction == 'up' %}↑{% elif card.variance.direction == 'down' %}↓{% else %}→{% endif %} {{ card.variance.percentage|floatformat:1 }}% {% endif %}
{% if key == "complaints" %} {% trans "Critical" %}: {{ card.critical }} {% trans "Overdue" %}: {{ card.overdue }} {% trans "Avg" %}: {{ card.resolution_time|floatformat:0 }}h {% elif key == "surveys" %} NPS: {{ card.nps|floatformat:0 }} {% trans "Total" %}: {{ card.total }} {% elif key == "actions" %} {% trans "Open" %}: {{ card.open }} {% trans "Overdue" %}: {{ card.overdue }} {% trans "Closed" %}: {{ card.closed }} {% endif %}
{% endfor %}
{# Risk Alert Summary #}

{% trans "Risk Alerts" %} {% if risk_alerts_count %}{{ risk_alerts_count }}{% endif %}

{% if has_risk_alerts %}
{% for alert in risk_alerts|slice:":3" %}

{{ alert.title_en }}

{% if alert.hospital %}{{ alert.hospital.name }} · {% endif %}{{ alert.created_at|timesince }} {% trans "ago" %}

{% endfor %}
{% else %}

{% trans "No active risk alerts" %}

{% endif %}
{# Latest AI Report #}

{% trans "Latest AI Report" %}

{% if report_type %}{{ report_type }} · {{ report_period }}{% endif %}
{% if ai_narrative %}

{{ ai_narrative|truncatewords:80 }}

{% if ai_highlights %}

{% trans "Highlights" %}

    {% for h in ai_highlights|slice:":2" %}
  • {{ h|truncatewords:10 }}
  • {% endfor %}
{% endif %} {% if ai_concerns %}

{% trans "Concerns" %}

    {% for c in ai_concerns|slice:":2" %}
  • ! {{ c|truncatewords:10 }}
  • {% endfor %}
{% endif %}
{% if latest_report and latest_report.pdf_file %} {% trans "Download PDF" %} {% endif %} {% else %}

{% trans "No AI report generated yet" %}

{% endif %}
{# AI Overview Analysis #}

{% trans "Get AI-powered analysis of your current KPIs" %}

{% endblock %} {% block extra_js %} {% endblock %}