feat: formulario de edicao de contato na tela de detalhe do cliente
Adiciona UI (details/summary, sem JS) para editar nome/telefone/email
de um contato existente, usando a rota POST /clientes/{id}/contatos/{id}/editar
que ja existia no router e no db mas nunca tinha formulario associado.
Cobre com testes de rota (sucesso + telefone duplicado) e um teste
verificando que a tela de detalhe realmente renderiza o formulario.
This commit is contained in:
@@ -18,6 +18,18 @@
|
||||
<tr>
|
||||
<td>{{ ct.NOME }}</td><td>{{ ct.TELEFONE }}</td><td>{{ ct.EMAIL or "" }}</td>
|
||||
<td>
|
||||
<details style="display:inline-block">
|
||||
<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">
|
||||
<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">
|
||||
<button type="submit" onclick="return confirm('Excluir este contato?')">Excluir</button>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user