"""Integration configuration and action routes. Moved from app.admin_dashboard in v4.7.2. The handlers still reuse legacy helpers to keep this refactor behavior-preserving. """ from fastapi import APIRouter import app.admin_dashboard as legacy from app.admin_dashboard import * # noqa: F401,F403 router = APIRouter() @router.get("/integrations", response_class=HTMLResponse) @router.get("/integracoes", response_class=HTMLResponse) async def integrations_page(): odoo_stats = {} odoo_last_sync = "—" odoo_error = "" try: snapshot = get_odoo_product_snapshot(limit=1) odoo_stats = snapshot.get("stats") or {} odoo_last_sync = odoo_stats.get("last_synced_at") or "—" except Exception as exc: odoo_error = str(exc) def badge(enabled: bool) -> str: if enabled: return 'Ativo' return 'Inativo' odoo_enabled = bool(getattr(settings, "odoo_enabled", False)) jasmin_enabled = bool(getattr(settings, "jasmin_enabled", False)) packlink_enabled = bool(getattr(settings, "packlink_enabled", False)) chatwoot_enabled = bool(getattr(settings, "chatwoot_base_url", "")) odoo_error_html = "" if odoo_error: odoo_error_html = f"""
Ligações externas usadas pelo cockpit operacional.
O ClientFlow não replica Odoo, Jasmin ou Packlink. Apenas consulta e guarda o estado necessário para decidir a próxima ação com o cliente.