diff --git a/app/static/estilo.css b/app/static/estilo.css index 6fa014b..dc37a7d 100644 --- a/app/static/estilo.css +++ b/app/static/estilo.css @@ -242,6 +242,10 @@ a.botao:hover { border-color: var(--cor-acento); color: var(--cor-acento); } .paginacao-atual { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 6px; background: var(--cor-acento); color: var(--cor-acento-texto); font-weight: 600; } .paginacao-reticencias { padding: 0 4px; color: var(--cor-texto-secundario); } +.chave-feedback { margin-left: 6px; font-size: 0.85rem; color: var(--cor-sucesso); } +.chave-feedback-erro { color: var(--cor-perigo); } +.botao-gerar-chave { margin-left: 6px; } + @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } } diff --git a/app/templates/clientes_lista.html b/app/templates/clientes_lista.html index d7e9b98..b8d83dc 100644 --- a/app/templates/clientes_lista.html +++ b/app/templates/clientes_lista.html @@ -39,7 +39,11 @@ {{ c.RAZAO }} {{ c.FANTASIA }} {{ c.CNPJ }} - Abrir + + Abrir + + + {% endfor %} @@ -80,4 +84,68 @@ {% endif %} + + {% endblock %} diff --git a/tests/test_router_clientes.py b/tests/test_router_clientes.py index ab72093..1a5477a 100644 --- a/tests/test_router_clientes.py +++ b/tests/test_router_clientes.py @@ -187,6 +187,23 @@ def test_listar_clientes_inclui_csrf_token_no_contexto(monkeypatch): assert 'const CSRF_TOKEN = "";' in resposta.text +def test_listar_clientes_tem_botao_de_gerar_chave_por_linha(monkeypatch): + monkeypatch.setattr( + router_clientes.db_clientes, + "listar_clientes", + lambda busca=None, limite=100, offset=0, ordenar_por="razao", direcao="asc": [ + {"ID": 1, "CODIGO": "000042", "RAZAO": "Cliente Um", "FANTASIA": "Um", "CNPJ": "11222333000181"} + ], + ) + monkeypatch.setattr(router_clientes.db_clientes, "contar_clientes", lambda busca=None, ordenar_por="razao": 1) + + resposta = client.get("/clientes") + assert resposta.status_code == 200 + assert 'data-codigo="000042"' in resposta.text + assert "gerarChaveReativacao(this)" in resposta.text + assert "/gerador-chave/gerar" in resposta.text + + def test_listar_clientes_pagina_com_controles_de_paginacao(monkeypatch): monkeypatch.setattr( router_clientes.db_clientes,