Adicionados os campos mínimos do Banco de Dados, precisa melhorar interface e controle de acesso que será posterior nessa branch mesmo
This commit is contained in:
@@ -3,55 +3,86 @@
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Lista de Militantes</h2>
|
||||
<a href="{{ url_for('novo_militante') }}" class="btn btn-primary mb-3">Novo Militante</a>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>CPF</th>
|
||||
<th>Email</th>
|
||||
<th>Telefone</th>
|
||||
<th>Endereço</th>
|
||||
<th>Filiado</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for militante in militantes %}
|
||||
<tr class="clickable-row" data-href="{{ url_for('editar_militante', id=militante.id) }}">
|
||||
<td>{{ militante.nome }}</td>
|
||||
<td>{{ militante.cpf }}</td>
|
||||
<td>{{ militante.email }}</td>
|
||||
<td>{{ militante.telefone }}</td>
|
||||
<td>{{ militante.endereco }}</td>
|
||||
<td>{{ 'Sim' if militante.filiado else 'Não' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1 class="mb-4">Lista de Militantes</h1>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="d-flex justify-content-between mb-4">
|
||||
<a href="{{ url_for('novo_militante') }}" class="btn btn-success">Novo Militante</a>
|
||||
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nome</th>
|
||||
<th>CPF</th>
|
||||
<th>Título Eleitoral</th>
|
||||
<th>Data de Nascimento</th>
|
||||
<th>Data de Entrada</th>
|
||||
<th>Data de Efetivação</th>
|
||||
<th>Telefone 1</th>
|
||||
<th>Telefone 2</th>
|
||||
<th>Profissão</th>
|
||||
<th>Regime de Trabalho</th>
|
||||
<th>Empresa</th>
|
||||
<th>Contratante</th>
|
||||
<th>Instituição de Ensino</th>
|
||||
<th>Tipo de Instituição</th>
|
||||
<th>Sindicato</th>
|
||||
<th>Cargo Sindical</th>
|
||||
<th>Dirigente Sindical</th>
|
||||
<th>Central Sindical</th>
|
||||
<th>Setor</th>
|
||||
<th>Célula</th>
|
||||
<th>Ações</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for militante in militantes %}
|
||||
<tr>
|
||||
<td>{{ militante.id }}</td>
|
||||
<td>{{ militante.nome }}</td>
|
||||
<td>{{ militante.cpf }}</td>
|
||||
<td>{{ militante.titulo_eleitoral }}</td>
|
||||
<td>{{ militante.data_nascimento.strftime('%d/%m/%Y') }}</td>
|
||||
<td>{{ militante.data_entrada_oci.strftime('%d/%m/%Y') }}</td>
|
||||
<td>{{ militante.data_efetivacao_oci.strftime('%d/%m/%Y') }}</td>
|
||||
<td>{{ militante.telefone1 }}</td>
|
||||
<td>{{ militante.telefone2 }}</td>
|
||||
<td>{{ militante.profissao }}</td>
|
||||
<td>{{ militante.regime_trabalho }}</td>
|
||||
<td>{{ militante.empresa }}</td>
|
||||
<td>{{ militante.contratante }}</td>
|
||||
<td>{{ militante.instituicao_ensino }}</td>
|
||||
<td>{{ militante.tipo_instituicao }}</td>
|
||||
<td>{{ militante.sindicato }}</td>
|
||||
<td>{{ militante.cargo_sindical }}</td>
|
||||
<td>{{ 'Sim' if militante.dirigente_sindical else 'Não' }}</td>
|
||||
<td>{{ militante.central_sindical }}</td>
|
||||
<td>{{ militante.setor.nome }}</td>
|
||||
<td>{{ militante.celula.nome }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('editar_militante', id=militante.id) }}" class="btn btn-primary btn-sm">Editar</a>
|
||||
<a href="{{ url_for('deletar_militante', id=militante.id) }}" class="btn btn-danger btn-sm" onclick="return confirm('Tem certeza que deseja excluir este militante?')">Excluir</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.clickable-row {
|
||||
cursor: pointer;
|
||||
}
|
||||
.clickable-row:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const rows = document.querySelectorAll('.clickable-row');
|
||||
rows.forEach(row => {
|
||||
row.addEventListener('click', function() {
|
||||
window.location.href = this.dataset.href;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user