fix: corrige campos de data no modal de novo militante
This commit is contained in:
@@ -265,12 +265,36 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
console.log('Configurando modal de edição...');
|
||||
|
||||
// Configurar campos de data
|
||||
document.querySelectorAll('input[type="date"]').forEach(configurarCampoData);
|
||||
|
||||
// Configurar modal de edição
|
||||
// Configurar campos de data em todos os modais
|
||||
const modalNovoMilitante = document.getElementById('modalNovoMilitante');
|
||||
const modalEditarMilitante = document.getElementById('modalEditarMilitante');
|
||||
|
||||
// Configurar campos quando o modal novo for aberto
|
||||
if (modalNovoMilitante) {
|
||||
modalNovoMilitante.addEventListener('show.bs.modal', function() {
|
||||
// Configurar campos de data do modal novo
|
||||
const camposData = this.querySelectorAll('input[type="date"]');
|
||||
camposData.forEach(configurarCampoData);
|
||||
});
|
||||
|
||||
// Limpar formulário e alertas quando o modal for fechado
|
||||
modalNovoMilitante.addEventListener('hidden.bs.modal', function () {
|
||||
formNovoMilitante.reset();
|
||||
const alerts = this.querySelectorAll('.alert');
|
||||
alerts.forEach(alert => alert.remove());
|
||||
});
|
||||
}
|
||||
|
||||
// Configurar campos quando o modal editar for aberto
|
||||
if (modalEditarMilitante) {
|
||||
modalEditarMilitante.addEventListener('show.bs.modal', function() {
|
||||
// Configurar campos de data do modal editar
|
||||
const camposData = this.querySelectorAll('input[type="date"]');
|
||||
camposData.forEach(configurarCampoData);
|
||||
});
|
||||
}
|
||||
|
||||
// Configurar modal de edição
|
||||
if (modalEditarMilitante) {
|
||||
console.log('Modal encontrado, configurando eventos...');
|
||||
|
||||
@@ -532,7 +556,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
.then(data => {
|
||||
if (data.status === 'success') {
|
||||
// Fechar o modal
|
||||
const modal = bootstrap.Modal.getInstance(document.getElementById('modalNovoMilitante'));
|
||||
const modal = bootstrap.Modal.getInstance(modalNovoMilitante);
|
||||
modal.hide();
|
||||
|
||||
// Limpar o formulário
|
||||
@@ -650,16 +674,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
});
|
||||
|
||||
// Limpar formulário e alertas quando o modal for fechado
|
||||
const modalNovoMilitante = document.getElementById('modalNovoMilitante');
|
||||
if (modalNovoMilitante) {
|
||||
modalNovoMilitante.addEventListener('hidden.bs.modal', function () {
|
||||
formNovoMilitante.reset();
|
||||
const alerts = this.querySelectorAll('.alert');
|
||||
alerts.forEach(alert => alert.remove());
|
||||
});
|
||||
}
|
||||
|
||||
// Configuração do modal de exclusão
|
||||
const deleteModal = document.getElementById('deleteModal');
|
||||
if (deleteModal) {
|
||||
|
||||
Reference in New Issue
Block a user