diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index b2d73c100b..4ad8d380d9 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -1389,6 +1389,11 @@ function generateAllEtudRow() { etuds[a].nom > etuds[b].nom ? 1 : etuds[b].nom > etuds[a].nom ? -1 : 0 ); + let mod = getModuleImplId(); + etuds_ids = etuds_ids.filter((i) => { + return checkInscriptionModule(mod, i); + }); + for (let i = 0; i < etuds_ids.length; i++) { const etud = etuds[etuds_ids[i]]; insertEtudRow(etud, i + 1); @@ -1764,3 +1769,25 @@ function getUser(obj) { return obj.user_nom_complet || obj.user_id; } + +const inscriptionsModule = {}; + +function checkInscriptionModule(moduleimpl_id, etudid) { + if ([null, "", "autre"].indexOf(moduleimpl_id) !== -1) return true; + if (!inscriptionsModule.hasOwnProperty(moduleimpl_id)) { + const path = getUrl() + `/api/moduleimpl/${moduleimpl_id}/inscriptions`; + sync_get( + path, + (data, status) => { + inscriptionsModule[moduleimpl_id] = data; + }, + (data, status) => { + //error + console.error(data, status); + errorAlert(); + } + ); + } + const etudsInscrits = inscriptionsModule[moduleimpl_id].map((i) => i.etudid); + return etudsInscrits.indexOf(Number(etudid)) !== -1; +} diff --git a/app/templates/assiduites/pages/signal_assiduites_group.j2 b/app/templates/assiduites/pages/signal_assiduites_group.j2 index cac99bca59..5a7c09fecb 100644 --- a/app/templates/assiduites/pages/signal_assiduites_group.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_group.j2 @@ -18,7 +18,8 @@
Groupes : {{grp|safe}}
-
Date : +
Date :
@@ -106,10 +107,15 @@ const etudsDefDem = {{ defdem | safe }} + const select = document.getElementById("moduleimpl_select"); + + select?.addEventListener('change', (e) => { + generateAllEtudRow(); + }); + if (window.forceModule) { const btn = document.getElementById("validate_selectors"); - const select = document.getElementById("moduleimpl_select"); if (!readOnly && select.value == "") { document.getElementById('forcemodule').style.display = "block"; diff --git a/app/templates/assiduites/widgets/differee.j2 b/app/templates/assiduites/widgets/differee.j2 index f6efc6f5d1..6d0d8ed139 100644 --- a/app/templates/assiduites/widgets/differee.j2 +++ b/app/templates/assiduites/widgets/differee.j2 @@ -287,7 +287,6 @@ currentDate = moment(currentDate).tz(TIMEZONE).format("YYYY-MM-DDTHH:mm"); } - const inscriptionsModule = {}; function createColumn(dateStart = "", dateEnd = "", moduleimpl_id = "") { let table = document.getElementById("studentTable"); @@ -1034,24 +1033,7 @@ }) } - function checkInscriptionModule(moduleimpl_id, etudid) { - if (!inscriptionsModule.hasOwnProperty(moduleimpl_id)) { - const path = getUrl() + `/api/moduleimpl/${moduleimpl_id}/inscriptions`; - sync_get( - path, - (data, status) => { - inscriptionsModule[moduleimpl_id] = data; - }, - (data, status) => { - //error - console.error(data, status); - errorAlert(); - } - ); - } - const etudsInscrits = inscriptionsModule[moduleimpl_id].map((i) => i.etudid); - return etudsInscrits.indexOf(Number(etudid)) !== -1; - } + window.addEventListener('load', () => { document.getElementById("addColumn").addEventListener("click", () => {