Skip to content

Instantly share code, notes, and snippets.

@aleduca
Last active July 28, 2023 12:47
Show Gist options
  • Save aleduca/94eb8f5a7e142ad1036a1cacd502ef9d to your computer and use it in GitHub Desktop.
Save aleduca/94eb8f5a7e142ad1036a1cacd502ef9d to your computer and use it in GitHub Desktop.
Listagem de clientes:
<!-- Content Row -->
<div class="row">
<div class="col-lg-12">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">CPF / CNPJ</th>
<th scope="col">Nome / Razão</th>
<th scope="col">Celular / WhatsApp</th>
<th scope="col">e-amil</th>
<th colspan="3"></jt>
</tr>
</thead>
<tbody>
{% for client in clients %}
<tr>
<th scope="row">{{ client.id }}</th>
<td>{{ client.cpf_cnpj }}</td>
<td>{{ client.reason_name }}</td>
<td>{{ client.mobile_whatsapp }}</td>
<td>{{ client.email }}</td>
<td>
<button data-id="{{client.id}}" class="btn-view-data">Visualizar - {{client.id}}</button>
<a href="/admin/client/view/{{ client.id }}" class="btn btn-success btn-sm">Visualizar</a>
</td>
<td><a href="/admin/client/update/{{ client.id }}" class="btn btn-primary btn-sm">Editar</a></td>
<td><a href="/admin/client/delete/{{ client.id }}" class="btn btn-danger btn-sm">Apagar</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
var btns = document.querySelectorAll('.btn-view-data');
btns.forEach((btn) => {
btn.addEventListener('click', () =>{
var id = btn.dataset.id;
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment