From c2a78073e50e5545362404baf3b5bcc1be6f9726 Mon Sep 17 00:00:00 2001 From: iziram Date: Wed, 19 Apr 2023 17:35:48 +0200 Subject: [PATCH] =?UTF-8?q?Assiduites=20:=20modification=20styles=20(propo?= =?UTF-8?q?sition=20S=C3=A9bastien=20Lehmann)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/assiduites.css | 26 +++++++------ app/static/js/assiduites.js | 47 ++++++++++++++++-------- app/templates/assiduites/minitimeline.j2 | 13 ++++--- 3 files changed, 53 insertions(+), 33 deletions(-) diff --git a/app/static/css/assiduites.css b/app/static/css/assiduites.css index eb6086a7..eb6e243e 100644 --- a/app/static/css/assiduites.css +++ b/app/static/css/assiduites.css @@ -87,19 +87,16 @@ .etud_row { display: grid; - grid-template-columns: 10% 20% 30% 30%; - gap: 3.33%; - + grid-template-columns: auto auto 1fr auto; + gap: 16px; background-color: white; border-radius: 15px; - width: 80%; - height: 50px; - + padding: 4px 16px; margin: 0.5% 0; - box-shadow: -1px 12px 5px -8px rgba(68, 68, 68, 0.61); -webkit-box-shadow: -1px 12px 5px -8px rgba(68, 68, 68, 0.61); -moz-box-shadow: -1px 12px 5px -8px rgba(68, 68, 68, 0.61); + max-width: 800px; } .etud_row * { @@ -142,10 +139,15 @@ font-size: x-small; } +.etud_row .pdp { + border-radius: 15px; +} + /* --- Barre assiduités --- */ .etud_row .assiduites_bar { - display: flex; - flex-wrap: wrap; + display: grid; + grid-template-columns: 7px 1fr; + gap: 13px; grid-column: 3; position: relative; } @@ -179,15 +181,15 @@ } .etud_row .assiduites_bar .absent { - background-color: #ec5c49 !important; + background-color: #F1A69C !important; } .etud_row .assiduites_bar .present { - background-color: #37f05f !important; + background-color: #9CF1AF !important; } .etud_row .assiduites_bar .retard { - background-color: #ecb52a !important; + background-color: #F1D99C !important; } diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index e7d02771..0252013d 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -1039,6 +1039,7 @@ function insertEtudRow(etud, index, output = false) { * @returns {HTMLElement} l'élément correspondant à la mini timeline */ function createMiniTimeline(assiduitesArray) { + const array = [...assiduitesArray]; const dateiso = document.getElementById("tl_date").value; const timeline = document.createElement("div"); timeline.className = "mini-timeline"; @@ -1050,7 +1051,17 @@ function createMiniTimeline(assiduitesArray) { const dayEnd = timelineDate.clone().add(18, "hours"); const dayDuration = moment.duration(dayEnd.diff(dayStart)).asMinutes(); - assiduitesArray.forEach((assiduité) => { + const tlTimes = getTimeLineTimes(); + + const period_assi = { + date_debut: tlTimes.deb.format(), + date_fin: tlTimes.fin.format(), + etat: "CRENEAU", + }; + + array.push(period_assi); + + array.forEach((assiduité) => { const startDate = moment(assiduité.date_debut); const endDate = moment(assiduité.date_fin); @@ -1073,21 +1084,22 @@ function createMiniTimeline(assiduitesArray) { block.style.left = `${leftPercentage}%`; block.style.width = `${widthPercentage}%`; - if (isSingleEtud()) { - block.addEventListener("click", () => { - let deb = startDate.hours() + startDate.minutes() / 60; - let fin = endDate.hours() + endDate.minutes() / 60; - deb = Math.max(8, deb); - fin = Math.min(18, fin); + if (assiduité.etat != "CRENEAU") { + if (isSingleEtud()) { + block.addEventListener("click", () => { + let deb = startDate.hours() + startDate.minutes() / 60; + let fin = endDate.hours() + endDate.minutes() / 60; + deb = Math.max(8, deb); + fin = Math.min(18, fin); - setPeriodValues(deb, fin); - updateSelectedSelect(getCurrentAssiduiteModuleImplId()); - }); + setPeriodValues(deb, fin); + updateSelectedSelect(getCurrentAssiduiteModuleImplId()); + }); + } + //ajouter affichage assiduites on over + setupAssiduiteBuble(block, assiduité); } - //ajouter affichage assiduites on over - setupAssiduiteBuble(block, assiduité); - switch (assiduité.etat) { case "PRESENT": block.classList.add("present"); @@ -1098,6 +1110,9 @@ function createMiniTimeline(assiduitesArray) { case "ABSENT": block.classList.add("absent"); break; + case "CRENEAU": + block.classList.add("creneau"); + break; default: block.style.backgroundColor = "white"; } @@ -1391,11 +1406,11 @@ function getTopPosition(container, start, end) { function getColor(state) { switch (state) { case "PRESENT": - return "#37f05f"; + return "#9CF1AF"; case "ABSENT": - return "#ec5c49"; + return "#F1A69C"; case "RETARD": - return "#ecb52a"; + return "#F1D99C"; default: return "gray"; } diff --git a/app/templates/assiduites/minitimeline.j2 b/app/templates/assiduites/minitimeline.j2 index 4800e71a..27f30b40 100644 --- a/app/templates/assiduites/minitimeline.j2 +++ b/app/templates/assiduites/minitimeline.j2 @@ -53,24 +53,22 @@ } .assiduite-bubble.absent { - border-color: #ec5c49 !important; + border-color: #F1A69C !important; } .assiduite-bubble.present { - border-color: #37f05f !important; + border-color: #9CF1AF !important; } .assiduite-bubble.retard { - border-color: #ecb52a !important; + border-color: #F1D99C !important; } .mini-timeline { height: 7px; - width: 90%; border: 1px solid black; position: relative; background-color: white; - overflow: hidden; } .mini-timeline.single { @@ -102,4 +100,9 @@ bottom: -2px; z-index: 2; } + + .mini-timeline-block.creneau { + outline: 3px solid #7059FF; + pointer-events: none; + } \ No newline at end of file