Files
controles/templates/listar_instancias.html

79 lines
3.4 KiB
HTML
Raw Permalink Normal View History

{% extends 'base.html' %}
{% block title %}Lista de {{ tipo_instancia }}s{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="mb-4">Lista de {{ tipo_instancia }}s</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('criar_' + tipo_instancia.lower()) }}" class="btn btn-primary">Nova {{ tipo_instancia }}</a>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Nome</th>
{% if tipo_instancia != 'Célula' %}
<th>{{ instancia_superior }}</th>
{% endif %}
<th>Responsável Geral</th>
<th>Responsável de Finanças</th>
<th>Responsável de Imprensa</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
{% for instancia in instancias %}
<tr>
<td>{{ instancia.nome }}</td>
{% if tipo_instancia != 'Célula' %}
<td>{{ instancia.instancia_superior.nome }}</td>
{% endif %}
<td>{{ instancia.responsavel_geral.nome }}</td>
<td>
{% if instancia.responsavel_financas %}
{{ instancia.responsavel_financas.nome }}
{% else %}
-
{% endif %}
</td>
<td>
{% if instancia.responsavel_imprensa %}
{{ instancia.responsavel_imprensa.nome }}
{% else %}
-
{% endif %}
</td>
<td>
<a href="{{ url_for('editar_' + tipo_instancia.lower(), id=instancia.id) }}" class="btn btn-sm btn-warning">Editar</a>
<button type="button" class="btn btn-sm btn-danger" onclick="confirmarExclusao({{ instancia.id }})">Excluir</button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
function confirmarExclusao(id) {
if (confirm('Tem certeza que deseja excluir esta {{ tipo_instancia }}?')) {
window.location.href = "{{ url_for('excluir_' + tipo_instancia.lower(), id=0) }}".replace('0', id);
}
}
</script>
{% endblock %}