Skip to content

Commit

Permalink
Merge pull request #760 from nilsonLazarin/auto-cadastro-241002
Browse files Browse the repository at this point in the history
Auto cadastro 241002
  • Loading branch information
nilsonLazarin authored Oct 23, 2024
2 parents eb3539a + 3ffd5e6 commit 30b903e
Show file tree
Hide file tree
Showing 5 changed files with 340 additions and 241 deletions.
11 changes: 11 additions & 0 deletions BD/wegia001.sql
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,17 @@ CREATE TABLE IF NOT EXISTS `wegia`.`socio` (
ON UPDATE NO ACTION)
ENGINE = InnoDB;

-- -----------------------------------------------------
-- Table `wegia`.`socio_log`
-- -----------------------------------------------------

CREATE TABLE IF NOT EXISTS `wegia`.`socio_log` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`id_socio` INT,
`data` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`descricao` VARCHAR(255) NOT NULL,
FOREIGN KEY (`id_socio`) REFERENCES `socio`(`id_socio`)
)ENGINE = InnoDB;

-- -----------------------------------------------------
-- Table `wegia`.`log_contribuicao`
Expand Down
12 changes: 8 additions & 4 deletions html/socio/cadastro_socio.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,22 @@
display: none;
}

span.obrigatorio{
span.obrigatorio {
color: red;
}

.btn-voltar{
.btn-voltar {
font-size: .9rem;
}

.btn-voltar:hover{
.btn-voltar:hover {
font-size: 1rem;
}

button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style>
</head>

Expand Down Expand Up @@ -291,7 +296,6 @@

<div id="pag6" class="wrap-input100 hidden">

<h3 class="text-center">Obrigado por apoiar nossa Instituição!</h3>
<div class="container-contact100-form-btn">
<button class="contact100-form-btn" id="avanca-terminar">
Inscrever-se como sócio apoiador.
Expand Down
19 changes: 13 additions & 6 deletions html/socio/js/cadastro_socio.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ btnAvancaCpf.addEventListener('click', (ev) => {
mensagemDiv.innerHTML = '';
} else {
acao.value = "atualizar";

//Alteração do texto do botão de submite
const botaoEnvio = document.getElementById('avanca-terminar');
botaoEnvio.textContent = 'Atualizar dados';

//Preenchimento automático dos campos

//informações da pag3
Expand Down Expand Up @@ -169,7 +174,7 @@ formCadastro.addEventListener('submit', (ev) => {
const formData = new FormData(formCadastro);

// Desabilita o botão de envio
const botaoEnvio = ev.submitter;
const botaoEnvio = document.getElementById('avanca-terminar');
botaoEnvio.disabled = true;

// Realiza a requisição com o fetch
Expand All @@ -183,23 +188,25 @@ formCadastro.addEventListener('submit', (ev) => {
mensagemDiv.innerHTML = `<div class="alert alert-danger text-center" role="alert">` +
`${data.erro}`
+ `</div>`;
botaoEnvio.disabled = false;
return;
} else {
mensagemDiv.innerHTML = `<div class="alert alert-success text-center" role="alert">` +
`${data.retorno}`
+ `</div>`;
+ `</div>` + `<h3 class="text-center">Obrigado por apoiar nossa Instituição!</h3>`;

const btnVoltar = document.getElementById('volta-endereco');
btnVoltar.classList.add('hidden');
}
})
.catch(error => {
mensagemDiv.innerHTML = `<div class="alert alert-danger text-center" role="alert">` +
`Ocorreu um erro ao realizar o cadastro.`
+ `</div>`;
console.error(error);
botaoEnvio.disabled = false;
return;
})
.finally(() => {
// Reabilita o botão de envio após a resposta
botaoEnvio.disabled = false;
});
});

//Definição do comportamento de voltar
Expand Down
Loading

0 comments on commit 30b903e

Please sign in to comment.