2020-09-26 16:19:37 +02:00
|
|
|
// Affiche et met a jour la liste des UE partageant le meme code
|
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
|
|
update_ue_list();
|
|
|
|
$("#tf_ue_id").bind("change", update_ue_list);
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
const buttons = document.querySelectorAll(".ue_list_etud_validations button");
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
buttons.forEach((button) => {
|
|
|
|
button.addEventListener("click", (event) => {
|
|
|
|
// Handle button click event here
|
|
|
|
event.preventDefault();
|
|
|
|
const etudid = event.target.dataset.etudid;
|
2023-06-30 17:26:41 +02:00
|
|
|
const validation_id = event.target.dataset.v_id;
|
2023-06-25 11:49:11 +02:00
|
|
|
const validation_type = event.target.dataset.type;
|
|
|
|
if (confirm("Supprimer cette validation ?")) {
|
2023-06-30 17:26:41 +02:00
|
|
|
delete_validation(etudid, validation_type, validation_id);
|
2023-06-25 11:49:11 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2020-09-26 16:19:37 +02:00
|
|
|
|
2023-06-30 17:26:41 +02:00
|
|
|
async function delete_validation(etudid, validation_type, validation_id) {
|
|
|
|
const response = await fetch(
|
2024-04-10 18:40:32 +02:00
|
|
|
`${SCO_URL}../api/etudiant/${etudid}/jury/${validation_type}/${validation_id}/delete`,
|
2023-06-30 17:26:41 +02:00
|
|
|
{
|
|
|
|
method: "POST",
|
|
|
|
}
|
|
|
|
);
|
|
|
|
if (response.ok) {
|
|
|
|
location.reload();
|
|
|
|
} else {
|
|
|
|
const data = await response.json();
|
|
|
|
sco_error_message("erreur: " + data.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-25 11:49:11 +02:00
|
|
|
function update_ue_list() {
|
|
|
|
var ue_id = $("#tf_ue_id")[0].value;
|
|
|
|
if (ue_id) {
|
2024-04-10 18:40:32 +02:00
|
|
|
var query = SCO_URL + "Notes/ue_sharing_code?ue_id=" + ue_id;
|
2023-06-25 11:49:11 +02:00
|
|
|
$.get(query, "", function (data) {
|
|
|
|
$("#ue_list_code").html(data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|