Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e76bd7fb97 | ||
|
|
1904f0c912 | ||
|
|
fc8c0c5bf1 | ||
|
|
ac287e39ec | ||
|
|
c6ca330d5c | ||
|
|
5349997586 |
No files matched your search
+4
-1
@@ -13,7 +13,10 @@ from app.models import Base
|
||||
|
||||
config = context.config
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name)
|
||||
# Sin deshabilitar los loggers que ya existen: si no, una migración dentro de la suite apaga
|
||||
# los de la aplicación (p. ej. `app.services.alertas`) y las pruebas que leen el log fallan
|
||||
# según el orden en que corren (backlog O13).
|
||||
fileConfig(config.config_file_name, disable_existing_loggers=False)
|
||||
|
||||
# Una URL fijada por código (tests) gana sobre DATABASE_URL del entorno.
|
||||
if not config.get_main_option("sqlalchemy.url"):
|
||||
|
||||
@@ -38,6 +38,7 @@ from app import __version__
|
||||
from app.auth import usuario_actual
|
||||
from app.fechas import formato
|
||||
from app.models.screening import FUENTE_DECLARADA_ORIGEN
|
||||
from app.services import alertas as _alertas
|
||||
|
||||
RAIZ_APP = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -146,6 +147,13 @@ plantillas.env.finalize = sin_marca_heredada
|
||||
# `pendiente(clave)`.
|
||||
plantillas.env.globals["textos"] = app.textos
|
||||
|
||||
# Plazo y vencimiento de una alerta como se muestran (una cerrada no vence; la D-01 de una carga
|
||||
# es una revisión de 30 días).
|
||||
plantillas.env.globals["plazo_de_alerta"] = lambda a: _alertas.etiqueta_plazo(
|
||||
a.plazo_aviso, a.evidencia
|
||||
)
|
||||
plantillas.env.globals["vence_visible"] = lambda a: _alertas.vence_visible(a)
|
||||
|
||||
|
||||
CONTADORES: dict[str, Callable[[Request], int | None]] = {}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ def bandeja(
|
||||
"nivel": a.nivel,
|
||||
"estado": a.estado,
|
||||
"responsable": a.responsable,
|
||||
"vence_el": a.vence_el,
|
||||
"vence_el": a.vence_el if a.estado in ESTADOS_ABIERTOS else None, # cerrada: no vence
|
||||
"vencida": a.vence_el is not None and a.vence_el < hoy and a.estado in ESTADOS_ABIERTOS,
|
||||
"cliente_id": a.cliente_id,
|
||||
"cliente": id_externo,
|
||||
|
||||
@@ -16,7 +16,7 @@ from app.auth import requiere_rol
|
||||
from app.db import get_db
|
||||
from app.models.usuario import Rol
|
||||
from app.routers import render
|
||||
from app.services.auditoria import FiltrosAuditoria, consultar, detalle, opciones
|
||||
from app.services.auditoria import CIERRES, FiltrosAuditoria, consultar, detalle, opciones
|
||||
|
||||
ROLES = (Rol.OFICIAL, Rol.AUDITOR)
|
||||
router = APIRouter(tags=["auditoria"], dependencies=[Depends(requiere_rol(*ROLES))])
|
||||
@@ -52,6 +52,7 @@ def lista(
|
||||
desde: str | None = None,
|
||||
hasta: str | None = None,
|
||||
entidad_id: str | None = None,
|
||||
cierre: str | None = None,
|
||||
pagina: int = 1,
|
||||
) -> HTMLResponse:
|
||||
filtros = FiltrosAuditoria(
|
||||
@@ -61,6 +62,7 @@ def lista(
|
||||
desde=_fecha(desde, "desde"),
|
||||
hasta=_fecha(hasta, "hasta"),
|
||||
entidad_id=_entero(entidad_id, "entidad_id"),
|
||||
cierre=cierre if cierre in CIERRES else None,
|
||||
)
|
||||
resultado = consultar(db, filtros, pagina)
|
||||
return render(
|
||||
|
||||
@@ -28,6 +28,7 @@ from app.models import LoteCarga, Usuario
|
||||
from app.models.usuario import Rol
|
||||
from app.routers import render
|
||||
from app.services import operaciones as servicio
|
||||
from app.services import screening as servicio_screening
|
||||
from app.services.alertas import tenant_de_sesion
|
||||
|
||||
router = APIRouter(tags=["carga"])
|
||||
@@ -140,6 +141,7 @@ def ver_lote(
|
||||
"puede_cargar": request.state.usuario.rol in ROLES_CARGA,
|
||||
"ya_cargado": request.query_params.get("ya_cargado") == "1",
|
||||
"error": request.query_params.get("error"),
|
||||
"sin_listas": not servicio_screening.listas_vigentes(db, tenant_de_sesion(db)),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ from app.models import Cliente, EvaluacionRiesgo
|
||||
from app.routers import render
|
||||
from app.schemas.alertas import FiltrosCartera
|
||||
from app.services.alertas import alertas_abiertas_por_cliente, tenant_de_sesion
|
||||
from app.services.clientes import de_la_cartera
|
||||
|
||||
router = APIRouter(tags=["cartera"])
|
||||
|
||||
@@ -66,7 +67,9 @@ def cartera(
|
||||
niveles = niveles_vigentes(db, tenant.id)
|
||||
abiertas = alertas_abiertas_por_cliente(db, tenant)
|
||||
|
||||
consulta = select(Cliente).where(Cliente.tenant_id == tenant.id)
|
||||
# Los terceros (pagadores, socios, beneficiarios sin crédito) no son cartera.
|
||||
cartera = (Cliente.tenant_id == tenant.id, de_la_cartera())
|
||||
consulta = select(Cliente).where(*cartera)
|
||||
if filtros.estado_relacion:
|
||||
consulta = consulta.where(Cliente.estado_relacion == filtros.estado_relacion)
|
||||
if filtros.q:
|
||||
@@ -78,7 +81,7 @@ def cartera(
|
||||
elif filtros.nivel:
|
||||
clientes = [c for c in clientes if niveles.get(c.id) == filtros.nivel]
|
||||
|
||||
total_tenant = db.scalar(select(func.count(Cliente.id)).where(Cliente.tenant_id == tenant.id))
|
||||
total_tenant = db.scalar(select(func.count(Cliente.id)).where(*cartera))
|
||||
conteos = {
|
||||
"clientes": total_tenant,
|
||||
"filtrados": len(clientes),
|
||||
@@ -87,13 +90,7 @@ def cartera(
|
||||
"alertas_abiertas": sum(abiertas.values()),
|
||||
}
|
||||
estados_relacion = sorted(
|
||||
{
|
||||
e
|
||||
for (e,) in db.execute(
|
||||
select(Cliente.estado_relacion).where(Cliente.tenant_id == tenant.id).distinct()
|
||||
)
|
||||
if e
|
||||
}
|
||||
{e for (e,) in db.execute(select(Cliente.estado_relacion).where(*cartera).distinct()) if e}
|
||||
)
|
||||
|
||||
paginas = max(1, -(-len(clientes) // filtros.por_pagina))
|
||||
|
||||
@@ -198,13 +198,14 @@ def listado(
|
||||
pagina: Annotated[int, Query(ge=1)] = 1,
|
||||
nivel: Annotated[str | None, Query(max_length=20)] = None,
|
||||
incompleto: Annotated[str | None, Query(max_length=1)] = None,
|
||||
documentos: Annotated[str | None, Query(max_length=1)] = None,
|
||||
) -> HTMLResponse:
|
||||
nivel = nivel or None # "?nivel=" vacío es "todos", como en /cartera
|
||||
if nivel is not None and nivel not in (*NIVELES, SIN_EVALUAR):
|
||||
raise HTTPException(status.HTTP_422_UNPROCESSABLE_CONTENT, "nivel no reconocido")
|
||||
tenant = tenant_de_sesion(db)
|
||||
niveles = niveles_vigentes(db, tenant.id)
|
||||
if nivel is None and not incompleto:
|
||||
if nivel is None and not incompleto and not documentos:
|
||||
filas, total = servicio.buscar_clientes(db, tenant, q, pagina, POR_PAGINA)
|
||||
else:
|
||||
# El nivel vigente y la completitud no están en la consulta del servicio: se filtra aquí,
|
||||
@@ -216,6 +217,9 @@ def listado(
|
||||
if incompleto:
|
||||
incompletos = servicio.expedientes_incompletos(db, tenant)
|
||||
todas = [(c, i) for c, i in todas if c.id in incompletos]
|
||||
if documentos:
|
||||
pendientes = servicio.con_documentos_pendientes(db, tenant)
|
||||
todas = [(c, i) for c, i in todas if c.id in pendientes]
|
||||
total = len(todas)
|
||||
filas = todas[(pagina - 1) * POR_PAGINA : pagina * POR_PAGINA]
|
||||
paginas = max(1, -(-total // POR_PAGINA))
|
||||
@@ -234,6 +238,7 @@ def listado(
|
||||
"q": q or "",
|
||||
"nivel": nivel or "",
|
||||
"incompleto": bool(incompleto),
|
||||
"documentos": bool(documentos),
|
||||
"total": total,
|
||||
"pagina": pagina,
|
||||
"paginas": paginas,
|
||||
|
||||
@@ -30,6 +30,7 @@ from app.models import (
|
||||
from app.models.usuario import Rol
|
||||
from app.routers import render
|
||||
from app.services.agregados import tenant_de_sesion
|
||||
from app.services.clientes import de_la_cartera
|
||||
from app.services.modelos import distribucion, modelo_vigente
|
||||
from app.services.riesgo import (
|
||||
clasificados_entre,
|
||||
@@ -93,7 +94,9 @@ def cartera(
|
||||
filas = db.execute(_ultimas_evaluaciones(db, tenant.id)).all()
|
||||
niveles = [e.nivel for e, _, _ in filas]
|
||||
sin_evaluar = db.scalar(
|
||||
select(func.count()).select_from(Cliente).where(Cliente.tenant_id == tenant.id)
|
||||
select(func.count())
|
||||
.select_from(Cliente)
|
||||
.where(Cliente.tenant_id == tenant.id, de_la_cartera())
|
||||
) - len(filas)
|
||||
if nivel in NIVELES:
|
||||
filas = [f for f in filas if f[0].nivel == nivel]
|
||||
|
||||
@@ -51,6 +51,7 @@ from dataclasses import dataclass, field
|
||||
from datetime import date, timedelta
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -410,6 +411,23 @@ PLAZO_DESDE_CORTE = (
|
||||
"Alerta creada por una carga con el hecho anterior a la fecha de corte de la empresa: el plazo "
|
||||
"cuenta desde el corte"
|
||||
)
|
||||
ETIQUETAS_PLAZO = {"24h": "24 horas", "aviso": "aviso", "inmediato": "inmediato"}
|
||||
|
||||
|
||||
def etiqueta_plazo(plazo_aviso: str | None, evidencia: dict | None = None) -> str:
|
||||
"""El plazo como se muestra. Una D-01 creada por una carga conserva `plazo_aviso =
|
||||
"inmediato"` (el de su regla) pero vence a los 30 días del corte: se muestra como revisión."""
|
||||
if (evidencia or {}).get("plazo_desde_motivo") == PLAZO_REVISION_CARGA:
|
||||
return f"revisión {DIAS_REVISION_CARGA} días"
|
||||
if plazo_aviso is None:
|
||||
return "análisis interno"
|
||||
return ETIQUETAS_PLAZO.get(plazo_aviso, plazo_aviso)
|
||||
|
||||
|
||||
def vence_visible(alerta: Any) -> date | None:
|
||||
"""La fecha de vencimiento que se muestra: solo la de una alerta abierta. Una alerta cerrada
|
||||
(dictaminada, reportada en un aviso o histórica) ya no vence."""
|
||||
return alerta.vence_el if alerta.estado in ESTADOS_ABIERTOS else None
|
||||
|
||||
|
||||
def _nueva_alerta(
|
||||
|
||||
@@ -12,7 +12,7 @@ from dataclasses import dataclass, field
|
||||
from datetime import date
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import Select, func, select
|
||||
from sqlalchemy import Select, func, or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.fechas import inicio_del_dia_utc, limite_utc
|
||||
@@ -20,6 +20,8 @@ from app.models import AuditTrail
|
||||
from app.services.agregados import tenant_de_sesion
|
||||
|
||||
POR_PAGINA = 50
|
||||
CIERRE_DICTAMEN, CIERRE_CARGA = "dictamen", "carga"
|
||||
CIERRES = (CIERRE_DICTAMEN, CIERRE_CARGA)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -30,6 +32,9 @@ class FiltrosAuditoria:
|
||||
desde: date | None = None
|
||||
hasta: date | None = None
|
||||
entidad_id: int | None = None
|
||||
# Cierres de alertas: `dictamen` (los del oficial) o `carga` (las ya reportadas en un aviso
|
||||
# que la carga cierra; `services.avisos.MOTIVO_REPORTADA`).
|
||||
cierre: str | None = None
|
||||
|
||||
@property
|
||||
def activos(self) -> dict[str, Any]:
|
||||
@@ -72,6 +77,13 @@ def _filtrar(consulta: Select, tenant_id: int, f: FiltrosAuditoria) -> Select:
|
||||
consulta = consulta.where(AuditTrail.usuario == f.usuario)
|
||||
if f.accion:
|
||||
consulta = consulta.where(AuditTrail.accion.contains(f.accion))
|
||||
if f.cierre in CIERRES:
|
||||
from app.services.avisos import MOTIVO_REPORTADA
|
||||
|
||||
de_carga = AuditTrail.motivo.startswith(MOTIVO_REPORTADA)
|
||||
consulta = consulta.where(
|
||||
de_carga if f.cierre == CIERRE_CARGA else or_(AuditTrail.motivo.is_(None), ~de_carga)
|
||||
)
|
||||
if f.desde:
|
||||
consulta = consulta.where(AuditTrail.fecha >= inicio_del_dia_utc(f.desde))
|
||||
if f.hasta:
|
||||
|
||||
@@ -66,6 +66,9 @@ REGLAS_SIN_OPERACION = ("E-01",) # tienen plazo de aviso pero no son una operac
|
||||
ESTADOS_QUE_SE_CIERRAN = ("nueva", "en_revision", "escalada")
|
||||
ACCION_REPORTADA = "estado:cerrada"
|
||||
ACCION_HISTORICA = f"estado:{ESTADO_HISTORICA}"
|
||||
# Motivo con que la carga cierra una alerta ya reportada (`estado:cerrada`, como un dictamen):
|
||||
# Evidencia y el audit trail la cuentan aparte de los dictámenes por este prefijo.
|
||||
MOTIVO_REPORTADA = "Reportada en el aviso del periodo"
|
||||
TEXTO_HISTORICA = "Anterior a la operación de la plataforma"
|
||||
|
||||
|
||||
@@ -205,7 +208,7 @@ def cerrar_historicas(
|
||||
alerta.estado = "cerrada"
|
||||
accion = ACCION_REPORTADA
|
||||
motivo = (
|
||||
f"Reportada en el aviso del periodo {aviso.periodo}"
|
||||
f"{MOTIVO_REPORTADA} {aviso.periodo}"
|
||||
f"{f', acuse {aviso.folio_acuse}' if aviso.folio_acuse else ''} ({origen})"
|
||||
)
|
||||
resultado.reportadas.append(alerta.id)
|
||||
|
||||
@@ -36,17 +36,22 @@ import re
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy import ColumnElement, exists, func, not_, or_, select
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app import audit
|
||||
from app.models import (
|
||||
BeneficiarioControlador,
|
||||
Cliente,
|
||||
Credito,
|
||||
Declaracion,
|
||||
EvaluacionRiesgo,
|
||||
Identificacion,
|
||||
Participacion,
|
||||
PerfilTransaccional,
|
||||
Tenant,
|
||||
Transaccion,
|
||||
ahora_utc,
|
||||
)
|
||||
from app.schemas.expediente import (
|
||||
@@ -250,6 +255,25 @@ def resumen_alta(session: Session, cliente: Cliente) -> ResumenAlta:
|
||||
# --- Alta -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def de_la_cartera() -> ColumnElement[bool]:
|
||||
"""Condición SQL sobre `Cliente`: la persona es de la cartera.
|
||||
|
||||
Un cliente es quien tiene crédito o contrato con la empresa (glosario del brief). Los terceros
|
||||
viven en `cliente` para pasar por el screening (el pagador tercero que da de alta la carga, el
|
||||
tercero de una declaración, el socio o el beneficiario controlador de una persona moral), pero
|
||||
no son cartera: no entran a la lista de cartera ni a los conteos de Inicio. Fuera de la cartera
|
||||
queda solo quien no tiene crédito y figura como tercero; un alta de la interfaz sin crédito
|
||||
todavía sigue en la cartera."""
|
||||
con_credito = exists().where(Credito.cliente_id == Cliente.id)
|
||||
es_tercero = or_(
|
||||
exists().where(Transaccion.pagador_id == Cliente.id),
|
||||
exists().where(Declaracion.tercero_id == Cliente.id),
|
||||
exists().where(Participacion.socio_id == Cliente.id),
|
||||
exists().where(BeneficiarioControlador.persona_fisica_id == Cliente.id),
|
||||
)
|
||||
return or_(con_credito, not_(es_tercero))
|
||||
|
||||
|
||||
def alta_cliente(
|
||||
session: Session,
|
||||
tenant: Tenant,
|
||||
|
||||
@@ -529,6 +529,16 @@ class Completitud:
|
||||
or self.sin_identificacion
|
||||
)
|
||||
|
||||
@property
|
||||
def datos_completos(self) -> bool:
|
||||
"""Identificación capturada y declaración vigente: lo que cuenta Inicio como expediente
|
||||
incompleto. Los documentos se cuentan aparte (`documentos_completos`)."""
|
||||
return not (self.sin_declaracion or self.sin_identificacion)
|
||||
|
||||
@property
|
||||
def documentos_completos(self) -> bool:
|
||||
return not (self.faltantes or self.vencidos or self.desactualizados)
|
||||
|
||||
@property
|
||||
def pendientes(self) -> int:
|
||||
return (
|
||||
@@ -594,9 +604,13 @@ def _completitud(
|
||||
return resultado
|
||||
|
||||
|
||||
def expedientes_incompletos(session: Session, tenant: Tenant, hoy: date | None = None) -> set[int]:
|
||||
"""Clientes del tenant cuyo expediente no está completo (`completitud(...).completo` es falso),
|
||||
calculado por lote: cuatro consultas en lugar de cuatro por cliente (Inicio, Pieza M)."""
|
||||
def _completitud_por_lote(
|
||||
session: Session, tenant: Tenant, hoy: date | None = None
|
||||
) -> dict[int, Completitud]:
|
||||
"""`cliente_id → Completitud` de la cartera del tenant, calculada por lote: cuatro consultas en
|
||||
lugar de cuatro por cliente (Inicio, Pieza M). Los terceros sin crédito no son cartera."""
|
||||
from app.services.clientes import de_la_cartera
|
||||
|
||||
hoy = hoy or date.today()
|
||||
documentos: dict[int, list[Documento]] = {}
|
||||
for d in session.scalars(
|
||||
@@ -624,16 +638,39 @@ def expedientes_incompletos(session: Session, tenant: Tenant, hoy: date | None =
|
||||
)
|
||||
)
|
||||
return {
|
||||
cliente_id
|
||||
for cliente_id, tipo_persona in session.execute(
|
||||
select(Cliente.id, Cliente.tipo_persona).where(Cliente.tenant_id == tenant.id)
|
||||
)
|
||||
if not _completitud(
|
||||
cliente_id: _completitud(
|
||||
tipo_persona,
|
||||
_fichas(tipo_persona, documentos.get(cliente_id, []), hoy),
|
||||
sin_declaracion=cliente_id not in con_declaracion,
|
||||
sin_identificacion=cliente_id not in capturadas,
|
||||
).completo
|
||||
)
|
||||
for cliente_id, tipo_persona in session.execute(
|
||||
select(Cliente.id, Cliente.tipo_persona).where(
|
||||
Cliente.tenant_id == tenant.id, de_la_cartera()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def expedientes_incompletos(session: Session, tenant: Tenant, hoy: date | None = None) -> set[int]:
|
||||
"""Clientes de la cartera con datos incompletos: sin identificación capturada o sin
|
||||
declaración vigente (`Completitud.datos_completos`). Una cartera migrada trae los datos pero no
|
||||
los documentos; los documentos pendientes se cuentan aparte (`con_documentos_pendientes`)."""
|
||||
return {
|
||||
cliente_id
|
||||
for cliente_id, c in _completitud_por_lote(session, tenant, hoy).items()
|
||||
if not c.datos_completos
|
||||
}
|
||||
|
||||
|
||||
def con_documentos_pendientes(
|
||||
session: Session, tenant: Tenant, hoy: date | None = None
|
||||
) -> set[int]:
|
||||
"""Clientes de la cartera con algún documento obligatorio faltante, vencido o desactualizado."""
|
||||
return {
|
||||
cliente_id
|
||||
for cliente_id, c in _completitud_por_lote(session, tenant, hoy).items()
|
||||
if not c.documentos_completos
|
||||
}
|
||||
|
||||
|
||||
|
||||
+48
-14
@@ -40,6 +40,7 @@ from app.models import (
|
||||
Tenant,
|
||||
Transaccion,
|
||||
)
|
||||
from app.services import alertas as servicio_alertas
|
||||
from app.services import auditoria as servicio_auditoria
|
||||
from app.services import calendario as servicio_calendario
|
||||
from app.services import expediente as servicio_expediente
|
||||
@@ -87,7 +88,7 @@ class AvisoDelPeriodo:
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Informacion:
|
||||
al: date | None # último movimiento cargado: la mayor fecha de pago o de disposición
|
||||
al: date | None # la fecha de corte de la empresa (None si no hay movimientos cargados)
|
||||
ultima_carga: LoteCarga | None
|
||||
aceptadas: int
|
||||
rechazadas: int
|
||||
@@ -163,15 +164,19 @@ def _aviso(session: Session, tenant: Tenant, hoy: date) -> AvisoDelPeriodo:
|
||||
|
||||
|
||||
def informacion_al(session: Session, tenant: Tenant) -> date | None:
|
||||
"""La fecha del último movimiento cargado: la mayor entre pagos y disposiciones."""
|
||||
pago = session.scalar(
|
||||
select(func.max(Transaccion.fecha_pago)).where(Transaccion.tenant_id == tenant.id)
|
||||
"""Hasta dónde llega la información: la fecha de corte de la empresa, o `None` si todavía no
|
||||
hay movimientos cargados.
|
||||
|
||||
No es el último movimiento: una cartera real casi nunca tiene un pago el último día del mes, y
|
||||
con él el aviso del mes cerrado parecería siempre incompleto. El corte lo fija el alta o el
|
||||
vaciado y lo mueve el cierre de periodo."""
|
||||
hay_pago = session.scalar(
|
||||
select(Transaccion.id).where(Transaccion.tenant_id == tenant.id).limit(1)
|
||||
)
|
||||
disposicion = session.scalar(
|
||||
select(func.max(Credito.fecha_disposicion)).where(Credito.tenant_id == tenant.id)
|
||||
)
|
||||
fechas_ = [f for f in (pago, disposicion) if f is not None]
|
||||
return max(fechas_) if fechas_ else None
|
||||
hay_credito = session.scalar(select(Credito.id).where(Credito.tenant_id == tenant.id).limit(1))
|
||||
if hay_pago is None and hay_credito is None:
|
||||
return None
|
||||
return tenant.fecha_corte
|
||||
|
||||
|
||||
def _informacion(session: Session, tenant: Tenant, aviso: AvisoDelPeriodo) -> Informacion:
|
||||
@@ -220,6 +225,7 @@ class AlertaPendiente:
|
||||
nombre: str
|
||||
cliente: str
|
||||
plazo_aviso: str | None
|
||||
plazo: str # como se muestra (`alertas.etiqueta_plazo`)
|
||||
vence_el: date | None
|
||||
antiguedad_dias: int
|
||||
vencida: bool
|
||||
@@ -254,6 +260,7 @@ ORDEN_PENDIENTES = (
|
||||
"alertas_otras",
|
||||
"sin_clasificacion",
|
||||
"expediente_incompleto",
|
||||
"documentos_pendientes",
|
||||
)
|
||||
|
||||
|
||||
@@ -321,10 +328,16 @@ def pendientes(session: Session, tenant: Tenant, hoy: date | None = None) -> Pen
|
||||
),
|
||||
Pendiente(
|
||||
"expediente_incompleto",
|
||||
"Clientes con expediente incompleto",
|
||||
"Clientes con datos del expediente incompletos",
|
||||
len(servicio_expediente.expedientes_incompletos(session, tenant, hoy)),
|
||||
"/expediente?incompleto=1",
|
||||
),
|
||||
Pendiente(
|
||||
"documentos_pendientes",
|
||||
"Clientes con documentos pendientes",
|
||||
len(servicio_expediente.con_documentos_pendientes(session, tenant, hoy)),
|
||||
"/expediente?documentos=1",
|
||||
),
|
||||
]
|
||||
filas = session.execute(
|
||||
_alertas_abiertas(session, tenant)
|
||||
@@ -343,6 +356,7 @@ def pendientes(session: Session, tenant: Tenant, hoy: date | None = None) -> Pen
|
||||
nombre=nombre,
|
||||
cliente=id_externo,
|
||||
plazo_aviso=a.plazo_aviso,
|
||||
plazo=servicio_alertas.etiqueta_plazo(a.plazo_aviso, a.evidencia),
|
||||
vence_el=a.vence_el,
|
||||
antiguedad_dias=(hoy - fechas.fecha_en_mexico(a.created_at)).days,
|
||||
vencida=a.vence_el is not None and a.vence_el < hoy,
|
||||
@@ -375,13 +389,21 @@ class Evidencia:
|
||||
|
||||
|
||||
def _bitacora(
|
||||
session: Session, entidad: str, accion: str, desde: date, hasta: date
|
||||
session: Session,
|
||||
entidad: str,
|
||||
accion: str,
|
||||
desde: date,
|
||||
hasta: date,
|
||||
cierre: str | None = None,
|
||||
) -> tuple[int, str]:
|
||||
"""El conteo y la ruta de la bitácora (`/auditoria`): quién, cuándo y con qué justificación.
|
||||
El conteo sale de la misma consulta que la lista."""
|
||||
filtros = FiltrosAuditoria(entidad=entidad, accion=accion, desde=desde, hasta=hasta)
|
||||
filtros = FiltrosAuditoria(
|
||||
entidad=entidad, accion=accion, desde=desde, hasta=hasta, cierre=cierre
|
||||
)
|
||||
total = servicio_auditoria.consultar(session, filtros, por_pagina=1).total
|
||||
consulta = urlencode({"entidad": entidad, "accion": accion, "desde": desde, "hasta": hasta})
|
||||
parametros = {"entidad": entidad, "accion": accion, "desde": desde, "hasta": hasta}
|
||||
consulta = urlencode(parametros | ({"cierre": cierre} if cierre else {}))
|
||||
return total, f"/auditoria?{consulta}"
|
||||
|
||||
|
||||
@@ -389,7 +411,13 @@ def evidencia(session: Session, tenant: Tenant, hoy: date | None = None) -> Evid
|
||||
hoy = hoy or fechas.hoy()
|
||||
desde = hoy.replace(day=1)
|
||||
coincidencias, ruta_coincidencias = _bitacora(session, "coincidencia", "decidir:", desde, hoy)
|
||||
alertas, ruta_alertas = _bitacora(session, "alerta", "estado:cerrada", desde, hoy)
|
||||
# Los cierres de la carga (alertas ya reportadas en un aviso) no son dictámenes: van aparte.
|
||||
alertas, ruta_alertas = _bitacora(
|
||||
session, "alerta", "estado:cerrada", desde, hoy, servicio_auditoria.CIERRE_DICTAMEN
|
||||
)
|
||||
por_carga, ruta_carga = _bitacora(
|
||||
session, "alerta", "estado:cerrada", desde, hoy, servicio_auditoria.CIERRE_CARGA
|
||||
)
|
||||
clasificados = servicio_riesgo.clasificados_entre(session, tenant, desde, hoy)
|
||||
modelo = modelo_vigente(session, tenant)
|
||||
return Evidencia(
|
||||
@@ -403,6 +431,12 @@ def evidencia(session: Session, tenant: Tenant, hoy: date | None = None) -> Evid
|
||||
enlace=ruta_coincidencias,
|
||||
),
|
||||
Indicador("alertas_dictaminadas", "Alertas dictaminadas", alertas, enlace=ruta_alertas),
|
||||
Indicador(
|
||||
"alertas_cerradas_por_carga",
|
||||
"Alertas cerradas por la carga (ya reportadas en un aviso)",
|
||||
por_carga,
|
||||
enlace=ruta_carga,
|
||||
),
|
||||
Indicador(
|
||||
"clientes_clasificados",
|
||||
"Clientes clasificados",
|
||||
|
||||
@@ -1370,7 +1370,14 @@ def procesar_lote(session: Session, lote: LoteCarga, usuario: str | None = None)
|
||||
|
||||
_avance(session, lote, "screening", 0, len(nombres))
|
||||
coincidencias = 0
|
||||
if nombres:
|
||||
# Sin listas el screening no encuentra nada: se avisa en el lote en lugar de dar cero en
|
||||
# silencio (se corre después con `python -m app.services.screening --cartera`).
|
||||
sin_listas = not servicio_screening.listas_vigentes(session, tenant)
|
||||
if sin_listas:
|
||||
logger.warning(
|
||||
"Lote %s: la empresa %s no tiene listas; screening sin correr", lote.id, tenant.id
|
||||
)
|
||||
if nombres and not sin_listas:
|
||||
coincidencias = servicio_screening.screening_cartera(
|
||||
session, usuario=autor, cliente_ids=nombres
|
||||
).creadas
|
||||
@@ -1416,6 +1423,7 @@ def procesar_lote(session: Session, lote: LoteCarga, usuario: str | None = None)
|
||||
"evento": evento,
|
||||
"posteriores_al_corte": posteriores or 0,
|
||||
"coincidencias_nuevas": coincidencias,
|
||||
"screening_sin_listas": sin_listas,
|
||||
"evaluados": len(afectados),
|
||||
"cambios_nivel": cambios,
|
||||
"alertas_nuevas": reglas.creadas,
|
||||
|
||||
@@ -458,7 +458,12 @@ def sin_clasificacion_vigente(session: Session, tenant: Tenant) -> set[int]:
|
||||
"""Clientes sin una evaluación con la metodología vigente (nunca evaluados o evaluados con una
|
||||
versión anterior). Inicio cuenta esto y `/riesgo?pendientes=1` lo lista."""
|
||||
modelo = modelo_vigente(session, tenant)
|
||||
todos = set(session.scalars(select(Cliente.id).where(Cliente.tenant_id == tenant.id)))
|
||||
from app.services.clientes import de_la_cartera
|
||||
|
||||
# Los terceros sin crédito (el pagador que da de alta la carga) no son cartera.
|
||||
todos = set(
|
||||
session.scalars(select(Cliente.id).where(Cliente.tenant_id == tenant.id, de_la_cartera()))
|
||||
)
|
||||
if modelo is None:
|
||||
return todos
|
||||
evaluados = set(
|
||||
|
||||
+65
-68
@@ -49,7 +49,6 @@
|
||||
--grafica-ejes: #8A929C;
|
||||
/* Tipografía (self-hosted en /static/fuentes; ver 2. Base) */
|
||||
--fuente: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
--fuente-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
--fuente-acceso: "Manrope", var(--fuente);
|
||||
/* Forma */
|
||||
--radio-sm: 6px;
|
||||
@@ -93,8 +92,6 @@
|
||||
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fuentes/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fuentes/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fuentes/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fuentes/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fuentes/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url("fuentes/manrope-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url("fuentes/manrope-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url("fuentes/manrope-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
|
||||
@@ -110,7 +107,7 @@ a { color: var(--color-verde-texto); text-decoration: none; }
|
||||
a:hover { color: var(--color-marino); text-decoration: underline; }
|
||||
button, input, select, textarea { font: inherit; color: inherit; }
|
||||
button { cursor: pointer; }
|
||||
code { font-family: var(--fuente-mono); font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--color-fondo); color: var(--color-texto); }
|
||||
code { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--color-fondo); color: var(--color-texto); }
|
||||
strong { font-weight: 600; }
|
||||
:focus-visible { outline: 2px solid var(--color-verde); outline-offset: 2px; }
|
||||
[hidden] { display: none !important; }
|
||||
@@ -139,11 +136,11 @@ strong { font-weight: 600; }
|
||||
.marca { display: block; padding: 8px 12px 20px; color: inherit; }
|
||||
.marca:hover { text-decoration: none; }
|
||||
.marca .logo { width: 138px; }
|
||||
.marca__ceja { display: block; margin-top: 10px; font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-verde-texto); }
|
||||
.marca__ceja { display: block; margin-top: 10px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-verde-texto); }
|
||||
/* Un solo <nav class="nav"> y sin modificadores en el enlace: tests/test_auth.py cuenta
|
||||
class="nav__enlace" y class="nav__enlace es-activo" exactos (Inicio y Cartera: data-principal). */
|
||||
.nav { display: flex; flex-direction: column; gap: 2px; }
|
||||
.nav__seccion { padding: 24px 12px 8px; font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.nav__seccion { padding: 24px 12px 8px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.nav__enlace {
|
||||
display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 12px; border-radius: var(--radio-xs);
|
||||
color: var(--color-texto); font-size: 14px; text-decoration: none;
|
||||
@@ -157,10 +154,10 @@ strong { font-weight: 600; }
|
||||
.nav__candado { width: 14px; height: 14px; opacity: 0.6; }
|
||||
.nav__contador {
|
||||
min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radio-pildora); background: var(--tono-aviso-fondo); color: var(--tono-aviso);
|
||||
font-family: var(--fuente-mono); font-size: 11px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
|
||||
font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.nav__enlace.es-activo .nav__contador { background: rgba(255, 255, 255, 0.16); color: #fff; }
|
||||
.lateral__pie { margin-top: auto; padding: 16px 12px 0; font-family: var(--fuente-mono); font-size: 11px; color: var(--color-texto-suave); }
|
||||
.lateral__pie { margin-top: auto; padding: 16px 12px 0; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--color-texto-suave); }
|
||||
.principal { position: relative; min-width: 0; overflow-x: clip; }
|
||||
.principal::before { /* destello verde (decorativo) */
|
||||
content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%; background: var(--color-verde);
|
||||
@@ -178,7 +175,7 @@ strong { font-weight: 600; }
|
||||
.encabezado__usuario form { margin: 0; }
|
||||
.usuario { display: flex; align-items: center; gap: 10px; }
|
||||
.usuario__nombre { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; }
|
||||
.usuario__rol { display: block; font-family: var(--fuente-mono); font-size: 11px; color: var(--color-texto-suave); }
|
||||
.usuario__rol { display: block; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--color-texto-suave); }
|
||||
.avatar {
|
||||
width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--color-verde); color: #fff;
|
||||
display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
|
||||
@@ -200,10 +197,10 @@ strong { font-weight: 600; }
|
||||
.pagina__encabezado:has(> .pagina__titulo) { flex-direction: column; align-items: flex-start; gap: 8px; }
|
||||
.pagina__textos { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 760px; }
|
||||
.pagina__textos--ancho { max-width: none; }
|
||||
.pagina__ceja { font-family: var(--fuente-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-verde-texto); }
|
||||
.pagina__ceja { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-verde-texto); }
|
||||
.pagina__titulo { font-size: 30px; font-weight: 600; line-height: 1.15; text-wrap: pretty; }
|
||||
.pagina__titulo--28 { font-size: 28px; line-height: 1.2; }
|
||||
.pagina__titulo--id { font-family: var(--fuente-mono); font-weight: 500; letter-spacing: -0.01em; word-break: break-all; }
|
||||
.pagina__titulo--id { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -0.01em; word-break: break-all; }
|
||||
.pagina__bajada { font-size: 15px; line-height: 1.5; color: var(--color-texto-suave); max-width: 720px; text-wrap: pretty; }
|
||||
.pagina__meta { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--color-texto-suave); }
|
||||
.pagina__acciones { display: flex; gap: 10px; flex-wrap: wrap; }
|
||||
@@ -246,12 +243,12 @@ strong { font-weight: 600; }
|
||||
a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-sutil); color: var(--color-texto); text-decoration: none; }
|
||||
/* Cifra seleccionada (filtro activo): un solo estilo en toda la app. */
|
||||
.resumen__cifra.es-seleccionada, .resumen__cifra[aria-current="true"] { background: rgba(63, 138, 124, 0.08); box-shadow: inset 0 -2px 0 var(--color-verde); }
|
||||
.resumen__etiqueta { display: flex; align-items: center; gap: 7px; font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.resumen__etiqueta { display: flex; align-items: center; gap: 7px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.resumen__etiqueta .punto { width: 7px; height: 7px; background: var(--punto, currentColor); }
|
||||
.resumen__valor { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
|
||||
.resumen__valor strong { font-size: 24px; font-weight: 600; line-height: 1; white-space: nowrap; }
|
||||
.resumen__valor strong.resumen__valor--20 { font-size: 20px; }
|
||||
.resumen__valor small { font-family: var(--fuente-mono); font-size: 12.5px; color: var(--color-texto-suave); }
|
||||
.resumen__valor small { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--color-texto-suave); }
|
||||
.resumen__nota { font-size: 12.5px; color: var(--color-texto-suave); }
|
||||
.resumen--interna { border: 0; border-radius: 0; border-bottom: 1px solid var(--color-borde-suave); background: none; -webkit-backdrop-filter: none; backdrop-filter: none; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
|
||||
.resumen--interna .resumen__cifra { padding: 16px 24px; gap: 8px; }
|
||||
@@ -278,11 +275,11 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.totales { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
||||
.totales__tarjeta { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px 22px; border-radius: var(--radio-tarjeta); background: var(--color-marino); color: #fff; }
|
||||
.totales__tarjeta strong { font-size: 26px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
|
||||
.totales__tarjeta span { font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); }
|
||||
.totales__tarjeta span { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); }
|
||||
.facetas__grupo { display: grid; grid-template-columns: 230px minmax(0, 1fr); align-items: center; gap: 10px 24px; padding: 16px 22px; }
|
||||
.facetas__grupo + .facetas__grupo { border-top: 1px solid var(--color-borde-suave); }
|
||||
.facetas__textos { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
|
||||
.facetas__titulo { font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto); font-weight: 500; }
|
||||
.facetas__titulo { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto); font-weight: 500; }
|
||||
.facetas__ayuda { font-size: 13px; line-height: 1.35; color: var(--color-texto-suave); }
|
||||
.segmentos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
|
||||
.segmento {
|
||||
@@ -294,7 +291,7 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.segmento__nombre { display: inline-flex; align-items: center; gap: 7px; margin-right: auto; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.segmento__nombre .punto { width: 7px; height: 7px; flex: none; background: var(--punto, var(--color-marino)); }
|
||||
.segmento__fila strong { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
|
||||
.segmento__fila small { flex: none; min-width: 34px; text-align: right; font-family: var(--fuente-mono); font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.segmento__fila small { flex: none; min-width: 34px; text-align: right; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.segmento__barra { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--color-borde-suave); overflow: hidden; }
|
||||
.segmento__barra::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--parte, 0%); border-radius: 2px; background: var(--punto, var(--color-marino)); }
|
||||
.segmento--todos { --punto: var(--color-texto-tenue); }
|
||||
@@ -314,12 +311,12 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
/* 4.4 Datos (dl) ------------------------------------------------------------------------------ */
|
||||
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px 32px; }
|
||||
.datos__par { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
||||
.datos__par dt { font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); line-height: 1.4; }
|
||||
.datos__par dt { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); line-height: 1.4; }
|
||||
/* :where() deja el dd en especificidad de elemento: una clase propia del dd (dd.score, dd.umbral
|
||||
de screening/*) conserva su tamaño. */
|
||||
:where(.datos__par) dd { font-size: 14.5px; font-weight: 500; word-break: break-word; }
|
||||
.datos__par dd small, .datos__nota { display: block; font-family: var(--fuente-mono); font-size: 12px; font-weight: 400; color: var(--color-texto-suave); margin-top: 2px; }
|
||||
.datos--metricas dd { font-family: var(--fuente-mono); font-size: 18px; font-weight: 500; }
|
||||
.datos__par dd small, .datos__nota { display: block; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 400; color: var(--color-texto-suave); margin-top: 2px; }
|
||||
.datos--metricas dd { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 500; }
|
||||
.datos--metricas dd.texto { font-family: var(--fuente); }
|
||||
/* Rejilla con líneas de 1px (datos operativos, campos de cartera, hechos). El -1px deja que la
|
||||
tarjeta recorte las líneas del borde. */
|
||||
@@ -333,12 +330,12 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.hechos { grid-template-columns: 1fr 1fr; margin: 0; gap: 1px; background: var(--color-borde-suave); border: 1px solid var(--color-borde); border-radius: var(--radio-md); overflow: hidden; }
|
||||
.hechos .datos__par { box-shadow: none; padding: 12px 14px; gap: 4px; }
|
||||
.hechos dt { font-size: 10.5px; }
|
||||
.hechos dd { font-family: var(--fuente-mono); font-size: 13.5px; font-weight: 400; }
|
||||
.hechos dd { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 400; }
|
||||
.datos--lista { display: block; }
|
||||
.datos--lista .datos__par { display: grid; grid-template-columns: minmax(140px, 180px) minmax(0, 1fr); gap: 8px 24px; padding: 16px 24px; border-bottom: 1px solid var(--color-borde-suave); }
|
||||
.datos--lista .datos__par:last-child { border-bottom: 0; }
|
||||
.datos--lista dt { font-family: var(--fuente); font-size: 13.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--color-texto); }
|
||||
.datos--lista dt small { display: block; margin-top: 2px; font-family: var(--fuente-mono); font-size: 11.5px; font-weight: 400; color: var(--color-texto-suave); }
|
||||
.datos--lista dt small { display: block; margin-top: 2px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; font-weight: 400; color: var(--color-texto-suave); }
|
||||
.datos--lista dd { font-size: 14px; font-weight: 400; line-height: 1.6; color: var(--color-texto-cuerpo); display: flex; flex-direction: column; gap: 8px; text-wrap: pretty; }
|
||||
/* Bloques divididos con línea vertical (Sujeto obligado) */
|
||||
.bloques { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); border-bottom: 1px solid var(--color-borde-suave); }
|
||||
@@ -352,7 +349,7 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.tabla-contenedor--alto { max-height: 520px; overflow-y: auto; }
|
||||
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
|
||||
.tabla th {
|
||||
text-align: left; padding: 12px 16px; font-family: var(--fuente-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
|
||||
text-align: left; padding: 12px 16px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
|
||||
text-transform: uppercase; color: var(--color-texto-suave); background: var(--color-sutil); border-bottom: 1px solid var(--color-borde); white-space: nowrap;
|
||||
}
|
||||
.tabla--blanca th { background: var(--color-superficie); }
|
||||
@@ -376,29 +373,29 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.tabla__ir { width: 40px; text-align: right; }
|
||||
.tabla__ir .icono { width: 16px; height: 16px; opacity: 0.45; }
|
||||
.fila-enlace { cursor: pointer; }
|
||||
.id-enlace { font-family: var(--fuente-mono); font-size: 13.5px; font-weight: 500; color: var(--color-verde-texto); white-space: nowrap; }
|
||||
.id-cliente { font-family: var(--fuente-mono); font-size: 13px; color: var(--color-texto); border-bottom: 1px dashed var(--color-borde-fuerte); white-space: nowrap; }
|
||||
.id-enlace { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 500; color: var(--color-verde-texto); white-space: nowrap; }
|
||||
.id-cliente { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--color-texto); border-bottom: 1px dashed var(--color-borde-fuerte); white-space: nowrap; }
|
||||
.id-cliente:hover { color: var(--color-verde-texto); text-decoration: none; }
|
||||
.vence { display: block; font-family: var(--fuente-mono); font-size: 13px; line-height: 1.35; white-space: nowrap; }
|
||||
.vence { display: block; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13px; line-height: 1.35; white-space: nowrap; }
|
||||
.vence__rel { display: block; font-size: 12px; color: var(--color-texto-suave); }
|
||||
.vence__rel.es-vencida { color: var(--tono-peligro); font-weight: 500; }
|
||||
.celda-doble { line-height: 1.35; }
|
||||
.celda-doble b { display: block; font-size: 13.5px; font-weight: 500; }
|
||||
.celda-doble small { display: block; font-family: var(--fuente-mono); font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.celda-doble small { display: block; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.celda-regla { max-width: 340px; }
|
||||
.punto[data-nivel-alerta="critica"] { background: var(--tono-peligro); }
|
||||
.punto[data-nivel-alerta="preventiva"] { background: var(--tono-aviso-punto); }
|
||||
.punto[data-nivel-alerta="informativa"] { background: var(--color-verde); }
|
||||
.celda-num { font-family: var(--fuente-mono); font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||
.celda-fecha { font-family: var(--fuente-mono); font-size: 13px; color: var(--color-texto-suave); white-space: nowrap; }
|
||||
.desglose { font-family: var(--fuente-mono); font-size: 12px; color: var(--color-texto-suave); white-space: nowrap; }
|
||||
.celda-num { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||
.celda-fecha { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--color-texto-suave); white-space: nowrap; }
|
||||
.desglose { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-texto-suave); white-space: nowrap; }
|
||||
.desglose--envuelve { white-space: normal; min-width: 240px; max-width: 340px; line-height: 1.45; }
|
||||
.barra-score { position: relative; display: inline-block; width: 72px; height: 4px; border-radius: var(--radio-pildora); background: var(--color-borde-suave); overflow: hidden; vertical-align: middle; }
|
||||
.barra-score > span { position: absolute; inset: 0 auto 0 0; width: var(--valor, 0%); border-radius: inherit; background: var(--punto, var(--color-verde)); }
|
||||
/* .score acotado a tablas: screening/detalle.html usa dd.score con su propio estilo. */
|
||||
.tabla .score { display: inline-flex; align-items: center; gap: 10px; }
|
||||
.tabla .score > b { width: 40px; text-align: right; font-family: var(--fuente-mono); font-size: 13.5px; font-weight: 500; }
|
||||
.encabezado-rejilla { display: grid; grid-template-columns: repeat(6, auto); gap: 12px; padding: 10px 24px; background: var(--color-sutil); border-bottom: 1px solid var(--color-borde-suave); font-family: var(--fuente-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); overflow: hidden; }
|
||||
.tabla .score > b { width: 40px; text-align: right; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 500; }
|
||||
.encabezado-rejilla { display: grid; grid-template-columns: repeat(6, auto); gap: 12px; padding: 10px 24px; background: var(--color-sutil); border-bottom: 1px solid var(--color-borde-suave); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); overflow: hidden; }
|
||||
|
||||
/* 4.6 Badges (macros badge, badge_nivel, badge_estado_alerta, badge_nivel_alerta) y etiquetas -- */
|
||||
.badge {
|
||||
@@ -431,7 +428,7 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
/* Etiquetas cuadradas (códigos, catálogos, lotes, versiones) */
|
||||
.etiqueta {
|
||||
display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radio-sm); background: var(--color-fondo);
|
||||
color: var(--color-texto-suave); font-family: var(--fuente-mono); font-size: 12px; white-space: nowrap; vertical-align: middle;
|
||||
color: var(--color-texto-suave); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; vertical-align: middle;
|
||||
}
|
||||
.etiqueta--alta { height: 26px; padding: 0 10px; border-radius: 7px; }
|
||||
.etiqueta--catalogo { height: 24px; padding: 0 9px; color: var(--color-texto); }
|
||||
@@ -451,7 +448,7 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.chip:hover { border-color: var(--color-borde-hover); color: var(--color-texto); text-decoration: none; }
|
||||
.chip.es-activo, .chip[aria-pressed="true"], .chip[aria-current="true"], .chip:has(input:checked) { background: var(--color-marino); border-color: var(--color-marino); color: #fff; }
|
||||
.chip:has(input:focus-visible) { outline: 2px solid var(--color-verde); outline-offset: 2px; }
|
||||
.chip--mono { height: 36px; padding: 0 14px; font-family: var(--fuente-mono); }
|
||||
.chip--mono { height: 36px; padding: 0 14px; font-family: var(--fuente); font-variant-numeric: tabular-nums; }
|
||||
.pestanas {
|
||||
display: flex; gap: 4px; overflow-x: auto; width: fit-content; max-width: 100%; padding: 5px; margin: 0; list-style: none;
|
||||
border-radius: var(--radio-md); background: var(--vidrio); border: 1px solid var(--color-borde); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
|
||||
@@ -463,10 +460,10 @@ a.resumen__cifra:hover, button.resumen__cifra:hover { background: var(--color-su
|
||||
.pestanas a:hover, .pestanas button:hover { background: #fff; color: var(--color-texto); text-decoration: none; }
|
||||
.pestanas [aria-current="page"], .pestanas [aria-selected="true"] { background: var(--color-marino); color: #fff; }
|
||||
.pestanas [aria-current="page"]:hover, .pestanas [aria-selected="true"]:hover { background: var(--color-marino); color: #fff; }
|
||||
.pestanas small { font-family: var(--fuente-mono); font-size: 11.5px; opacity: 0.65; }
|
||||
.pestanas small { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; opacity: 0.65; }
|
||||
/* Índice fijo de anclas (ficha del cliente) */
|
||||
.pestanas--ancla { position: sticky; top: 0; z-index: 5; width: auto; margin: 0 -6px; padding: 6px; border: 0; background: rgba(242, 242, 242, 0.82); }
|
||||
.pestanas--ancla .badge { height: 18px; min-width: 18px; padding: 0 5px; justify-content: center; font-family: var(--fuente-mono); font-size: 11px; }
|
||||
.pestanas--ancla .badge { height: 18px; min-width: 18px; padding: 0 5px; justify-content: center; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; }
|
||||
.pestanas--ancla .badge::before { display: none; }
|
||||
|
||||
/* 4.8 Botones y paginación --------------------------------------------------------------------- */
|
||||
@@ -509,11 +506,11 @@ form:has(input[type="file"]:valid) .boton--rojo-con-archivo:not([disabled]):hove
|
||||
.boton--icono { width: 36px; height: 36px; padding: 0; border-radius: 9px; }
|
||||
.boton--icono.boton--chico { width: 32px; height: 32px; }
|
||||
.paginacion { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px; }
|
||||
.paginacion__rango { font-family: var(--fuente-mono); font-size: 12px; color: var(--color-texto-suave); }
|
||||
.paginacion__rango { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-texto-suave); }
|
||||
.paginacion__paginas { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
||||
.paginacion__pagina {
|
||||
min-width: 36px; height: 36px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--color-borde); background: #fff; color: var(--color-texto);
|
||||
font-family: var(--fuente-mono); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
|
||||
font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
|
||||
}
|
||||
.paginacion__pagina:hover { border-color: var(--color-verde); color: var(--color-texto); text-decoration: none; }
|
||||
.paginacion__pagina[aria-current="page"] { background: var(--color-marino); border-color: var(--color-marino); color: #fff; }
|
||||
@@ -521,7 +518,7 @@ form:has(input[type="file"]:valid) .boton--rojo-con-archivo:not([disabled]):hove
|
||||
.paginacion__pagina .icono { width: 16px; height: 16px; }
|
||||
.paginacion--simple .paginacion__pagina { min-width: 32px; height: 32px; }
|
||||
.paginacion--simple .paginacion__pagina:hover { border-color: var(--color-borde-hover); }
|
||||
.paginacion__hueco { min-width: 24px; text-align: center; color: var(--color-texto-suave); font-family: var(--fuente-mono); font-size: 13px; }
|
||||
.paginacion__hueco { min-width: 24px; text-align: center; color: var(--color-texto-suave); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13px; }
|
||||
|
||||
/* 4.9 Formularios (campo, campo__entrada) ------------------------------------------------------ */
|
||||
.formulario { display: flex; flex-direction: column; gap: 18px; }
|
||||
@@ -535,7 +532,7 @@ form:has(input[type="file"]:valid) .boton--rojo-con-archivo:not([disabled]):hove
|
||||
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
||||
.campo__etiqueta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 500; line-height: 1.35; }
|
||||
.campo__etiqueta--inicio { justify-content: flex-start; align-items: center; }
|
||||
.campo__etiqueta small { font-family: var(--fuente-mono); font-weight: 400; color: var(--color-texto-suave); }
|
||||
.campo__etiqueta small { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-weight: 400; color: var(--color-texto-suave); }
|
||||
.campo__control { position: relative; }
|
||||
.campo__entrada {
|
||||
width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radio-boton); border: 1px solid var(--color-borde); background: #fff;
|
||||
@@ -544,7 +541,7 @@ form:has(input[type="file"]:valid) .boton--rojo-con-archivo:not([disabled]):hove
|
||||
.campo__entrada:focus { border-color: var(--color-verde); box-shadow: var(--anillo-foco); }
|
||||
.campo__entrada::placeholder { color: var(--color-texto-tenue); }
|
||||
.campo__entrada:disabled { background: var(--color-sutil); }
|
||||
.campo__entrada--mono { font-family: var(--fuente-mono); font-size: 13.5px; }
|
||||
.campo__entrada--mono { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; }
|
||||
.campo__entrada--38 { height: 38px; padding: 0 10px; }
|
||||
select.campo__entrada {
|
||||
appearance: none; -webkit-appearance: none; padding-right: 36px; text-overflow: ellipsis;
|
||||
@@ -557,7 +554,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.campo--crece { flex: 1 1 320px; }
|
||||
.campo--buscar .campo__entrada { padding-left: 40px; }
|
||||
.campo--buscar .campo__control > .icono { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; opacity: 0.55; pointer-events: none; }
|
||||
.campo__prefijo, .campo__sufijo { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--fuente-mono); color: var(--color-texto-suave); pointer-events: none; }
|
||||
.campo__prefijo, .campo__sufijo { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--fuente); font-variant-numeric: tabular-nums; color: var(--color-texto-suave); pointer-events: none; }
|
||||
.campo__prefijo { left: 12px; font-size: 14px; }
|
||||
.campo__sufijo { right: 12px; font-size: 12px; letter-spacing: 0.04em; }
|
||||
.campo__control:has(.campo__prefijo) .campo__entrada { padding-left: 28px; }
|
||||
@@ -569,7 +566,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.campo__ayuda { font-size: 12.5px; color: var(--color-texto-suave); line-height: 1.4; }
|
||||
.campo__error { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--tono-peligro); line-height: 1.4; }
|
||||
.campo__error::before { content: ""; width: 6px; height: 6px; margin-top: 5px; flex: none; border-radius: 50%; background: currentColor; }
|
||||
.contador { font-family: var(--fuente-mono); font-size: 12px; color: var(--color-texto-suave); }
|
||||
.contador { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-texto-suave); }
|
||||
.contador.es-suficiente { color: var(--tono-exito); }
|
||||
/* Casilla (checkbox en caja) */
|
||||
.casilla { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radio-boton); border: 1px solid var(--color-borde); background: #fff; font-size: 14px; cursor: pointer; }
|
||||
@@ -607,9 +604,9 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.zona-archivo__ayuda { font-size: 12.5px; color: var(--color-texto-suave); }
|
||||
.zona-archivo--grande .zona-archivo__ayuda { font-size: 13px; }
|
||||
.archivo { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radio-md); border: 1px solid var(--color-borde); background: var(--color-sutil); }
|
||||
.archivo__ext { width: 40px; height: 40px; flex: none; border-radius: var(--radio-boton); background: #fff; border: 1px solid var(--color-borde); display: flex; align-items: center; justify-content: center; font-family: var(--fuente-mono); font-size: 10.5px; font-weight: 500; color: var(--tono-exito); text-transform: uppercase; }
|
||||
.archivo__ext { width: 40px; height: 40px; flex: none; border-radius: var(--radio-boton); background: #fff; border: 1px solid var(--color-borde); display: flex; align-items: center; justify-content: center; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 10.5px; font-weight: 500; color: var(--tono-exito); text-transform: uppercase; }
|
||||
.archivo__textos { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
||||
.archivo__nombre { font-family: var(--fuente-mono); font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.archivo__nombre { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.archivo__meta { font-size: 12.5px; color: var(--color-texto-suave); }
|
||||
/* Franja de filtros bajo el encabezado de una tarjeta */
|
||||
.filtros { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 14px; padding: 16px 24px 18px; background: var(--color-sutil); border-bottom: 1px solid var(--color-borde); align-items: end; }
|
||||
@@ -711,9 +708,9 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.cumplimiento__titulo { font-size: 14.5px; font-weight: 600; }
|
||||
.cumplimiento__detalle { font-size: 14px; line-height: 1.45; color: var(--color-texto-tenue); text-wrap: pretty; min-width: 0; }
|
||||
.cumplimiento__renglon.es-vencido .cumplimiento__titulo, .cumplimiento__renglon.es-vencido .cumplimiento__detalle { color: var(--tono-peligro); }
|
||||
.cumplimiento__renglon .badge { font-family: var(--fuente-mono); font-size: 12px; }
|
||||
.cumplimiento__renglon .badge { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; }
|
||||
.cumplimiento__renglon.es-cero .cumplimiento__detalle { color: var(--color-texto-suave); }
|
||||
.cumplimiento__renglon .cumplimiento__detalle a[data-cifra] { font-family: var(--fuente-mono); font-weight: 600; }
|
||||
.cumplimiento__renglon .cumplimiento__detalle a[data-cifra] { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-weight: 600; }
|
||||
.cumplimiento__alertas { padding: 0 24px 14px; overflow-x: auto; }
|
||||
.cumplimiento__alertas tr.es-vencida td { color: var(--tono-peligro); }
|
||||
[data-momento="vigente"] { --punto: #3F8A7C; }
|
||||
@@ -729,7 +726,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.recorrido__arriba, .recorrido__abajo { display: flex; justify-content: space-between; gap: 12px; }
|
||||
.recorrido__arriba { align-items: center; }
|
||||
.recorrido__abajo { align-items: flex-end; }
|
||||
.recorrido__numero { font-family: var(--fuente-mono); font-size: 12px; color: var(--color-texto-suave); }
|
||||
.recorrido__numero { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-texto-suave); }
|
||||
.recorrido__titulo { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
|
||||
.recorrido__estado { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; font-weight: 500; color: var(--color-verde-fuerte); }
|
||||
.recorrido__estado::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-verde); }
|
||||
@@ -740,7 +737,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
-webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 18px -10px rgba(63, 138, 124, 0.8);
|
||||
color: #fff; display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.indicador { display: inline-flex; align-items: center; gap: 8px; font-family: var(--fuente-mono); font-size: 12px; color: var(--color-verde-fuerte); white-space: nowrap; }
|
||||
.indicador { display: inline-flex; align-items: center; gap: 8px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-verde-fuerte); white-space: nowrap; }
|
||||
.indicador::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--punto, var(--color-verde)); }
|
||||
.indicador--gris { height: 28px; padding: 0 12px; border-radius: var(--radio-pildora); background: var(--color-fondo); font-family: var(--fuente); font-size: 12.5px; color: var(--color-texto-suave); }
|
||||
|
||||
@@ -754,7 +751,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.seccion-numerada .formulario__rejilla { padding: 22px 24px 24px; }
|
||||
.anillo {
|
||||
width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1.5px solid var(--color-borde-fuerte); background: #fff; color: var(--color-texto);
|
||||
font-family: var(--fuente-mono); font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
|
||||
font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.anillo .icono { display: none; width: 14px; height: 14px; }
|
||||
.anillo--chico { width: 22px; height: 22px; font-size: 11px; }
|
||||
@@ -767,7 +764,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.indice a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--color-texto); text-decoration: none; }
|
||||
.indice a:hover { background: var(--color-sutil); color: var(--color-texto); text-decoration: none; }
|
||||
.indice__titulo { flex: 1; font-size: 14px; line-height: 1.3; }
|
||||
.indice__cuenta { font-family: var(--fuente-mono); font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.indice__cuenta { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
[data-estado-seccion="completa"] .indice__cuenta { color: var(--tono-exito); }
|
||||
[data-estado-seccion="error"] .indice__cuenta { color: var(--tono-peligro); }
|
||||
.avance { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 16px; border-bottom: 1px solid var(--color-borde-suave); }
|
||||
@@ -780,8 +777,8 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.lista-verificacion .icono { width: 15px; height: 15px; margin-top: 2px; color: var(--color-verde-texto); }
|
||||
.personas { display: flex; flex-direction: column; gap: 10px; padding: 20px 24px 24px; }
|
||||
.personas__fila { display: grid; grid-template-columns: 28px minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr) 40px; gap: 10px; align-items: center; }
|
||||
.personas__fila--titulos { font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.personas__n { width: 28px; height: 28px; border-radius: var(--radio-xs); background: var(--color-fondo); font-family: var(--fuente-mono); font-size: 12px; color: var(--color-texto-suave); display: flex; align-items: center; justify-content: center; }
|
||||
.personas__fila--titulos { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.personas__n { width: 28px; height: 28px; border-radius: var(--radio-xs); background: var(--color-fondo); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--color-texto-suave); display: flex; align-items: center; justify-content: center; }
|
||||
.personas__quitar { width: 40px; height: 40px; border-radius: var(--radio-boton); border: 1px solid transparent; background: transparent; color: var(--color-texto-suave); font-size: 20px; line-height: 1; }
|
||||
.personas__quitar:hover { background: var(--color-sutil); border-color: var(--color-borde); }
|
||||
.personas__quitar:disabled { opacity: 0.3; cursor: default; }
|
||||
@@ -795,10 +792,10 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.requisito.es-completo .requisito__marca { border: 0; background: var(--color-verde); }
|
||||
.requisito__texto { flex: 1; font-size: 14px; line-height: 1.4; text-wrap: pretty; }
|
||||
.listas { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding: 18px 24px 6px; }
|
||||
.listas__item { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px; background: var(--color-sutil); border: 1px solid var(--color-borde-suave); font-family: var(--fuente-mono); font-size: 12.5px; font-weight: 500; }
|
||||
.listas__item { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px; background: var(--color-sutil); border: 1px solid var(--color-borde-suave); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 500; }
|
||||
.listas__item .icono { width: 14px; height: 14px; color: var(--color-verde-texto); }
|
||||
.listas__item.es-coincidencia { background: var(--tono-peligro-fondo); border-color: var(--tono-peligro-borde); color: var(--tono-peligro); }
|
||||
.score-grande { font-family: var(--fuente-mono); font-size: 30px; font-weight: 500; line-height: 1; }
|
||||
.score-grande { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 500; line-height: 1; }
|
||||
.acordeon > summary { list-style: none; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--color-borde-suave); cursor: pointer; }
|
||||
.acordeon > summary::-webkit-details-marker { display: none; }
|
||||
.acordeon > summary:hover { background: var(--color-sutil); }
|
||||
@@ -821,7 +818,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.grupo-opciones > legend { padding: 0; margin-bottom: 8px; }
|
||||
/* Perfil declarado contra observado (operaciones/_perfil.html: ficha y detalle de crédito) */
|
||||
.celda-criterio { padding-left: 28px !important; line-height: 1.45; text-wrap: pretty; }
|
||||
.regla-ref { margin-left: 6px; font-family: var(--fuente-mono); font-size: 11.5px; color: var(--tono-exito); white-space: nowrap; }
|
||||
.regla-ref { margin-left: 6px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--tono-exito); white-space: nowrap; }
|
||||
.sub-linea { margin-top: 3px; }
|
||||
|
||||
/* Beneficiario controlador: grafo (static/beneficiario.js lo dibuja en svg#grafo) */
|
||||
@@ -838,7 +835,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.linea-tiempo__evento { position: relative; display: flex; flex-direction: column; gap: 6px; margin-left: 5px; padding: 12px 0 14px 24px; border-left: 2px solid var(--color-borde-suave); }
|
||||
.linea-tiempo__evento:last-child { border-left-color: transparent; }
|
||||
.linea-tiempo__evento::before { content: ""; position: absolute; left: -8px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--punto, var(--color-texto-tenue)); }
|
||||
.linea-tiempo__fecha { font-family: var(--fuente-mono); font-size: 12.5px; font-weight: 500; color: var(--color-texto); }
|
||||
.linea-tiempo__fecha { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 500; color: var(--color-texto); }
|
||||
.linea-tiempo__evento[data-tipo="apertura"] { --punto: var(--color-marino); }
|
||||
.linea-tiempo__evento[data-tipo="nota"], .linea-tiempo__evento[data-tipo="documento"] { --punto: var(--color-verde); }
|
||||
.linea-tiempo__evento[data-tipo="cambio_estado"], .linea-tiempo__evento[data-tipo="asignacion"] { --punto: var(--tono-aviso-punto); }
|
||||
@@ -857,10 +854,10 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.nivel:hover { border-color: var(--color-borde-hover); color: var(--color-texto); text-decoration: none; }
|
||||
.nivel.es-activo, .nivel[aria-current="true"] { border-color: var(--color-marino); background: var(--color-sutil); }
|
||||
.nivel__arriba { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
|
||||
.nivel__rango { font-family: var(--fuente-mono); font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.nivel__rango { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--color-texto-suave); }
|
||||
.nivel__cifra { display: flex; align-items: baseline; gap: 8px; }
|
||||
.nivel__cifra strong { font-size: 28px; font-weight: 600; line-height: 1; }
|
||||
.nivel__cifra small { font-family: var(--fuente-mono); font-size: 13px; color: var(--color-texto-suave); }
|
||||
.nivel__cifra small { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--color-texto-suave); }
|
||||
[data-nivel-riesgo="bajo"] { --punto: #3F8A7C; }
|
||||
[data-nivel-riesgo="medio"] { --punto: #B7791F; }
|
||||
[data-nivel-riesgo="alto"] { --punto: #A8321F; }
|
||||
@@ -879,7 +876,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.ventana__base { left: 0; right: 0; background: var(--color-fondo); }
|
||||
.ventana__vigente { left: 0; width: var(--ancho, 0%); background: rgba(17, 29, 46, 0.22); }
|
||||
.ventana__nueva { left: var(--pos, 0%); right: 0; background: var(--color-verde); opacity: 0.85; }
|
||||
.ventana__fecha { position: absolute; top: 0; left: var(--pos, 0%); transform: translateX(-50%); font-family: var(--fuente-mono); font-size: 11px; color: var(--color-texto-suave); white-space: nowrap; }
|
||||
.ventana__fecha { position: absolute; top: 0; left: var(--pos, 0%); transform: translateX(-50%); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--color-texto-suave); white-space: nowrap; }
|
||||
.ventana__fecha--abajo { top: 24px; }
|
||||
.ventana__fecha--inicio { transform: none; }
|
||||
.ventana__fecha--fin { left: auto; right: 0; transform: none; }
|
||||
@@ -891,7 +888,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.leyenda__nueva { --punto: var(--color-verde); }
|
||||
.pasos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 0; padding: 0; list-style: none; }
|
||||
.pasos__item { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px; border-right: 1px solid var(--color-borde-suave); border-bottom: 1px solid var(--color-borde-suave); margin-bottom: -1px; }
|
||||
.pasos__n { width: 26px; height: 26px; border-radius: 50%; background: var(--color-marino); color: #fff; font-family: var(--fuente-mono); font-size: 12px; display: flex; align-items: center; justify-content: center; }
|
||||
.pasos__n { width: 26px; height: 26px; border-radius: 50%; background: var(--color-marino); color: #fff; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 12px; display: flex; align-items: center; justify-content: center; }
|
||||
.pasos__titulo { font-size: 14px; font-weight: 600; }
|
||||
.pasos__texto { font-size: 13.5px; line-height: 1.55; color: var(--color-texto-suave); text-wrap: pretty; }
|
||||
|
||||
@@ -915,10 +912,10 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.lab__lateral { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }
|
||||
.indicadores { min-width: 640px; }
|
||||
.indicadores__fila { display: grid; grid-template-columns: minmax(150px, 1.1fr) 92px minmax(0, 2.4fr); gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--color-borde-suave); align-items: start; }
|
||||
.indicadores__fila--titulos { padding: 11px 24px; background: var(--color-sutil); border-bottom-color: var(--color-borde); font-family: var(--fuente-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.indicadores__fila--titulos { padding: 11px 24px; background: var(--color-sutil); border-bottom-color: var(--color-borde); font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); }
|
||||
.indicadores__nombre { display: flex; flex-direction: column; gap: 3px; padding-top: 8px; min-width: 0; font-size: 14px; line-height: 1.35; text-wrap: pretty; }
|
||||
.indicadores__nombre b { font-family: var(--fuente-mono); font-weight: 500; color: var(--color-verde-texto); }
|
||||
.indicadores__nombre small { font-family: var(--fuente-mono); font-size: 11.5px; color: var(--color-texto-suave); word-break: break-all; }
|
||||
.indicadores__nombre b { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-weight: 500; color: var(--color-verde-texto); }
|
||||
.indicadores__nombre small { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--color-texto-suave); word-break: break-all; }
|
||||
/* Cuántos niveles tiene cada indicador lo decide el modelo, no la hoja (CLAUDE.md). */
|
||||
.indicadores__niveles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
|
||||
.indicadores__nivel { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
||||
@@ -930,7 +927,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.lab input.campo__entrada:invalid { border-color: var(--tono-peligro); background: var(--tono-peligro-fondo); }
|
||||
.lab__mensajes { display: flex; flex-direction: column; gap: 8px; }
|
||||
.lab__mensajes:empty { display: none; }
|
||||
.suma { display: flex; align-items: center; gap: 8px; padding: 14px 24px; font-family: var(--fuente-mono); font-size: 13.5px; color: var(--tono-exito); }
|
||||
.suma { display: flex; align-items: center; gap: 8px; padding: 14px 24px; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--tono-exito); }
|
||||
.suma.es-error { color: var(--tono-peligro); font-weight: 500; }
|
||||
.umbrales { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; padding: 18px 24px 22px; }
|
||||
/* Acotado a .umbrales: screening/listas.html usa dd.umbral con su propio estilo. */
|
||||
@@ -956,12 +953,12 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
|
||||
/* 6. Utilidades (al final para ganar a los componentes) ===================================== */
|
||||
|
||||
.mono { font-family: var(--fuente-mono); }
|
||||
.cifra { font-family: var(--fuente-mono); font-variant-numeric: tabular-nums; }
|
||||
.mono { font-family: var(--fuente); font-variant-numeric: tabular-nums; }
|
||||
.cifra { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-variant-numeric: tabular-nums; }
|
||||
.es-der { text-align: right; }
|
||||
.es-centro { text-align: center; }
|
||||
.sin-salto { white-space: nowrap; }
|
||||
.rotulo { font-family: var(--fuente-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); line-height: 1.4; }
|
||||
.rotulo { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-texto-suave); line-height: 1.4; }
|
||||
.visualmente-oculto { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
||||
.punto { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
|
||||
.separador { width: 3px; height: 3px; border-radius: 50%; background: var(--color-texto-tenue); flex: none; }
|
||||
@@ -1071,7 +1068,7 @@ textarea.campo__entrada--compacta { min-height: 84px; padding: 10px 12px; }
|
||||
.consola__titulo { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
|
||||
.consola__cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; padding: 16px 20px; margin: 0; }
|
||||
.consola__cifras dt { font-size: 12px; color: var(--color-texto-suave); text-transform: uppercase; letter-spacing: 0.06em; }
|
||||
.consola__cifras dd { margin: 4px 0 0; font-family: var(--fuente-mono); font-size: 24px; font-weight: 600; }
|
||||
.consola__cifras dd { margin: 4px 0 0; font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 600; }
|
||||
.acceso__texto { font-size: 14px; color: var(--color-texto-cuerpo); text-align: center; }
|
||||
.consola__filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--color-borde-suave); }
|
||||
.consola__filtros .campo__entrada { height: 36px; width: auto; min-width: 180px; }
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Fuentes self-hosted de collina-pld (sin CDN en tiempo de ejecución).
|
||||
|
||||
Origen: paquetes npm @fontsource/ibm-plex-sans, @fontsource/ibm-plex-mono y @fontsource/manrope,
|
||||
Origen: paquetes npm @fontsource/ibm-plex-sans y @fontsource/manrope,
|
||||
versión 5.3.0, descargados de cdn.jsdelivr.net (solo los .woff2; npm no entra al proyecto).
|
||||
Subconjunto "latin": U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
|
||||
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD.
|
||||
|
||||
IBM Plex Sans 400/500/600 e IBM Plex Mono 400/500: toda la app.
|
||||
IBM Plex Sans 400/500/600: toda la app (donde los números deben alinearse, con
|
||||
font-variant-numeric: tabular-nums; la app no usa fuente monoespaciada).
|
||||
Manrope 600/700/800: solo la pantalla de acceso.
|
||||
Las @font-face viven en app/static/app.css. Licencia: SIL Open Font License 1.1 (LICENCIA-*.txt).
|
||||
@@ -1,93 +0,0 @@
|
||||
Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ThinItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ExtraLight.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ExtraLightItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Light.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-LightItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Regular.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Italic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Medium.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-MediumItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-SemiBold.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-SemiBoldItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Bold.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-BoldItalic.ttf: Copyright 2017 IBM Corp. All rights reserved.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
@@ -84,13 +84,13 @@
|
||||
}
|
||||
|
||||
// Solo lo visual sale de tokens de app.css (--grafica-*, --fuente*): barras con esquinas
|
||||
// superiores de 4 px, rejilla tenue, ejes en mono y leyenda arriba al centro.
|
||||
// superiores de 4 px, rejilla tenue, ejes con cifras tabulares y leyenda arriba al centro.
|
||||
function dibujar(vigente, simulada) {
|
||||
const lienzo = $("#lab-grafica");
|
||||
if (!window.Chart || !lienzo) return;
|
||||
const estilo = getComputedStyle(document.documentElement);
|
||||
const token = (variable) => estilo.getPropertyValue(variable).trim();
|
||||
const ejes = { color: token("--grafica-ejes"), font: { family: token("--fuente-mono"), size: 10.5 } };
|
||||
const ejes = { color: token("--grafica-ejes"), font: { family: token("--fuente"), size: 10.5 } };
|
||||
const barra = { borderRadius: 4, maxBarThickness: 44, categoryPercentage: 0.7, barPercentage: 0.9 };
|
||||
const datos = {
|
||||
labels: ["Bajo", "Medio", "Alto"],
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{{ cifra("Liquidados", p.conteos.liquidado, href="/creditos?status=liquidado") }}
|
||||
</div>
|
||||
|
||||
etiqueta rótulo en mono, arriba
|
||||
etiqueta rótulo en mayúsculas, arriba
|
||||
valor cifra grande (texto o Markup)
|
||||
nota texto chico junto a la cifra
|
||||
pie línea de ayuda debajo (.resumen__nota)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
{% set acciones %}<a class="boton boton--chico" href="…">Ver</a>{% endset %}
|
||||
{% call tarjeta("Créditos", acciones=acciones) %}…{% endcall %}
|
||||
Un {% set %} de bloque es Markup y no se escapa; una cadena normal sí.
|
||||
Igual con `subtitulo` si lleva marcado (cifras en mono, enlaces).
|
||||
Igual con `subtitulo` si lleva marcado (cifras tabulares, enlaces).
|
||||
plano True: el cuerpo sin relleno (tablas, listas y rejillas a sangre).
|
||||
id id de la sección (anclas del índice de la ficha).
|
||||
clase clases extra de la sección (tarjeta--vidrio, tarjeta--alerta, ancla…).
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
{{ badge_nivel_alerta(alerta.nivel) }}{{ badge_estado_alerta(alerta.estado) }}
|
||||
<span class="mono t-13">{{ regla.clave }} {{ regla.version }} · {{ FAMILIAS.get(regla.familia, regla.familia) }}</span>
|
||||
<span class="texto-tenue">·</span><span>vigente desde {{ regla.vigente_desde.strftime("%d/%m/%Y") }}</span>
|
||||
<span class="texto-tenue">·</span><span>plazo: {{ alerta.plazo_aviso or "análisis interno" }}</span>
|
||||
{%- if alerta.vence_el %}<span class="texto-tenue">·</span><span>vence el <span class="mono">{{ alerta.vence_el.strftime("%d/%m/%Y") }}</span></span>{% endif %}
|
||||
<span class="texto-tenue">·</span><span data-plazo>plazo: {{ plazo_de_alerta(alerta) }}</span>
|
||||
{%- if vence_visible(alerta) %}<span class="texto-tenue">·</span><span data-vence>vence el <span class="mono">{{ alerta.vence_el.strftime("%d/%m/%Y") }}</span></span>{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<input class="campo__entrada" type="date" name="desde" value="{{ filtros.desde.isoformat() if filtros.desde else '' }}"></label>
|
||||
<label class="campo"><span class="campo__etiqueta">Hasta</span>
|
||||
<input class="campo__entrada" type="date" name="hasta" value="{{ filtros.hasta.isoformat() if filtros.hasta else '' }}"></label>
|
||||
{%- if filtros.cierre %}<input type="hidden" name="cierre" value="{{ filtros.cierre }}">{% endif %}
|
||||
<div class="filtros__acciones">
|
||||
<button class="boton boton--oscuro" type="submit">Filtrar</button>
|
||||
<a class="boton boton--discreto" href="/auditoria">Limpiar</a>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
</div>
|
||||
|
||||
{% if error %}{{ aviso(error, tono="peligro") }}{% endif %}
|
||||
{% if estado != "terminado" and sin_listas %}<div data-sin-listas>{{ aviso("La empresa no tiene listas cargadas (OFAC, ONU, 69-B, PEP): el screening de esta carga no puede correr. Carga las listas antes de confirmar o corre el screening de la cartera después.", tono="aviso") }}</div>{% endif %}
|
||||
{% if ya_cargado %}{{ aviso("Este archivo ya se había cargado: es el mismo (misma huella SHA-256). No se volvió a procesar.", tono="aviso") }}{% endif %}
|
||||
|
||||
<div class="resumen" aria-label="Resumen del lote">
|
||||
@@ -93,7 +94,7 @@
|
||||
<dl class="datos datos--lista">
|
||||
<div class="datos__par"><dt>Clientes nuevos</dt><dd>{{ datos.get("clientes_nuevos", 0) }}{% if datos.get("clientes_con_version") %} · {{ datos.clientes_con_version }} con versión nueva{% endif %} · <a href="/cartera">cartera</a></dd></div>
|
||||
<div class="datos__par"><dt>Operaciones nuevas</dt><dd>{{ datos.get("pagos_cargados", 0) }} pagos y {{ datos.get("creditos_cargados", 0) }} créditos · <a href="/operaciones?lote={{ lote.id }}">ver operaciones</a></dd></div>
|
||||
<div class="datos__par"><dt>Coincidencias de screening</dt><dd>{{ datos.get("coincidencias_nuevas", 0) }} · <a href="/screening">bandeja de screening</a></dd></div>
|
||||
<div class="datos__par"><dt>Coincidencias de screening</dt><dd>{% if datos.get("screening_sin_listas") %}<span class="texto-peligro" data-sin-listas>Sin screening: la empresa no tenía listas cargadas. Carga las listas y corre el screening de la cartera.</span>{% else %}{{ datos.get("coincidencias_nuevas", 0) }}{% endif %} · <a href="/screening">bandeja de screening</a></dd></div>
|
||||
<div class="datos__par"><dt>Cambios de nivel de riesgo</dt><dd>{{ datos.get("cambios_nivel", []) | length }}{% for c in datos.get("cambios_nivel", [])[:20] %}{% if loop.first %}: {% endif %}<a href="/riesgo/{{ c.cliente_id }}" class="mono">{{ c.id_externo }}</a> ({{ c.antes }} → {{ c.despues }}){% if not loop.last %}, {% endif %}{% endfor %} · <a href="/riesgo">clasificación de riesgo</a></dd></div>
|
||||
<div class="datos__par"><dt>Alertas generadas</dt><dd>{{ datos.get("alertas_nuevas", 0) }}{% for clave, n in datos.get("alertas_por_regla", {}).items() %}{% if loop.first %} ({% endif %}{{ clave }}: {{ n }}{% if not loop.last %}, {% else %}){% endif %}{% endfor %} · <a href="/alertas">bandeja de alertas</a></dd></div>
|
||||
</dl>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<td><span class="mono peso-500">{{ r.clave }}</span> <span class="t-135">{{ r.nombre }}</span> <span class="t-12 mono texto-tenue">{{ r.version }}</span></td>
|
||||
<td>{{ badge_nivel_alerta(a.nivel) }}</td>
|
||||
<td>{{ badge_estado_alerta(a.estado) }}</td>
|
||||
<td class="celda-fecha">{{ a.vence_el.strftime("%d/%m/%Y") if a.vence_el else "—" }}</td>
|
||||
<td class="celda-fecha">{{ vence_visible(a).strftime("%d/%m/%Y") if vence_visible(a) else "—" }}</td>
|
||||
</tr>
|
||||
{%- else %}
|
||||
<tr><td class="tabla__vacio" colspan="5">Sin registros.</td></tr>
|
||||
|
||||
@@ -400,7 +400,7 @@
|
||||
<td><a class="id-enlace" href="/alertas/{{ alerta.id }}">{{ regla.clave }}</a> <span class="t-135">{{ regla.nombre }}</span> <span class="t-12 mono texto-tenue">{{ regla.version }}</span></td>
|
||||
<td>{{ badge_nivel_alerta(alerta.nivel) }}</td>
|
||||
<td>{{ badge_estado_alerta(alerta.estado) }}</td>
|
||||
<td class="celda-fecha">{{ alerta.vence_el.strftime("%d/%m/%Y") if alerta.vence_el else "—" }}</td>
|
||||
<td class="celda-fecha">{{ vence_visible(alerta).strftime("%d/%m/%Y") if vence_visible(alerta) else "—" }}</td>
|
||||
<td class="t-13">{{ alerta.responsable or "—" }}</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
<td><a class="id-enlace" href="/alertas/{{ alerta.id }}">{{ regla.clave }}</a> <span class="t-135">{{ regla.nombre }}</span> <span class="t-12 mono texto-tenue">{{ regla.version }}</span></td>
|
||||
<td>{{ badge_nivel_alerta(alerta.nivel) }}</td>
|
||||
<td>{{ badge_estado_alerta(alerta.estado) }}</td>
|
||||
<td class="celda-fecha">{{ alerta.vence_el.strftime("%d/%m/%Y") if alerta.vence_el else "—" }}</td>
|
||||
<td class="celda-fecha">{{ vence_visible(alerta).strftime("%d/%m/%Y") if vence_visible(alerta) else "—" }}</td>
|
||||
<td class="t-135">{{ alerta.responsable or "—" }}</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
{% block contenido %}
|
||||
{#- URL del listado con los filtros actuales; los cambios se aplican encima y lo vacío se omite. -#}
|
||||
{%- macro url() -%}
|
||||
{%- set parametros = {"q": q, "nivel": nivel, "incompleto": "1" if incompleto else None} %}{% set _ = parametros.update(kwargs) -%}
|
||||
{%- set parametros = {"q": q, "nivel": nivel, "incompleto": "1" if incompleto else None, "documentos": "1" if documentos else None} %}{% set _ = parametros.update(kwargs) -%}
|
||||
{%- set consulta = parametros | dictsort | selectattr(1) | list | urlencode -%}
|
||||
/expediente{{ "?" ~ consulta if consulta }}
|
||||
{%- endmacro %}
|
||||
@@ -36,6 +36,7 @@
|
||||
<form class="formulario gap-8" method="get" action="/expediente">
|
||||
{% if nivel %}<input type="hidden" name="nivel" value="{{ nivel }}">{% endif %}
|
||||
{% if incompleto %}<input type="hidden" name="incompleto" value="1">{% endif %}
|
||||
{% if documentos %}<input type="hidden" name="documentos" value="1">{% endif %}
|
||||
<label class="campo__etiqueta campo__etiqueta--inicio" for="exp-q">Nombre o identificador</label>
|
||||
<div class="fila gap-10">
|
||||
<div class="campo campo--buscar campo--crece">
|
||||
@@ -53,7 +54,7 @@
|
||||
{% endcall %}
|
||||
|
||||
{% set acciones %}{% if paginas > 1 %}<span class="t-12 mono texto-suave">Página {{ pagina }} de {{ paginas }}</span>{% endif %}{% endset %}
|
||||
{% call tarjeta("Clientes", subtitulo="{:,}".format(total) ~ " cliente" ~ ("s" if total != 1 else "") ~ (" con riesgo " ~ nivel | replace("_", " ") if nivel else "") ~ (" con expediente incompleto" if incompleto else ""), acciones=acciones, plano=True) %}
|
||||
{% call tarjeta("Clientes", subtitulo="{:,}".format(total) ~ " cliente" ~ ("s" if total != 1 else "") ~ (" con riesgo " ~ nivel | replace("_", " ") if nivel else "") ~ (" con datos del expediente incompletos" if incompleto else "") ~ (" con documentos pendientes" if documentos else ""), acciones=acciones, plano=True) %}
|
||||
<div class="tabla-contenedor">
|
||||
<table class="tabla ancho-min-720">
|
||||
<thead>
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<tr data-alerta="{{ a.id }}"{% if a.vencida %} class="es-vencida"{% endif %}>
|
||||
<td><a href="/alertas/{{ a.id }}">{{ a.clave }}</a> · {{ a.nombre }}</td>
|
||||
<td>{{ a.cliente }}</td>
|
||||
<td>{{ {"24h": "24 horas", "aviso": "aviso", "inmediato": "inmediato"}.get(a.plazo_aviso, "—") }}</td>
|
||||
<td>{{ a.plazo }}</td>
|
||||
<td class="celda-fecha">{{ a.vence_el.strftime("%d/%m/%Y") if a.vence_el else "—" }}{% if a.vencida %} <span class="badge badge--plano badge--peligro">vencida</span>{% endif %}</td>
|
||||
<td>{{ a.antiguedad_dias }} día{{ "s" if a.antiguedad_dias != 1 }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
.comparacion__lado { border: 1px solid var(--color-borde); border-radius: var(--radio); padding: var(--espacio-4); }
|
||||
.comparacion__lado h3 { margin: 0 0 var(--espacio-2); font-size: var(--texto-sm); color: var(--color-texto-suave); text-transform: uppercase; letter-spacing: 0.04em; }
|
||||
.comparacion__nombre { font-size: var(--texto-lg); font-weight: 700; }
|
||||
.comparacion__norm { font-family: var(--fuente-mono); font-size: var(--texto-sm); color: var(--color-texto-suave); }
|
||||
.comparacion__norm { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: var(--texto-sm); color: var(--color-texto-suave); }
|
||||
.score { font-size: var(--texto-xl); font-weight: 700; }
|
||||
.texto-suave { color: var(--color-texto-suave); }
|
||||
.historial { margin: 0; padding-left: var(--espacio-4); font-size: var(--texto-sm); }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
.version { border: 1px solid var(--color-borde); border-radius: var(--radio); padding: var(--espacio-4); }
|
||||
.version.es-vigente { border-color: var(--color-primario); }
|
||||
.version h3 { margin: 0 0 var(--espacio-2); }
|
||||
.version__hash { font-family: var(--fuente-mono); font-size: var(--texto-xs); color: var(--color-texto-suave); word-break: break-all; }
|
||||
.version__hash { font-family: var(--fuente); font-variant-numeric: tabular-nums; font-size: var(--texto-xs); color: var(--color-texto-suave); word-break: break-all; }
|
||||
.umbral { font-size: var(--texto-lg); font-weight: 700; }
|
||||
.texto-suave { color: var(--color-texto-suave); }
|
||||
</style>
|
||||
|
||||
+5
-1
@@ -185,7 +185,11 @@ EOF
|
||||
|
||||
(La imagen trae `sqlite3` desde el fix de la migración 0013; los comandos en Python funcionan en cualquier imagen.)
|
||||
|
||||
Los seis primeros conteos deben ser 0; usuarios y modelos, los de antes. Las listas públicas también se conservan (el caso sembrado DEMO-06, la coincidencia con el artículo 69-B, depende de ellas; si la instalación no las tiene, `python -m app.importers.lists --todas`).
|
||||
Los seis primeros conteos deben ser 0; usuarios y modelos, los de antes. Las listas públicas también se conservan (el caso sembrado DEMO-06, la coincidencia con el artículo 69-B, depende de ellas). El vaciado no las crea: **antes de cargar, comprueba que la empresa tenga listas** (*Screening* no debe decir «Sin listas»); si no las tiene, `python -m app.importers.lists --todas`. Una carga sin listas termina con el aviso «Sin screening: la empresa no tenía listas cargadas» en la página del lote; se corrige sin recargar, con las listas ya cargadas:
|
||||
|
||||
```bash
|
||||
python -m app.services.screening --cartera # no duplica coincidencias; DEMO-06 queda pendiente en 69-B
|
||||
```
|
||||
|
||||
```bash
|
||||
# 4. Archivos de la demo (en local, desde la raíz del repositorio; carga_demo/ no se versiona).
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
"""Correcciones tras la carga de la demo (fix/demo-carga), con una cartera ficticia que entra por la
|
||||
carga como la de cualquier empresa: tres clientes, uno con dos mensualidades pagadas por un tercero
|
||||
y otro con su A-01 ya reportada en la hoja de avisos.
|
||||
|
||||
1. «Información al» es la fecha de corte de la empresa, no el último movimiento.
|
||||
2. El pagador tercero que da de alta la carga no es cartera: no entra a la cartera ni a los
|
||||
conteos de Inicio (sí al screening).
|
||||
3. El expediente incompleto se mide por datos; los documentos pendientes van aparte.
|
||||
4. La carga avisa si la empresa no tiene listas; el screening de la cartera corre después.
|
||||
5. La D-01 de una carga se muestra como revisión de 30 días; una alerta cerrada no muestra
|
||||
vencimiento; Evidencia cuenta aparte las alertas que cerró la carga.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import sqlalchemy as sa
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.models import Cliente, Credito, Tenant, Transaccion
|
||||
from app.models.usuario import Rol
|
||||
from app.services import alertas as servicio_alertas
|
||||
from app.services import expediente as servicio_expediente
|
||||
from app.services import inicio as servicio_inicio
|
||||
from app.services import riesgo as servicio_riesgo
|
||||
from app.services import screening as servicio_screening
|
||||
from app.services.clientes import de_la_cartera
|
||||
from app.services.tenant import fijar_fecha_corte
|
||||
from scripts import generar_carga_prueba as gen
|
||||
from tests import test_avisos_historicos as base
|
||||
from tests.test_avisos_historicos import (
|
||||
CORTE,
|
||||
HOJA_AVISOS,
|
||||
USUARIO,
|
||||
_alerta_a01,
|
||||
_archivo,
|
||||
_cargar,
|
||||
)
|
||||
from tests.test_plataforma import entrar_empresa
|
||||
|
||||
fabrica = base.fabrica
|
||||
cliente = base.cliente
|
||||
|
||||
HOY = date(2026, 9, 10) # el aviso de agosto: el mes del corte
|
||||
|
||||
|
||||
def _cartera() -> tuple[gen.Cartera, dict[str, gen.Credito]]:
|
||||
g = gen.Generador(gen.Parametros(13, CORTE, 3, 3, 36, (70, 25, 5)))
|
||||
clientes, creditos = [], {}
|
||||
for clave, disposicion in (
|
||||
("A", date(2025, 10, 10)),
|
||||
("B", date(2026, 3, 5)),
|
||||
("C", date(2026, 8, 12)),
|
||||
):
|
||||
c = g.nuevo_cliente("bajo", moral=False, hoy=CORTE)
|
||||
cr = g.nuevo_credito(c, monto=Decimal(300000), plazo=36, disposicion=disposicion)
|
||||
g.pagar(c, cr)
|
||||
clientes.append(c)
|
||||
creditos[clave] = cr
|
||||
# Las dos últimas mensualidades de B las paga un tercero (como DEMO-03).
|
||||
for pago in [p for p in creditos["B"].pagos if p.tipo == "PAGO"][-2:]:
|
||||
pago.pagador, pago.pagador_nombre, pago.pagador_rfc = (
|
||||
"TERCERO",
|
||||
"Rogelio Fuentes Barrera",
|
||||
"FUBR800315AB1",
|
||||
)
|
||||
return gen.Cartera(clientes, list(creditos.values()), [], CORTE), creditos
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cargada(fabrica, tmp_path: Path):
|
||||
cartera, creditos = _cartera()
|
||||
hojas = {**gen._filas(cartera), "avisos": HOJA_AVISOS(creditos["A"])}
|
||||
with fabrica() as sesion:
|
||||
tenant = sesion.scalar(sa.select(Tenant).where(Tenant.clave == "demo"))
|
||||
fijar_fecha_corte(sesion, tenant, CORTE, usuario=USUARIO, motivo="corte de la prueba")
|
||||
sesion.commit()
|
||||
lote = _cargar(sesion, tenant.id, _archivo(tmp_path, hojas))
|
||||
assert lote.filas["terceros_pagadores"] == 1
|
||||
return fabrica, creditos, lote.id
|
||||
|
||||
|
||||
def _tenant(sesion) -> Tenant:
|
||||
return sesion.scalar(sa.select(Tenant).where(Tenant.clave == "demo"))
|
||||
|
||||
|
||||
def _tercero(sesion) -> Cliente:
|
||||
con_credito = sa.select(Credito.cliente_id)
|
||||
return sesion.scalars(sa.select(Cliente).where(Cliente.id.not_in(con_credito))).one()
|
||||
|
||||
|
||||
def _pagina(c: TestClient, ruta: str) -> str:
|
||||
r = c.get(ruta)
|
||||
assert r.status_code == 200, (ruta, r.status_code)
|
||||
return r.text
|
||||
|
||||
|
||||
# --- 1. Información al corte ---------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_informacion_al_es_la_fecha_de_corte_y_no_el_ultimo_movimiento(fabrica, cargada) -> None:
|
||||
with fabrica() as sesion:
|
||||
tenant = _tenant(sesion)
|
||||
ultimo = sesion.scalar(sa.select(sa.func.max(Transaccion.fecha_pago)))
|
||||
assert ultimo < CORTE # ningún pago el último día del mes, como en una cartera real
|
||||
assert servicio_inicio.informacion_al(sesion, tenant) == CORTE
|
||||
info = servicio_inicio.estado_del_mes(sesion, tenant, HOY).informacion
|
||||
assert info.al == CORTE and info.advertencia is None
|
||||
# Un mes después sin cierre de periodo, el aviso de septiembre sí advierte.
|
||||
info = servicio_inicio.estado_del_mes(sesion, tenant, date(2026, 10, 5)).informacion
|
||||
assert "la información llega al 31/08/2026" in info.advertencia
|
||||
|
||||
|
||||
def test_sin_movimientos_no_hay_fecha_de_informacion(fabrica) -> None:
|
||||
with fabrica() as sesion:
|
||||
assert servicio_inicio.informacion_al(sesion, _tenant(sesion)) is None
|
||||
|
||||
|
||||
# --- 2. El tercero no es cartera -----------------------------------------------------------------
|
||||
|
||||
|
||||
def test_el_pagador_tercero_no_entra_a_la_cartera_ni_a_inicio(
|
||||
fabrica, cargada, cliente: TestClient
|
||||
) -> None:
|
||||
with fabrica() as sesion:
|
||||
tenant = _tenant(sesion)
|
||||
tercero = _tercero(sesion)
|
||||
assert tercero.id_externo.startswith("ALTA-")
|
||||
assert sesion.scalar(sa.select(sa.func.count(Cliente.id))) == 4
|
||||
cartera = set(sesion.scalars(sa.select(Cliente.id).where(de_la_cartera())))
|
||||
assert len(cartera) == 3 and tercero.id not in cartera
|
||||
assert tercero.id not in servicio_riesgo.sin_clasificacion_vigente(sesion, tenant)
|
||||
assert tercero.id not in servicio_expediente.con_documentos_pendientes(sesion, tenant)
|
||||
# Sí pasa por el screening: es un nombre que hay que consultar.
|
||||
resumen = servicio_screening.screening_cartera(sesion, usuario=USUARIO)
|
||||
assert resumen.consultados == 4
|
||||
sesion.rollback()
|
||||
entrar_empresa(cliente, Rol.OFICIAL)
|
||||
assert "3 clientes ·" in _pagina(cliente, "/cartera")
|
||||
assert 'data-total-lista="0"' in _pagina(cliente, "/riesgo?pendientes=1")
|
||||
|
||||
|
||||
def test_un_alta_sin_credito_que_no_es_tercero_sigue_en_la_cartera(fabrica, cargada) -> None:
|
||||
from app.services import clientes as servicio_clientes
|
||||
|
||||
with fabrica() as sesion:
|
||||
alta = servicio_clientes.alta_cliente(
|
||||
sesion,
|
||||
_tenant(sesion),
|
||||
servicio_clientes.DatosAlta(
|
||||
"fisica", {"nombre": "Lucía", "apellido_paterno": "Prado", "rfc": "PALU900101AB2"}
|
||||
),
|
||||
USUARIO,
|
||||
servicio_clientes.ORIGEN_INTERFAZ,
|
||||
procesar=False,
|
||||
)
|
||||
cartera = set(sesion.scalars(sa.select(Cliente.id).where(de_la_cartera())))
|
||||
assert alta.cliente.id in cartera
|
||||
sesion.rollback()
|
||||
|
||||
|
||||
# --- 3. Expediente: datos y documentos por separado -------------------------------------------
|
||||
|
||||
|
||||
def test_el_expediente_se_mide_por_datos_y_los_documentos_van_aparte(
|
||||
fabrica, cargada, cliente: TestClient
|
||||
) -> None:
|
||||
with fabrica() as sesion:
|
||||
tenant = _tenant(sesion)
|
||||
# La carga trae identificación y declaración: los datos están completos.
|
||||
assert servicio_expediente.expedientes_incompletos(sesion, tenant) == set()
|
||||
# Sin documentos: los tres clientes de la cartera (el tercero no) los tienen pendientes.
|
||||
pendientes = servicio_expediente.con_documentos_pendientes(sesion, tenant)
|
||||
assert len(pendientes) == 3
|
||||
renglones = {r.clave: r for r in servicio_inicio.pendientes(sesion, tenant).renglones}
|
||||
assert renglones["expediente_incompleto"].cifra == 0
|
||||
assert renglones["documentos_pendientes"].cifra == 3
|
||||
assert renglones["documentos_pendientes"].enlace == "/expediente?documentos=1"
|
||||
entrar_empresa(cliente, Rol.OFICIAL)
|
||||
assert "3 clientes con documentos pendientes" in _pagina(cliente, "/expediente?documentos=1")
|
||||
assert "0 clientes con datos del expediente incompletos" in _pagina(
|
||||
cliente, "/expediente?incompleto=1"
|
||||
)
|
||||
|
||||
|
||||
# --- 4. Sin listas: la carga avisa ----------------------------------------------------------------
|
||||
|
||||
|
||||
def test_la_carga_sin_listas_avisa_y_el_screening_corre_despues(
|
||||
fabrica, tmp_path: Path, cliente: TestClient, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
cartera, _ = _cartera()
|
||||
real = servicio_screening.listas_vigentes
|
||||
monkeypatch.setattr(servicio_screening, "listas_vigentes", lambda s, t: {})
|
||||
with fabrica() as sesion:
|
||||
tenant = _tenant(sesion)
|
||||
fijar_fecha_corte(sesion, tenant, CORTE, usuario=USUARIO, motivo="corte de la prueba")
|
||||
sesion.commit()
|
||||
lote = _cargar(sesion, tenant.id, _archivo(tmp_path, gen._filas(cartera)))
|
||||
assert lote.filas["screening_sin_listas"] is True
|
||||
assert lote.filas["coincidencias_nuevas"] == 0
|
||||
lote_id = lote.id
|
||||
entrar_empresa(cliente, Rol.OFICIAL)
|
||||
texto = _pagina(cliente, f"/carga/lotes/{lote_id}")
|
||||
assert "data-sin-listas" in texto and "no tenía listas cargadas" in texto
|
||||
# Con las listas cargadas, el comando de la operación corre el screening de toda la cartera.
|
||||
monkeypatch.setattr(servicio_screening, "listas_vigentes", real)
|
||||
assert servicio_screening.main(["--cartera"]) == 0
|
||||
assert (
|
||||
"data-sin-listas"
|
||||
not in _pagina(cliente, f"/carga/lotes/{lote_id}").split("Resumen del lote")[0]
|
||||
)
|
||||
|
||||
|
||||
def test_la_carga_con_listas_no_avisa(fabrica, cargada) -> None:
|
||||
fabrica_, _, lote_id = cargada
|
||||
with fabrica_() as sesion:
|
||||
from app.models import LoteCarga
|
||||
|
||||
assert sesion.get(LoteCarga, lote_id).filas["screening_sin_listas"] is False
|
||||
|
||||
|
||||
# --- 5. Plazo, vencimiento de las cerradas y Evidencia ------------------------------------------
|
||||
|
||||
|
||||
def test_la_d01_de_una_carga_se_muestra_como_revision_de_30_dias() -> None:
|
||||
revision = {"plazo_desde_motivo": servicio_alertas.PLAZO_REVISION_CARGA}
|
||||
assert servicio_alertas.etiqueta_plazo("inmediato", revision) == "revisión 30 días"
|
||||
assert servicio_alertas.etiqueta_plazo("inmediato", {}) == "inmediato"
|
||||
assert servicio_alertas.etiqueta_plazo("24h", None) == "24 horas"
|
||||
assert servicio_alertas.etiqueta_plazo(None, None) == "análisis interno"
|
||||
|
||||
|
||||
def test_una_alerta_cerrada_no_muestra_vencimiento(fabrica, cargada, cliente: TestClient) -> None:
|
||||
fabrica_, creditos, _ = cargada
|
||||
with fabrica_() as sesion:
|
||||
a = _alerta_a01(sesion, creditos["A"].id_credito) # reportada en la hoja de avisos
|
||||
c = _alerta_a01(sesion, creditos["C"].id_credito) # abierta
|
||||
assert a.estado == "cerrada" and a.vence_el is not None
|
||||
assert servicio_alertas.vence_visible(a) is None
|
||||
assert servicio_alertas.vence_visible(c) == c.vence_el
|
||||
ids = a.id, c.id
|
||||
entrar_empresa(cliente, Rol.OFICIAL)
|
||||
cerrada, abierta = (_pagina(cliente, f"/alertas/{i}") for i in ids)
|
||||
assert "data-vence" not in cerrada
|
||||
assert "data-vence" in abierta
|
||||
# En la bandeja de cerradas (solo la A-01 reportada) no hay vencimiento.
|
||||
bandeja = _pagina(cliente, "/alertas?estado=cerrada")
|
||||
assert f"/alertas/{ids[0]}" in bandeja and "vence__rel" not in bandeja
|
||||
|
||||
|
||||
def test_evidencia_cuenta_aparte_las_alertas_que_cerro_la_carga(fabrica, cargada) -> None:
|
||||
fabrica_, creditos, _ = cargada
|
||||
with fabrica_() as sesion:
|
||||
tenant = _tenant(sesion)
|
||||
c = _alerta_a01(sesion, creditos["C"].id_credito)
|
||||
servicio_alertas.cambiar_estado(
|
||||
sesion, c.id, "cerrada", usuario="oficial", motivo="Sin inusualidad", rol="oficial"
|
||||
)
|
||||
sesion.commit()
|
||||
mes = {i.clave: i for i in servicio_inicio.evidencia(sesion, tenant).mes}
|
||||
assert mes["alertas_dictaminadas"].cifra == 1
|
||||
assert mes["alertas_cerradas_por_carga"].cifra == 1
|
||||
assert "cierre=dictamen" in mes["alertas_dictaminadas"].enlace
|
||||
assert "cierre=carga" in mes["alertas_cerradas_por_carga"].enlace
|
||||
@@ -335,7 +335,7 @@ def _total_de_la_lista(c: TestClient, ruta: str) -> int:
|
||||
r"(\d[\d,]*) alertas · página", # /alertas
|
||||
r"(\d[\d,]*) en total · página", # /screening
|
||||
r'data-total-lista="(\d+)"', # /riesgo
|
||||
r"(\d[\d,]*) clientes? con expediente incompleto", # /expediente
|
||||
r"(\d[\d,]*) clientes? con (?:datos del expediente incompletos|documentos pendientes)",
|
||||
r"(\d[\d,]*) filas?\b", # /auditoria
|
||||
):
|
||||
if m := re.search(patron, texto):
|
||||
@@ -383,7 +383,8 @@ def test_cada_numero_de_inicio_coincide_con_la_lista_a_la_que_lleva(
|
||||
cifras = _cifras(pagina(cliente, "/inicio"))
|
||||
esperadas = {
|
||||
"coincidencias", "alertas_24h", "alertas_otras", "sin_clasificacion",
|
||||
"expediente_incompleto", "alertas_dictaminadas", "clientes_clasificados",
|
||||
"expediente_incompleto", "documentos_pendientes", "alertas_dictaminadas",
|
||||
"alertas_cerradas_por_carga", "clientes_clasificados",
|
||||
} # fmt: skip
|
||||
assert esperadas <= set(cifras), esperadas - set(cifras)
|
||||
for clave, (numero, enlace) in cifras.items():
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
"""Correr una migración no apaga los loggers de la aplicación (backlog O13).
|
||||
|
||||
`alembic/env.py` configura el logging con `alembic.ini`; con `disable_existing_loggers=True` (el
|
||||
valor por omisión de `fileConfig`) deshabilitaba `app.services.alertas`, y la prueba que lee su
|
||||
advertencia fallaba si corría después de una prueba de migración.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
from alembic import command
|
||||
from alembic.config import Config
|
||||
|
||||
RAIZ = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_una_migracion_no_deshabilita_los_loggers_de_la_app(tmp_path: Path) -> None:
|
||||
logger = logging.getLogger("app.services.alertas")
|
||||
assert not logger.disabled
|
||||
cfg = Config(str(RAIZ / "alembic.ini"))
|
||||
cfg.set_main_option("script_location", str(RAIZ / "alembic"))
|
||||
cfg.set_main_option("sqlalchemy.url", f"sqlite:///{tmp_path / 'logging.db'}")
|
||||
command.upgrade(cfg, "0001")
|
||||
assert not logger.disabled
|
||||
Reference in new issue
Block a user