{% extends "admin/layout.html" %} {% block title %}Users | {{ brand_short_name }}{% endblock %} {% block admin_title %}Usuarios y auditoría{% endblock %} {% block admin_content %} {% set top_direct = inviter_rankings[0].direct_count if inviter_rankings else 1 %} {% set default_tab = 'compras' if selected_purchase_date else 'directorio' %}

Búsqueda

Filtra por teléfono o por fecha de compra de paquete

Total

{{ total_users }}

Activos

{{ active_users|length }}

Con link

{{ user_rows|map(attribute='user')|selectattr('referral_code')|list|length }}

Con equipo

{{ user_rows|map(attribute='user')|selectattr('referrals')|list|length }}

{% if selected_purchase_date %} {% endif %}
{% if user_rows and not selected_purchase_date %}
{% for row in user_rows %} {% set user = row.user %}

{{ user.phone }}

{{ localize_admin_datetime(user.created_at).strftime("%Y-%m-%d %H:%M") if user.created_at else "—" }}

{{ "Activo" if user.is_active else "Inactivo" }}

Principal

${{ "%.2f"|format(user.balance_main or 0) }}

Referidos

${{ "%.2f"|format(user.balance_referrals or 0) }}

Directos

{{ user.referrals|length }}

Código

{{ user.referral_code or "—" }}
Abrir auditoría
{% endfor %}
{% elif not selected_purchase_date %}

Aún no hay usuarios registrados.

{% endif %}
{% if selected_purchase_date %}
Fecha: {{ selected_purchase_date }} · Usuarios: {{ user_rows|length }} · Paquetes: {{ matched_purchase_total }}
{% for row in user_rows %} {% set user = row.user %}

{{ user.phone }}

{{ "Activo" if user.is_active else "Inactivo" }}
Auditoría
{% for investment in row.matching_investments %}

{{ investment.plan_name }}

Compra: {{ investment.bought_at.strftime("%Y-%m-%d %H:%M") if investment.bought_at else "—" }}

{{ "Recuperada" if investment.recovered else "En curso" }}

{{ investment.recovery_message }}

Costo

${{ "%.2f"|format(investment.price or 0) }}

Ganancia

${{ "%.2f"|format(investment.profit_total or 0) }}

Falta

${{ "%.2f"|format(investment.remaining_to_recover or 0) }}

Avance

{{ investment.recovery_percent }}%
{% endfor %}
{% endfor %}
{% endif %}
{% endblock %}