{% extends "base.html" %} {% from "_componentes/tarjeta.html" import tarjeta %} {% from "_componentes/badges.html" import badge, badge_estado_alerta, badge_nivel_alerta %} {% from "_componentes/aviso.html" import aviso as aviso_en_linea %} {% from "_componentes/iconos.html" import icono %} {% from "_componentes/pendiente.html" import pendiente_de_regla %} {% from "avisos/_enlace_24h.html" import enlace_24h %} {#- Página completa de una alerta (enlaces directos y "Ver detalle completo" del cajón de la bandeja). Las acciones y sus redirecciones viven aquí. Las acciones del historial se muestran en crudo (crear, estado:…): las lee el audit trail y los tests. -#} {% set ancho = "amplio" %} {% block titulo %}Alerta {{ alerta.id }} · {{ regla.clave }}{% endblock %} {% block contenido %} {%- set FAMILIAS = {"A": "Umbrales de aviso", "B": "Señales de alerta", "C": "Perfil transaccional", "D": "Riesgo y PEP", "E": "Listas y jurisdicciones"} %} {% if aviso %}{% endif %}

Alerta #{{ alerta.id }} · {{ regla.clave }}

{{ regla.nombre }} {{ pendiente_de_regla(regla.clave) }}

{{ badge_nivel_alerta(alerta.nivel) }}{{ badge_estado_alerta(alerta.estado) }} {{ regla.clave }} {{ regla.version }} · {{ FAMILIAS.get(regla.familia, regla.familia) }} ·vigente desde {{ regla.vigente_desde.strftime("%d/%m/%Y") }} ·plazo: {{ plazo_de_alerta(alerta) }} {%- if vence_visible(alerta) %}·vence el {{ alerta.vence_el.strftime("%d/%m/%Y") }}{% endif %}

{% if error %}{{ aviso_en_linea(error, tono="peligro") }}{% endif %} {%- if ofrece_siguiente %}

Siguiente pendienteLa siguiente alerta por dictaminar: primero las vencidas.

{%- endif %}
{% call tarjeta("Regla", subtitulo=regla.criterio_texto, plano=True) %}
Clave
{{ regla.clave }} · familia {{ regla.familia }}
Versión que la produjo
{{ regla.version }} regla_id {{ regla.id }}{% if regla.valid_to %} {{ badge("sustituida", "aviso") }}{% endif %}
Tipo de evaluación
{{ regla.tipo_evaluacion }}
Parámetros
{% for k, v in (alerta.evidencia.parametros or {}).items() if not k.startswith("_") %}{{ k }}={{ v }} {% else %}—{% endfor %}
{% endcall %} {% call tarjeta("Evidencia", subtitulo="Los valores que dispararon la regla y el umbral aplicado", plano=True) %}
{%- for etiqueta, valor in evidencia %}
{{ etiqueta }}
{{ valor }}
{% else %}
Evidencia
—
{% endfor %}
{% endcall %}
{% call tarjeta("Cliente, crédito y transacciones", plano=True) %}
Cliente
{{ nombre_cliente }} · sus alertas
Crédito
{% if credito %}{{ credito.id_externo }} · ${{ "{:,.2f}".format(credito.monto) }} · {{ credito.status }}{% else %}—{% endif %}
{%- if transacciones %}
{%- for t in transacciones %} {{ (t.metodo or "—") | capitalize }} {%- endfor %}
FechaTipoMétodoTitular origenTotal
{{ t.fecha_pago.strftime("%d/%m/%Y") }}{% if t.id == alerta.evidencia.transaccion_id %} {{ badge("dispara", "peligro") }}{% endif %} {{ (t.tipo or "—") | capitalize }} {% if t.titular_origen %}{{ badge(t.titular_origen, "peligro" if t.titular_origen == "TERCERO" else ("aviso" if t.titular_origen == "CUENTA" else "neutro")) }}{% else %}—{% endif %} ${{ "{:,.2f}".format(t.total) }}
{%- endif %} {% endcall %} {% set acciones %}{% if alerta.responsable %}{{ alerta.responsable }}{% else %}Sin asignar{% endif %}{% endset %} {% call tarjeta("Gestión", subtitulo="Responsable: " ~ (alerta.responsable or "sin asignar"), acciones=acciones, id="gestion") %} {%- if puede_mutar %}
{%- if transicion_disponible.en_revision %}
{%- endif %} {%- if caso_abierto %} Ver caso #{{ caso_abierto.id }} {%- elif transicion_disponible.escalada %} Escalar: abrir caso {%- endif %}
{%- if puede_cerrar %}
{%- else %}

{{ badge("Cerrar requiere rol oficial", "aviso") }}Esta alerta es crítica.

{%- endif %}
{%- elif alerta.estado == "cerrada" %}

{{ badge("Cerrada", "neutro") }}Sin acciones disponibles.{% if caso_abierto %} Caso #{{ caso_abierto.id }}{% endif %}

{%- elif caso_abierto %}

{{ badge("En caso", "acento") }} Ver caso #{{ caso_abierto.id }}

{%- else %}

{{ badge("Solo lectura", "neutro") }}Tu rol ({{ usuario.rol }}) solo consulta.

{%- endif %} {{ enlace_24h(usuario, "alerta_id", alerta.id) }} {% endcall %} {% call tarjeta("Historial", subtitulo="Reconstruido desde el audit trail", plano=True) %}
{%- for fila in historial %} {%- else %} {%- endfor %}
FechaAcciónUsuarioCambioMotivo
{{ fila.fecha | mx("%d/%m/%Y %H:%M") }} {{ fila.accion or "—" }} {{ fila.usuario or "—" }} {% if fila.antes %}{{ fila.antes.estado or fila.antes.responsable or "" }} → {% endif %}{{ (fila.despues or {}).get("estado") or (fila.despues or {}).get("responsable") or (fila.despues or {}).get("regla") or "" }} {{ fila.motivo or "—" }}
Sin eventos.
{% endcall %} {% endblock %}