{% extends "base.html" %} {% from "_componentes/tarjeta.html" import tarjeta %} {% from "_componentes/badges.html" import badge_nivel_alerta %} {% from "_componentes/iconos.html" import icono %} {% block titulo %}Regla {{ regla.clave }}{% endblock %} {% block contenido %} {%- set PLAZOS = {"24h": "24 horas", "aviso": "Aviso", "inmediato": "Inmediato"} %} {%- set NIVELES = {"critica": "Crítica", "aviso_umbral": "Aviso por umbral", "preventiva": "Preventiva", "informativa": "Informativa"} %} {%- macro valor(v) -%}{{ v if v is not sequence or v is string else v | join(", ") }}{%- endmacro %} {% if guardada %}{% endif %}
{{ icono("chevron-left", "icono--14") }}Reglas de alerta

{{ regla.clave }} · {{ regla.nombre }}

{{ regla.criterio_texto }}

{% call tarjeta("Versión vigente " ~ regla.version, subtitulo="Desde el " ~ regla.vigente_desde.strftime("%d/%m/%Y") ~ " · aprobó " ~ regla.aprobado_por) %} {% if error %}{% endif %} {% if puede_editar %}
{%- for p in regla.parametros %} {%- if p.editable %} {%- else %}

{{ p.clave }} = {{ valor(p.valor) }} · se cambia con el archivo de reglas

{%- endif %} {%- endfor %}
Guardar crea una versión nueva y cierra esta. Las alertas ya creadas no cambian.
{% else %}
Nivel
{{ badge_nivel_alerta(regla.nivel) }}
Plazo
{{ PLAZOS.get(regla.plazo_aviso, "Análisis interno") }}
{%- for p in regla.parametros %}
{{ p.clave }}
{{ valor(p.valor) }}
{%- endfor %}

Solo el oficial de cumplimiento cambia una regla.

{% endif %} {% endcall %} {% call tarjeta("Historial", subtitulo=historial | length ~ (" versión" if historial | length == 1 else " versiones"), plano=True) %}
{%- for h in historial %} {%- endfor %}
VersiónVigente desdeNivelPlazoParámetrosAprobóJustificación
{{ h.version }}{% if h.valid_to is none %} vigente{% endif %} {{ h.vigente_desde.strftime("%d/%m/%Y") }} {{ badge_nivel_alerta(h.nivel) }} {{ PLAZOS.get(h.plazo_aviso, "Análisis interno") }} {% for p in h.parametros %}{{ p.clave }} = {{ valor(p.valor) }}{% if not loop.last %}
{% endif %}{% else %}—{% endfor %}
{{ h.aprobado_por }} {{ h.justificacion or "—" }}
{% endcall %} {% endblock %}