From 967c8a91c578f003a691e78471ff5ca3b81f19a6 Mon Sep 17 00:00:00 2001 From: lehmann Date: Thu, 28 Dec 2023 21:23:37 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Partition=20editor=20:=20am=C3=A9lioration?= =?UTF-8?q?=20ordonnanceur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/partition_editor.css | 39 +++++++++++++++++++----- app/templates/scolar/partition_editor.j2 | 9 ++++-- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/app/static/css/partition_editor.css b/app/static/css/partition_editor.css index e7abd0c29..95e2e65f6 100644 --- a/app/static/css/partition_editor.css +++ b/app/static/css/partition_editor.css @@ -212,16 +212,21 @@ body.editionActivated .filtres>div>div>div>div { pointer-events: none; } -.grabbing>div[data-idpartition]:not([data-idgroupe]):hover:before { +.grabbing>.hidenDropZone { + pointer-events: auto !important; +} + +.grabbing>div[data-idpartition]:not([data-idgroupe]):hover:before, +.grabbing>.hidenDropZone:hover:before { content: ""; position: absolute; - left: -4px; - right: -4px; - bottom: calc(100% + 1px); - height: 2px; - width: auto; + left: -4px !important; + right: -4px !important; + bottom: calc(100% + 1px) !important; + height: 2px !important; + width: auto !important; background: #c44; - animation: insertPartion 0.2s infinite alternate ease-in-out; + animation: insertPartion 0.2s infinite alternate ease-in-out !important; } @keyframes insertPartion { @@ -283,6 +288,7 @@ body.editionActivated .filtres>div>div>div>div { #zonePartitions .filtres { width: fit-content; + position: relative; } #zonePartitions .filtres>div { @@ -332,6 +338,23 @@ body.editionActivated .filtres>div>div>div>div { margin: 4px 0 0 0; } +#zonePartitions .filtres .groupes>button { + transition: none; + position: relative; + overflow: visible; + outline: none; + border: none; +} + +#zonePartitions .filtres .hidenDropZone { + height: 100px; + position: absolute; + left: 0; + right: 0; + pointer-events: none; + background: transparent; +} + #zonePartitions .filtres .groupes>div { position: relative; background: #09c; @@ -356,7 +379,7 @@ body:not(.editionActivated) .filtres .groupes>div:active { } body.editionActivated .filtres [data-idgroupe=aucun] { - display: none; + display: none !important; } body.editionActivated .filtres .nonEditable .move { diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index b524a6fb9..7a99ca1d4 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -114,7 +114,7 @@ arrayPartitions.forEach((partition) => { let divPartition = templateFiltres_partition(partition); - divFiltres.appendChild(divPartition); + divFiltres.append(divPartition); let arrayGroups = Object.values(partition.groups).sort((a, b) => { return a.numero - b.numero; @@ -146,6 +146,9 @@ `; }) + let hiden = document.createElement("div"); + hiden.className = "hidenDropZone"; + divFiltres.append(hiden); document.querySelector("#zoneGroupes>.groupes").innerHTML = outputGroupes; /* Etudiants */ @@ -275,7 +278,7 @@ function listeGroupesAutoaffectation() { let output = ''; - document.querySelectorAll('#zonePartitions .filtres>div').forEach(partition => { + document.querySelectorAll('#zonePartitions .filtres>[data-idpartition]').forEach(partition => { output += ` @@ -868,7 +871,7 @@ }) // Save positions - if (this.dataset.idpartition) { + if (this.dataset.idpartition || this.classList.contains("hidenDropZone")) { let params = (new URL(document.location)).searchParams; let formsemestre_id = params.get('formsemestre_id'); var url = `/ScoDoc/{{formsemestre.departement.acronym}}/api/formsemestre/${formsemestre_id}/partitions/order`; From 2ac442315c57193a9ae9355fc903ff49ab9e00f4 Mon Sep 17 00:00:00 2001 From: lehmann Date: Thu, 28 Dec 2023 22:43:35 +0100 Subject: [PATCH 2/3] Edit id EDT --- app/static/css/partition_editor.css | 9 ++- app/templates/scolar/partition_editor.j2 | 72 +++++++++++++++++++++++- 2 files changed, 75 insertions(+), 6 deletions(-) diff --git a/app/static/css/partition_editor.css b/app/static/css/partition_editor.css index 95e2e65f6..912f0d16d 100644 --- a/app/static/css/partition_editor.css +++ b/app/static/css/partition_editor.css @@ -91,9 +91,6 @@ body:not(.editionActivated) .editing { .nonEditable .editing { display: none; } -.nonEditable .editing.rename { - display: inline; -} .editionActivated #zoneChoix, @@ -344,6 +341,7 @@ body.editionActivated .filtres>div>div>div>div { overflow: visible; outline: none; border: none; + text-shadow: none !important; } #zonePartitions .filtres .hidenDropZone { @@ -365,6 +363,11 @@ body.editionActivated .filtres>div>div>div>div { box-shadow: 0 2px 2px rgba(0, 0, 0, 0.25); } +#zonePartitions .filtres .actif { + background: #0c9; + border-radius: 6px; +} + body:not(.editionActivated) .filtres .groupes>div { cursor: pointer; } diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index 7a99ca1d4..67b25a1b5 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -250,15 +250,23 @@ let div = document.createElement("button"); div.classList.add("dt-button"); div.dataset.idgroupe = groupe.id; - let edt_id_str = groupe.edt_id ? `[${groupe.edt_id}]` : ""; + div.dataset.idedt = groupe.edt_id || ""; + let title_EDT = groupe.edt_id || ""; div.innerHTML = ` || - ${groupe.group_name} ${edt_id_str} - ✏️ + ${groupe.group_name} + ✏️ + 📅 `; + if (title_EDT) { + div.querySelector(".calendarEdit").classList.add("actif"); + } + div.addEventListener("click", filtre); div.querySelector(".move").addEventListener("mousedown", moveStart); + div.querySelector(".rename").addEventListener("click", editText); + div.querySelector(".calendarEdit").addEventListener("click", editCalendar); div.querySelector(".suppr").addEventListener("click", suppr); return div; @@ -758,6 +766,64 @@ }) } + /***********************/ + /* Edition de l'id_EDT */ + /***********************/ + function editCalendar() { + + let data = `data-idgroupe="${this.parentElement.dataset.idgroupe}"`; + let nom = this.previousElementSibling.previousElementSibling.innerText; + let id_EDT = this.parentElement.dataset.idedt; + + let div = document.createElement("div"); + div.className = "confirm"; + div.innerHTML = ` +
+

Modifier l'id EDT du groupe ${nom}

+ + +

Optionnel : identifiant du groupe dans le logiciel d'emploi du temps, pour le cas où les noms de groupes ne seraient pas les mêmes dans ScoDoc et dans l'emploi du temps (si plusieurs ids de groupes EDT doivent correspondre au même groupe ScoDoc, les séparer par des virgules).

+ +
+
Valider
+
Annuler
+
+
+ `; + document.body.append(div); + document.querySelector(".ok").addEventListener("click", editCalConfirm); + document.querySelector(".nok").addEventListener("click", closeConfirm); + } + + function editCalConfirm() { + let idGroupe = this.dataset.idgroupe; + let id_EDT = this.parentElement.parentElement.querySelector("input").value; + + let btnGroupe = document.querySelector(`#zonePartitions .groupes [data-idgroupe="${idGroupe}"]`); + btnGroupe.dataset.idedt = id_EDT; + btnGroupe.querySelector(".calendarEdit").title = id_EDT || ""; + + if (id_EDT) { + btnGroupe.querySelector(".calendarEdit").classList.add("actif"); + } else { + btnGroupe.querySelector(".calendarEdit").classList.remove("actif"); + } + + //Save + let url = ""; // A MODIFIER et décommenter ci-dessous + // Dispo en variables idGroupe et id_EDT + + /*fetch(url, { method: "POST" }) + .then(r => { return r.json() }) + .then(r => { + if (r.OK != true) { + document.querySelector("main").innerHTML = "

Une erreur s'est produite lors de la sauvegarde des données (5).

"; + } + });*/ + + closeConfirm(); + } + /*********************************/ /* Suppression parcours / groupe */ /*********************************/ From e11101b53bb6a2c1d0b2f1da1768352565f0293d Mon Sep 17 00:00:00 2001 From: lehmann Date: Thu, 28 Dec 2023 22:49:28 +0100 Subject: [PATCH 3/3] Route id EDT --- app/templates/scolar/partition_editor.j2 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index 67b25a1b5..dbd58d17e 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -810,16 +810,15 @@ } //Save - let url = ""; // A MODIFIER et décommenter ci-dessous - // Dispo en variables idGroupe et id_EDT - - /*fetch(url, { method: "POST" }) + let url = `/ScoDoc/{{formsemestre.departement.acronym}}/api/group/${idGroupe}/set_edt_id/${id_EDT}`; + + fetch(url, { method: "POST" }) .then(r => { return r.json() }) .then(r => { if (r.OK != true) { document.querySelector("main").innerHTML = "

Une erreur s'est produite lors de la sauvegarde des données (5).

"; } - });*/ + }); closeConfirm(); }