fix(ui): instantes en hora de Ciudad de México en las pantallas de cumplimiento

Catorce instantes (datetime en UTC) se pintaban con strftime: fecha y hora de cargas y
lotes, apertura y línea de tiempo de casos, historial de la alerta, vigencias del
beneficiario controlador y versión de la identificación en la ficha. Pasan al filtro | mx
(app/fechas.py), como pide H2: la hora que se ve cambia (antes UTC, ahora México). Las
fechas sin hora (vence_el, fecha_corte, fecha_pago…) no cambian.
This commit is contained in:
Fernando Davila committed 2026-10-09 11:42:33 -06:00
1 parent a8d416b938
commit 57ff9807ab
8 files changed
+12 -12

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@
{% call tarjeta("Historial", subtitulo="Reconstruido desde el audit trail") %}
{% set columnas = [{"clave": "fecha", "titulo": "Fecha"}, {"clave": "accion", "titulo": "Acción"}, {"clave": "usuario", "titulo": "Usuario"}, {"clave": "cambio", "titulo": "Cambio"}, {"clave": "motivo", "titulo": "Motivo"}] %}
{% call(fila, col) tabla(columnas, historial, vacio="Sin eventos.") %}
{% if col.clave == "fecha" %}{{ fila.fecha.strftime("%d/%m/%Y %H:%M") }}
{% if col.clave == "fecha" %}{{ fila.fecha | mx("%d/%m/%Y %H:%M") }}
{% elif col.clave == "cambio" %}{% 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 "" }}
{% else %}{{ fila[col.clave] or "—" }}{% endif %}
{% endcall %}
+4 -4
View File
@@ -42,7 +42,7 @@
{% if calculo.error %}{{ aviso_en_linea(calculo.error, tono="peligro") }}{% endif %}
{# ---------------------------------------------------------------- Resultado #}
{% call tarjeta("Resultado vigente", subtitulo=("Criterio " ~ vigentes[0].criterio ~ " · vigente desde " ~ vigentes[0].valid_from.strftime("%d/%m/%Y %H:%M")) if vigentes else "Sin beneficiario registrado") %}
{% call tarjeta("Resultado vigente", subtitulo=("Criterio " ~ vigentes[0].criterio ~ " · vigente desde " ~ vigentes[0].valid_from | mx("%d/%m/%Y %H:%M")) if vigentes else "Sin beneficiario registrado") %}
{% if puede_editar %}
<form class="acciones-en-linea" method="post" action="/clientes/{{ cliente.id }}/beneficiario/calcular">
<button class="boton boton--discreto" type="submit">Recalcular ahora</button>
@@ -82,7 +82,7 @@
{% if historial | length > vigentes | length %}
<details><summary>Historial de versiones ({{ historial | length }})</summary>
<ul class="historial">
{% for h in historial %}<li>{{ h.criterio }} · <a href="/clientes/{{ h.persona_fisica_id }}">{{ nombres.get(h.persona_fisica_id) or ("#" ~ h.persona_fisica_id) }}</a>{% if h.porcentaje_calculado is not none %} · {{ h.porcentaje_calculado }} %{% endif %} · {{ h.valid_from.strftime("%d/%m/%Y %H:%M") }} → {{ h.valid_to.strftime("%d/%m/%Y %H:%M") if h.valid_to else "vigente" }} · {{ h.created_by }}</li>{% endfor %}
{% for h in historial %}<li>{{ h.criterio }} · <a href="/clientes/{{ h.persona_fisica_id }}">{{ nombres.get(h.persona_fisica_id) or ("#" ~ h.persona_fisica_id) }}</a>{% if h.porcentaje_calculado is not none %} · {{ h.porcentaje_calculado }} %{% endif %} · {{ h.valid_from | mx("%d/%m/%Y %H:%M") }} → {{ h.valid_to | mx("%d/%m/%Y %H:%M") if h.valid_to else "vigente" }} · {{ h.created_by }}</li>{% endfor %}
</ul>
</details>
{% endif %}
@@ -104,7 +104,7 @@
{% elif col.clave == "tipo" %}{{ badge(fila.tipo, "info" if fila.tipo == "capital" else "acento") }}
{% elif col.clave == "porcentaje" %}{{ fila.porcentaje }} %
{% elif col.clave == "documento" %}{% if fila.documento_id %}<a href="/documentos/{{ fila.documento_id }}/descargar">doc #{{ fila.documento_id }}</a>{% else %}<span class="texto-suave">sin documento</span>{% endif %}
{% elif col.clave == "desde" %}{{ fila.valid_from.strftime("%d/%m/%Y %H:%M") }}
{% elif col.clave == "desde" %}{{ fila.valid_from | mx("%d/%m/%Y %H:%M") }}
{% else %}{% if puede_editar %}<form class="formulario--en-celda" method="post" action="/clientes/{{ cliente.id }}/participaciones/{{ fila.id }}/cerrar" data-confirmar="¿Retirar esta participación? Se cierra la fila vigente y se recalcula el beneficiario."><button class="boton boton--discreto" type="submit">Retirar</button></form>{% endif %}{% endif %}
{% endcall %}
@@ -150,7 +150,7 @@
{% if historial_participaciones | length > participaciones | length %}
<details><summary>Historial de participaciones ({{ historial_participaciones | length }})</summary>
<ul class="historial">
{% for h in historial_participaciones %}<li>{{ nombres.get(h.socio_id) or ("#" ~ h.socio_id) }} · {{ h.tipo }} {{ h.porcentaje }} %{% if h.documento_id %} · doc #{{ h.documento_id }}{% endif %} · {{ h.valid_from.strftime("%d/%m/%Y %H:%M") }} → {{ h.valid_to.strftime("%d/%m/%Y %H:%M") if h.valid_to else "vigente" }} · {{ h.created_by }}</li>{% endfor %}
{% for h in historial_participaciones %}<li>{{ nombres.get(h.socio_id) or ("#" ~ h.socio_id) }} · {{ h.tipo }} {{ h.porcentaje }} %{% if h.documento_id %} · doc #{{ h.documento_id }}{% endif %} · {{ h.valid_from | mx("%d/%m/%Y %H:%M") }} → {{ h.valid_to | mx("%d/%m/%Y %H:%M") if h.valid_to else "vigente" }} · {{ h.created_by }}</li>{% endfor %}
</ul>
</details>
{% endif %}
+1 -1
View File
@@ -19,7 +19,7 @@
{% elif col.clave == "criterio" %}{% if fila.beneficiarios %}{{ badge(fila.beneficiarios[0].fila.criterio | replace("_", " "), "acento") }}{% else %}{{ badge("Sin calcular") }}{% endif %}
{% elif col.clave == "beneficiarios" %}
{% for b in fila.beneficiarios %}<a href="/clientes/{{ b.fila.persona_fisica_id }}">{{ b.nombre or ("#" ~ b.fila.persona_fisica_id) }}</a>{% if b.fila.porcentaje_calculado is not none %} · {{ b.fila.porcentaje_calculado }} %{% endif %}{% if not loop.last %}<br>{% endif %}{% else %}—{% endfor %}
{% elif col.clave == "desde" %}{% if fila.beneficiarios %}{{ fila.beneficiarios[0].fila.valid_from.strftime("%d/%m/%Y %H:%M") }}{% else %}—{% endif %}
{% elif col.clave == "desde" %}{% if fila.beneficiarios %}{{ fila.beneficiarios[0].fila.valid_from | mx("%d/%m/%Y %H:%M") }}{% else %}—{% endif %}
{% else %}<a class="boton boton--discreto" href="/clientes/{{ fila.cliente.id }}/beneficiario">Grafo y participaciones</a>{% endif %}
{% endcall %}
{% endcall %}
+2 -2
View File
@@ -10,7 +10,7 @@
<header class="pagina__encabezado">
<p class="pagina__bajada"><a href="/casos">← Casos</a></p>
<h1 class="pagina__titulo">Caso #{{ caso.id }} {{ badge(caso.estado | replace("_", " ") | capitalize, {"abierto": "info", "en_investigacion": "aviso", "escalado": "acento", "cerrado": "neutro"}[caso.estado]) }}</h1>
<p class="pagina__bajada">Cliente {% if cliente %}<a href="/clientes/{{ cliente.id }}"><code>{{ cliente.id_externo }}</code></a>{% else %}—{% endif %} · responsable: {{ caso.responsable or "sin asignar" }} · abierto el {{ caso.created_at.strftime("%d/%m/%Y") }}{% if caso.decision %} · decisión: <strong>{{ decisiones[caso.decision] }}</strong>{% endif %}</p>
<p class="pagina__bajada">Cliente {% if cliente %}<a href="/clientes/{{ cliente.id }}"><code>{{ cliente.id_externo }}</code></a>{% else %}—{% endif %} · responsable: {{ caso.responsable or "sin asignar" }} · abierto el {{ caso.created_at | mx("%d/%m/%Y") }}{% if caso.decision %} · decisión: <strong>{{ decisiones[caso.decision] }}</strong>{% endif %}</p>
</header>
{% if aviso %}<div data-toast="{{ {'abierto': 'Caso abierto.', 'evento': 'Evento registrado.', 'cerrado': 'Caso cerrado.', 'responsable': 'Responsable asignado.'}.get(aviso, 'Estado actualizado.') }}" data-tono="exito" hidden></div>{% endif %}
@@ -36,7 +36,7 @@
<ol class="linea-tiempo">
{% for e in eventos %}
<li class="linea-tiempo__evento" data-tipo="{{ e.tipo }}">
<div><strong>{{ e.fecha.strftime("%d/%m/%Y %H:%M") }}</strong> · {{ badge(e.tipo | replace("_", " ") | capitalize) }} · {{ e.usuario }}</div>
<div><strong>{{ e.fecha | mx("%d/%m/%Y %H:%M") }}</strong> · {{ badge(e.tipo | replace("_", " ") | capitalize) }} · {{ e.usuario }}</div>
<p>{{ e.descripcion }}</p>
{% if e.adjunto %}<p><a href="/casos/{{ caso.id }}/adjuntos/{{ e.id }}">⬇ {{ e.adjunto.split("#")[0].split("/")[-1] }}</a> <small>sha256 {{ e.adjunto.split("#sha256=")[-1][:12] }}…</small></p>{% endif %}
</li>
+1 -1
View File
@@ -40,7 +40,7 @@
{% elif col.clave == "cliente" %}{% if fila.cliente_id %}<a href="/clientes/{{ fila.cliente_id }}"><code>{{ fila.cliente }}</code></a>{% else %}—{% endif %}
{% elif col.clave == "claves" %}{{ fila.alertas }} · {{ fila.claves | join(", ") }}
{% elif col.clave == "estado" %}{{ badge(fila.estado | replace("_", " ") | capitalize, {"abierto": "info", "en_investigacion": "aviso", "escalado": "acento", "cerrado": "neutro"}[fila.estado]) }}
{% elif col.clave == "created_at" %}{{ fila.created_at.strftime("%d/%m/%Y") }}
{% elif col.clave == "created_at" %}{{ fila.created_at | mx("%d/%m/%Y") }}
{% elif col.clave == "decision" %}{{ fila.decision | replace("_", " ") | capitalize if fila.decision else "—" }}
{% else %}{{ fila[col.clave] or "—" }}{% endif %}
{% endcall %}
+1 -1
View File
@@ -65,7 +65,7 @@
{% endif %}
{# ---------------------------------------------------------------- Identificación #}
{% call tarjeta("Identificación", subtitulo=("Versión " ~ identificacion.version ~ " · vigente desde " ~ identificacion.valid_from.strftime("%d/%m/%Y %H:%M")) if identificacion else "Campos del Caso de Estudio") %}
{% call tarjeta("Identificación", subtitulo=("Versión " ~ identificacion.version ~ " · vigente desde " ~ identificacion.valid_from | mx("%d/%m/%Y %H:%M")) if identificacion else "Campos del Caso de Estudio") %}
{% if puede_editar %}
<div class="acciones-en-linea">
<a class="boton boton--discreto" href="/clientes/{{ cliente.id }}/identificacion">{% if identificacion and identificacion.fuente == "captura" %}Actualizar (versión nueva){% else %}Capturar datos de identificación{% endif %}</a>
+1 -1
View File
@@ -92,7 +92,7 @@
{% call(lote, col) tabla(columnas, historial, vacio="Todavía no hay cargas incrementales.") %}
{% set d = lote.filas or {} %}
{% if col.clave == "id" %}<a href="/operaciones/cargas/{{ lote.id }}">{{ lote.id }}</a>
{% elif col.clave == "fecha" %}{{ lote.created_at.strftime("%d/%m/%Y %H:%M") }}
{% elif col.clave == "fecha" %}{{ lote.created_at | mx("%d/%m/%Y %H:%M") }}
{% elif col.clave == "archivo" %}{{ d.get("archivo", "—") }}
{% elif col.clave == "estado" %}{{ badge("Confirmada", "exito") if d.get("estado") == "confirmada" else badge("Rechazada", "peligro") }}
{% elif col.clave == "filas" %}{{ d.get("transacciones_cargadas", 0) }}{% if d.get("creditos_cargados") %} <small>+ {{ d.creditos_cargados }} créditos</small>{% endif %}
+1 -1
View File
@@ -12,7 +12,7 @@
<header class="pagina__encabezado">
<p class="pagina__bajada"><a href="/operaciones/cargas">← Cargas incrementales</a></p>
<h1 class="pagina__titulo">Carga {{ lote.id }} {{ badge("Confirmada", "exito") if datos.get("estado") == "confirmada" else badge("Rechazada", "peligro") }}</h1>
<p class="pagina__bajada">{{ datos.get("archivo", "—") }} · {{ lote.created_at.strftime("%d/%m/%Y %H:%M") }} · {{ lote.usuario }} · SHA-256 <code>{{ lote.archivo_hash[:16] }}…</code></p>
<p class="pagina__bajada">{{ datos.get("archivo", "—") }} · {{ lote.created_at | mx("%d/%m/%Y %H:%M") }} · {{ lote.usuario }} · SHA-256 <code>{{ lote.archivo_hash[:16] }}…</code></p>
</header>
{{ pestanas("cargas") }}