feat: Melhorias na interface do modal de detalhes do militante - Adicionado efeito de blur consistente em todos os modais - Corrigido estilo do botão de editar para manter a cor azul padrão - Adicionado backdrop-filter no modal de confirmação de exclusão - Melhorias na responsividade dos modais para dispositivos móveis - Ajustado comportamento de fechamento dos modais
This commit is contained in:
@@ -112,7 +112,7 @@
|
|||||||
{% if ultimos_militantes %}
|
{% if ultimos_militantes %}
|
||||||
<div class="list-group list-group-flush">
|
<div class="list-group list-group-flush">
|
||||||
{% for militante in ultimos_militantes %}
|
{% for militante in ultimos_militantes %}
|
||||||
<a href="{{ url_for('editar_militante', id=militante.id) }}" class="list-group-item list-group-item-action">
|
<a href="#" class="list-group-item list-group-item-action" data-militante-id="{{ militante.id }}">
|
||||||
<div class="d-flex w-100 justify-content-between">
|
<div class="d-flex w-100 justify-content-between">
|
||||||
<h6 class="mb-1">{{ militante.nome }}</h6>
|
<h6 class="mb-1">{{ militante.nome }}</h6>
|
||||||
<small class="text-muted">#{{ militante.id }}</small>
|
<small class="text-muted">#{{ militante.id }}</small>
|
||||||
@@ -160,6 +160,77 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal de Detalhes do Militante -->
|
||||||
|
<div class="modal fade" id="militanteModal" tabindex="-1" aria-labelledby="militanteModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="militanteModalLabel">Detalhes do Militante</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Fechar"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="fw-bold">Nome:</label>
|
||||||
|
<p id="militanteNome" class="mb-2"></p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="fw-bold">CPF:</label>
|
||||||
|
<p id="militanteCPF" class="mb-2"></p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="fw-bold">Email:</label>
|
||||||
|
<p id="militanteEmail" class="mb-2"></p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="fw-bold">Telefone:</label>
|
||||||
|
<p id="militanteTelefone" class="mb-2"></p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="fw-bold">Endereço:</label>
|
||||||
|
<p id="militanteEndereco" class="mb-2"></p>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="fw-bold">Status:</label>
|
||||||
|
<p id="militanteFiliado" class="mb-2"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#" id="btnEditarMilitante" class="btn btn-primary" style="background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; color: white !important;">
|
||||||
|
<i class="fas fa-edit me-1"></i>Editar
|
||||||
|
</a>
|
||||||
|
<button type="button" id="btnExcluirMilitante" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#confirmDeleteModal">
|
||||||
|
<i class="fas fa-trash me-1"></i>Excluir
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fechar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal de Confirmação de Exclusão -->
|
||||||
|
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Confirmar Exclusão</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Fechar"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Tem certeza que deseja excluir o militante <strong id="militanteExcluirNome"></strong>?</p>
|
||||||
|
<p class="text-danger mb-0">Esta ação não pode ser desfeita.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<form id="formExcluirMilitante" method="POST">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
||||||
|
<button type="submit" class="btn btn-danger">
|
||||||
|
<i class="fas fa-trash me-1"></i>Excluir
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.welcome-header {
|
.welcome-header {
|
||||||
background: linear-gradient(to right, var(--background-color), rgba(232, 0, 12, 0.05));
|
background: linear-gradient(to right, var(--background-color), rgba(232, 0, 12, 0.05));
|
||||||
@@ -200,5 +271,136 @@
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Estilo para o backdrop do modal com blur */
|
||||||
|
.modal-backdrop.show {
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Estilo para o modal */
|
||||||
|
.modal-content {
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
background: linear-gradient(to right, var(--secondary-dark), var(--secondary-color));
|
||||||
|
color: white;
|
||||||
|
border-radius: 12px 12px 0 0;
|
||||||
|
border-bottom: none;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
padding: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ajustes para mobile */
|
||||||
|
@media (max-width: 576px) {
|
||||||
|
.modal-footer {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer .btn {
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body label {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body label {
|
||||||
|
color: var(--secondary-color);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body p {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Garantir que o modal de confirmação mantenha o backdrop quando aberto */
|
||||||
|
#confirmDeleteModal {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#confirmDeleteModal.show {
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ajuste para garantir que o botão de editar fique azul */
|
||||||
|
.btn-primary,
|
||||||
|
.btn-primary:hover,
|
||||||
|
.btn-primary:focus,
|
||||||
|
.btn-primary:active {
|
||||||
|
background-color: var(--bs-primary) !important;
|
||||||
|
border-color: var(--bs-primary) !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
{% block extra_js %}
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Dados dos militantes para o modal
|
||||||
|
const militantes = {{ ultimos_militantes|tojson|safe }};
|
||||||
|
|
||||||
|
// Referência ao modal principal
|
||||||
|
const militanteModal = document.getElementById('militanteModal');
|
||||||
|
|
||||||
|
// Garantir que o backdrop seja removido ao fechar o modal
|
||||||
|
militanteModal.addEventListener('hidden.bs.modal', function () {
|
||||||
|
const backdrop = document.querySelector('.modal-backdrop');
|
||||||
|
if (backdrop) {
|
||||||
|
backdrop.remove();
|
||||||
|
}
|
||||||
|
document.body.classList.remove('modal-open');
|
||||||
|
document.body.style.overflow = '';
|
||||||
|
document.body.style.paddingRight = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Função para abrir o modal com os dados do militante
|
||||||
|
function showMilitanteModal(militanteId) {
|
||||||
|
const militante = militantes.find(m => m.id === militanteId);
|
||||||
|
if (!militante) return;
|
||||||
|
|
||||||
|
// Preencher os dados no modal
|
||||||
|
document.getElementById('militanteNome').textContent = militante.nome;
|
||||||
|
document.getElementById('militanteCPF').textContent = militante.cpf;
|
||||||
|
document.getElementById('militanteEmail').textContent = militante.email;
|
||||||
|
document.getElementById('militanteTelefone').textContent = militante.telefone;
|
||||||
|
document.getElementById('militanteEndereco').textContent = militante.endereco;
|
||||||
|
document.getElementById('militanteFiliado').textContent = militante.filiado ? 'Filiado' : 'Não Filiado';
|
||||||
|
|
||||||
|
// Configurar botões
|
||||||
|
document.getElementById('btnEditarMilitante').href = `/militantes/editar/${militante.id}`;
|
||||||
|
document.getElementById('formExcluirMilitante').action = `/militantes/excluir/${militante.id}`;
|
||||||
|
document.getElementById('militanteExcluirNome').textContent = militante.nome;
|
||||||
|
|
||||||
|
// Abrir o modal
|
||||||
|
const modal = new bootstrap.Modal(document.getElementById('militanteModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adicionar evento de clique nos itens da lista
|
||||||
|
document.querySelectorAll('[data-militante-id]').forEach(item => {
|
||||||
|
item.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const militanteId = parseInt(this.getAttribute('data-militante-id'));
|
||||||
|
showMilitanteModal(militanteId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user