-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #725 from nilsonLazarin/pre-master-2409
Atualizações semana 3ª semana de setembro de 2024
- Loading branch information
Showing
26 changed files
with
643 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 47 additions & 2 deletions
49
html/contribuicao/configuracao/assets/js/configuracoesGerais.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,53 @@ | ||
$(function() {//Carrega cabeçalho e menu lateral | ||
$(function () {//Carrega cabeçalho e menu lateral | ||
$("#header").load("../../header.php"); | ||
$(".menuu").load("../../menu.php"); | ||
}); | ||
|
||
function confirmarExclusao() {//Trava de segurança para evitar exclusão de itens indesejados | ||
/** | ||
* Trava de segurança para evitar exclusão de itens indesejados | ||
* @returns | ||
*/ | ||
function confirmarExclusao() { | ||
return confirm("Tem certeza que deseja excluir este item?"); | ||
} | ||
|
||
/**Extraí os dados necessários da view e envia um fetch de POST para a URL informada */ | ||
function alterarStatus(ev, URL, controller) { | ||
const toggleId = ev.target.id; // ID do toggle clicado | ||
const isChecked = ev.target.checked; // Verifica se está marcado ou não | ||
|
||
// Usando expressão regular para extrair o número | ||
const idNumber = toggleId.match(/\d+/)[0]; // Extrai o número após 'toggle' | ||
// Montar os dados para enviar no POST | ||
|
||
data = new URLSearchParams(); | ||
data.append('id', idNumber); | ||
data.append('status', isChecked); | ||
data.append('nomeClasse', controller); | ||
data.append('metodo', 'alterarStatus'); | ||
|
||
// Enviar dados via fetch (POST) | ||
fetch(URL, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
}, | ||
body: data.toString() // Converte o objeto em uma string URL-encoded | ||
}) | ||
.then(response => { | ||
if (response.ok) { | ||
return response.json(); // Se necessário, processa a resposta | ||
} else { | ||
return response.json().then(errData => { | ||
// Lança o erro com a mensagem extraída do backend | ||
throw new Error(errData.Erro || 'Erro desconhecido no servidor'); | ||
}); | ||
} | ||
}) | ||
.then(result => { | ||
console.log('Resultado:', result); // Processa a resposta do servidor, se houver | ||
}) | ||
.catch(error => { | ||
alert(error); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.