feat: redesign da tela de log (badges de status)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Gustavo
2026-08-14 00:38:01 -03:00
co-authored by Claude Sonnet 5
parent 9cef2c8d17
commit b5098a3aed
+41 -36
View File
@@ -3,53 +3,58 @@
{% block titulo %}Log{% endblock %}
{% block conteudo %}
<h1>Log</h1>
<p><a class="botao" href="/clientes">&larr; Clientes</a></p>
<h2>Ações no painel</h2>
{% if acoes %}
<table>
<tr><th>Quando</th><th>Usuário</th><th>Ação</th><th>Entidade</th><th>Status</th><th>Detalhe</th></tr>
{% for a in acoes %}
<tr>
<td>{{ a.CRIADO_EM }}</td>
<td>{{ a.USUARIO }}</td>
<td>{{ a.ACAO }}</td>
<td>{{ a.ENTIDADE }}{% if a.ENTIDADE_ID %} #{{ a.ENTIDADE_ID }}{% endif %}</td>
<td>{{ "OK" if a.SUCESSO else "ERRO" }}</td>
<td>{{ a.DETALHE or "" }}</td>
</tr>
{% endfor %}
</table>
<div class="tabela-wrap">
<table>
<tr><th>Quando</th><th>Usuário</th><th>Ação</th><th>Entidade</th><th>Status</th><th>Detalhe</th></tr>
{% for a in acoes %}
<tr>
<td>{{ a.CRIADO_EM }}</td>
<td>{{ a.USUARIO }}</td>
<td>{{ a.ACAO }}</td>
<td>{{ a.ENTIDADE }}{% if a.ENTIDADE_ID %} #{{ a.ENTIDADE_ID }}{% endif %}</td>
<td><span class="badge {{ 'badge-sucesso' if a.SUCESSO else 'badge-neutro' }}">{{ "OK" if a.SUCESSO else "ERRO" }}</span></td>
<td>{{ a.DETALHE or "" }}</td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
<p>Nenhuma ação registrada ainda.</p>
{% endif %}
<h2>Envios automáticos de chave (n8n)</h2>
{% if not envios_configurado %}
<p>
Integração com o n8n não configurada — defina <code>N8N_API_URL</code> e
<code>N8N_API_KEY</code> no ambiente (ver <code>.env.example</code>) para ver
aqui os envios automáticos de chave feitos pelo workflow do n8n.
</p>
<div class="cartao">
<p>
Integração com o n8n não configurada — defina <code>N8N_API_URL</code> e
<code>N8N_API_KEY</code> no ambiente (ver <code>.env.example</code>) para ver
aqui os envios automáticos de chave feitos pelo workflow do n8n.
</p>
</div>
{% elif not envios %}
<p>Nenhum envio encontrado (ou não foi possível consultar o n8n agora).</p>
{% else %}
<table>
<tr>
<th>Data</th><th>Cliente</th><th>Código</th><th>Competência</th><th>Status</th>
<th>Telefones enviados</th><th>Telefones com erro</th>
</tr>
{% for e in envios %}
<tr>
<td>{{ e.data_processamento }}</td>
<td>{{ e.nome_cliente }}</td>
<td>{{ e.codigo_cliente }}</td>
<td>{{ e.competencia }}</td>
<td>{{ e.status }}</td>
<td>{{ e.telefones_enviados }}</td>
<td>{{ e.telefones_com_erro or "" }}</td>
</tr>
{% endfor %}
</table>
<div class="tabela-wrap">
<table>
<tr>
<th>Data</th><th>Cliente</th><th>Código</th><th>Competência</th><th>Status</th>
<th>Telefones enviados</th><th>Telefones com erro</th>
</tr>
{% for e in envios %}
<tr>
<td>{{ e.data_processamento }}</td>
<td>{{ e.nome_cliente }}</td>
<td>{{ e.codigo_cliente }}</td>
<td>{{ e.competencia }}</td>
<td>{{ e.status }}</td>
<td>{{ e.telefones_enviados }}</td>
<td>{{ e.telefones_com_erro or "" }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% endblock %}