Assiduites : modification automatique du moduleimpl_id

This commit is contained in:
iziram 2023-04-19 18:17:47 +02:00
parent 5a997dddf4
commit f3b540b4c1
2 changed files with 21 additions and 2 deletions

View File

@ -1758,7 +1758,7 @@ function getCurrentAssiduite(etudid) {
const assiduite_id = parseInt(field.getAttribute("assiduite_id"));
const type = field.getAttribute("type");
if (type == "edition") {
if (type == "édition") {
let assi = null;
assiduites[etudid].forEach((a) => {
if (a.assiduite_id === assiduite_id) {

View File

@ -98,7 +98,26 @@
}
function updateSelectedSelect(moduleimpl_id) {
document.getElementById('moduleimpl_select').value = moduleimpl_id;
const mod_id = moduleimpl_id != null ? moduleimpl_id : ""
document.getElementById('moduleimpl_select').value = mod_id;
}
window.onload = () => {
document.getElementById('moduleimpl_select').addEventListener('change', () => {
const mod_id = document.getElementById('moduleimpl_select').value;
const assi = getCurrentAssiduite(etudid);
if (assi) {
editAssiduite(assi.assiduite_id, assi.etat);
}
})
const conflicts = getAssiduitesConflict(etudid);
if (conflicts.length > 0) {
updateSelectedSelect(conflicts[0].moduleimpl_id);
}
}