feat: redesign do detalhe de cliente (contatos e status de chaves)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Gustavo
2026-08-13 22:04:31 -03:00
co-authored by Claude Sonnet 5
parent 343f61ade7
commit 18029de9f8
+47 -41
View File
@@ -2,8 +2,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block titulo %}{{ cliente.RAZAO }}{% endblock %} {% block titulo %}{{ cliente.RAZAO }}{% endblock %}
{% block conteudo %} {% block conteudo %}
<h1>{{ cliente.FANTASIA }} <small>({{ cliente.CODIGO }})</small></h1> <h1>{{ cliente.FANTASIA }} <small style="color:var(--cor-texto-secundario)">({{ cliente.CODIGO }})</small></h1>
<p>{{ cliente.RAZAO }} — {{ cliente.CNPJ }}</p> <p style="color:var(--cor-texto-secundario)">{{ cliente.RAZAO }} — {{ cliente.CNPJ }}</p>
<p> <p>
<a class="botao" href="/clientes/{{ cliente.ID }}/editar">Editar</a> <a class="botao" href="/clientes/{{ cliente.ID }}/editar">Editar</a>
<form method="post" action="/clientes/{{ cliente.ID }}/excluir" style="display:inline"> <form method="post" action="/clientes/{{ cliente.ID }}/excluir" style="display:inline">
@@ -13,50 +13,56 @@
</p> </p>
<h2>Contatos</h2> <h2>Contatos</h2>
<table> <div class="tabela-wrap">
<tr><th>Nome</th><th>Telefone</th><th>E-mail</th><th></th></tr> <table>
{% for ct in contatos %} <tr><th>Nome</th><th>Telefone</th><th>E-mail</th><th></th></tr>
<tr> {% for ct in contatos %}
<td>{{ ct.NOME }}</td><td>{{ ct.TELEFONE }}</td><td>{{ ct.EMAIL or "" }}</td> <tr>
<td> <td>{{ ct.NOME }}</td><td>{{ ct.TELEFONE }}</td><td>{{ ct.EMAIL or "" }}</td>
<details style="display:inline-block"> <td>
<summary class="botao" style="display:inline-block;cursor:pointer">Editar</summary> <details style="display:inline-block">
<form method="post" action="/clientes/{{ cliente.ID }}/contatos/{{ ct.ID }}/editar" style="margin-top:8px"> <summary class="botao" style="display:inline-block;cursor:pointer">Editar</summary>
<form method="post" action="/clientes/{{ cliente.ID }}/contatos/{{ ct.ID }}/editar" style="margin-top:8px">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<label for="nome-{{ ct.ID }}">Nome</label>
<input type="text" id="nome-{{ ct.ID }}" name="nome" value="{{ ct.NOME or '' }}">
<label for="telefone-{{ ct.ID }}">Telefone</label>
<input type="text" id="telefone-{{ ct.ID }}" name="telefone" value="{{ ct.TELEFONE }}" required>
<label for="email-{{ ct.ID }}">E-mail</label>
<input type="text" id="email-{{ ct.ID }}" name="email" value="{{ ct.EMAIL or '' }}">
<button type="submit">Salvar</button>
</form>
</details>
<form method="post" action="/clientes/{{ cliente.ID }}/contatos/{{ ct.ID }}/excluir" style="display:inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"> <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<label for="nome-{{ ct.ID }}">Nome</label> <button type="submit" onclick="return confirm('Excluir este contato?')">Excluir</button>
<input type="text" id="nome-{{ ct.ID }}" name="nome" value="{{ ct.NOME or '' }}">
<label for="telefone-{{ ct.ID }}">Telefone</label>
<input type="text" id="telefone-{{ ct.ID }}" name="telefone" value="{{ ct.TELEFONE }}" required>
<label for="email-{{ ct.ID }}">E-mail</label>
<input type="text" id="email-{{ ct.ID }}" name="email" value="{{ ct.EMAIL or '' }}">
<button type="submit">Salvar</button>
</form> </form>
</details> </td>
<form method="post" action="/clientes/{{ cliente.ID }}/contatos/{{ ct.ID }}/excluir" style="display:inline"> </tr>
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"> {% endfor %}
<button type="submit" onclick="return confirm('Excluir este contato?')">Excluir</button> </table>
</form> </div>
</td> <div class="cartao">
</tr> <form method="post" action="/clientes/{{ cliente.ID }}/contatos">
{% endfor %} <input type="hidden" name="csrf_token" value="{{ csrf_token }}">
</table> <label for="nome">Nome</label>
<form method="post" action="/clientes/{{ cliente.ID }}/contatos"> <input type="text" id="nome" name="nome">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"> <label for="telefone">Telefone</label>
<label for="nome">Nome</label> <input type="text" id="telefone" name="telefone" required>
<input type="text" id="nome" name="nome"> <label for="email">E-mail</label>
<label for="telefone">Telefone</label> <input type="text" id="email" name="email">
<input type="text" id="telefone" name="telefone" required> <button type="submit">Adicionar contato</button>
<label for="email">E-mail</label> </form>
<input type="text" id="email" name="email"> </div>
<button type="submit">Adicionar contato</button>
</form>
<h2>Status em Clientes_Chaves</h2> <h2>Status em Clientes_Chaves</h2>
{% if status_chaves %} {% if status_chaves %}
<table> <div class="tabela-wrap">
<tr>{% for mes in status_chaves.meses %}<th>{{ mes }}</th>{% endfor %}</tr> <table>
<tr>{% for mes, valor in status_chaves.meses.items() %}<td>{{ "✓" if valor else "—" }}</td>{% endfor %}</tr> <tr>{% for mes in status_chaves.meses %}<th>{{ mes }}</th>{% endfor %}</tr>
</table> <tr>{% for mes, valor in status_chaves.meses.items() %}<td>{{ "✓" if valor else "—" }}</td>{% endfor %}</tr>
</table>
</div>
{% else %} {% else %}
<p>Nenhuma linha em Clientes_Chaves para o código {{ cliente.CODIGO }}.</p> <p>Nenhuma linha em Clientes_Chaves para o código {{ cliente.CODIGO }}.</p>
{% endif %} {% endif %}