1
0
forked from ScoDoc/ScoDoc
ScoDoc/app/static/js/validate_previous_ue.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-09-26 16:19:37 +02:00
// Affiche et met a jour la liste des UE partageant le meme code
document.addEventListener("DOMContentLoaded", () => {
update_ue_list();
$("#tf_ue_id").bind("change", update_ue_list);
2020-09-26 16:19:37 +02:00
const buttons = document.querySelectorAll(".ue_list_etud_validations button");
2020-09-26 16:19:37 +02:00
buttons.forEach((button) => {
button.addEventListener("click", (event) => {
// Handle button click event here
event.preventDefault();
const etudid = event.target.dataset.etudid;
const v_id = event.target.dataset.v_id;
const validation_type = event.target.dataset.type;
if (confirm("Supprimer cette validation ?")) {
fetch(
`${SCO_URL}/../api/etudiant/${etudid}/jury/${validation_type}/${v_id}/delete`,
{
method: "POST",
}
).then((response) => {
// Handle the response
if (response.ok) {
location.reload();
} else {
throw new Error("Request failed");
}
2021-06-21 18:46:35 +02:00
});
}
});
});
});
2020-09-26 16:19:37 +02:00
function update_ue_list() {
var ue_id = $("#tf_ue_id")[0].value;
if (ue_id) {
var query = SCO_URL + "/Notes/ue_sharing_code?ue_id=" + ue_id;
$.get(query, "", function (data) {
$("#ue_list_code").html(data);
});
}
}