From c639778b787bbde3515c230e1d8e313d8d692d5b Mon Sep 17 00:00:00 2001 From: Iziram Date: Fri, 12 Jan 2024 11:36:00 +0100 Subject: [PATCH] Assiduites : VisuAssiduiteGr logique page fixes #804 --- app/static/js/assiduites.js | 21 +++++++++------- .../pages/signal_assiduites_etud.j2 | 3 +++ .../pages/signal_assiduites_group.j2 | 24 +++++++++++++------ .../assiduites/widgets/minitimeline.j2 | 3 ++- app/templates/assiduites/widgets/timeline.j2 | 4 ++-- app/views/assiduites.py | 2 +- 6 files changed, 37 insertions(+), 20 deletions(-) diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index 55d0c6afa..9f7e69e7a 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -110,11 +110,12 @@ function validateSelectors(btn) { getAssiduitesFromEtuds(true); - document.querySelector(".selectors").disabled = true; - $("#tl_date").datepicker("option", "disabled", true); + // document.querySelector(".selectors").disabled = true; + // $("#tl_date").datepicker("option", "disabled", true); generateMassAssiduites(); generateAllEtudRow(); - btn.remove(); + // btn.remove(); + btn.textContent = "Actualiser"; onlyAbs(); }; @@ -533,6 +534,7 @@ function massAction() { * puis on ajoute les événements associés */ function generateMassAssiduites() { + if (readOnly || document.querySelector(".mass-selection") != null) return; const content = document.getElementById("content"); const mass = document.createElement("div"); @@ -1411,7 +1413,8 @@ function generateEtudRow( assi += ``; } }); - const conflit = assiduite.type == "conflit" ? "conflit" : ""; + if (readOnly) assi = ""; + const conflit = assiduite.type == "conflit" && !readOnly ? "conflit" : ""; const pdp_url = `${getUrl()}/api/etudiant/etudid/${etud.id}/photo?size=small`; let defdem = ""; @@ -1543,11 +1546,11 @@ function generateAllEtudRow() { return; } - if (!document.querySelector(".selectors")?.disabled) { - return; - } - - document.querySelector(".etud_holder").innerHTML = ""; + // if (!document.querySelector(".selectors")?.disabled) { + // return; + // } + const etud_hodler = document.querySelector(".etud_holder"); + if (etud_hodler) etud_hodler.innerHTML = ""; etuds_ids = Object.keys(etuds).sort((a, b) => etuds[a].nom > etuds[b].nom ? 1 : etuds[b].nom > etuds[a].nom ? -1 : 0 ); diff --git a/app/templates/assiduites/pages/signal_assiduites_etud.j2 b/app/templates/assiduites/pages/signal_assiduites_etud.j2 index 2284604a7..ea4530952 100644 --- a/app/templates/assiduites/pages/signal_assiduites_etud.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_etud.j2 @@ -102,6 +102,9 @@ setupTimeLine(() => { + if(document.querySelector('.etud_holder .placeholder') != null){ + generateAllEtudRow(); + } updateJustifyBtn(); }); diff --git a/app/templates/assiduites/pages/signal_assiduites_group.j2 b/app/templates/assiduites/pages/signal_assiduites_group.j2 index 15fd6a48f..238dd25c7 100644 --- a/app/templates/assiduites/pages/signal_assiduites_group.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_group.j2 @@ -26,11 +26,9 @@ + {% if readonly == "false" %} {{timeline|safe}} - - - {% if readonly == "false" %}