Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
3 changed files with 36 additions and 21 deletions
Showing only changes of commit 6e447afdaa - Show all commits

View File

@ -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;
}

View File

@ -18,7 +18,8 @@
<fieldset class="selectors">
<div class="infos">
<div class="infos-button">Groupes&nbsp;: {{grp|safe}}</div>
<div class="infos-button" style="margin-left: 24px;">Date&nbsp;: <span style="margin-left: 8px;" id="datestr"></span>
<div class="infos-button" style="margin-left: 24px;">Date&nbsp;: <span style="margin-left: 8px;"
id="datestr"></span>
<input type="date" name="tl_date" id="tl_date" value="{{ date }}" onchange="updateDate()">
</div>
</div>
@ -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";

View File

@ -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", () => {