From 60998d2e2043ec294f2638abab0b4f0c706c3c8d Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Sat, 25 May 2024 18:12:44 +0200
Subject: [PATCH] Assiduite: bg bouton delete + dialog confirm

---
 app/static/css/assiduites.css                | 10 ++++++----
 app/static/js/assiduites.js                  | 13 ++++++++++---
 app/templates/assiduites/pages/bilan_dept.j2 |  2 +-
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/app/static/css/assiduites.css b/app/static/css/assiduites.css
index 32b49491..8ccd607c 100644
--- a/app/static/css/assiduites.css
+++ b/app/static/css/assiduites.css
@@ -302,7 +302,6 @@
 .rbtn {
   -webkit-appearance: none;
   appearance: none;
-
   cursor: pointer;
 }
 
@@ -327,9 +326,12 @@
   background-image: url(../icons/absent.svg);
 }
 
-.rbtn.aucun::before {
-  background-image: url(../icons/delete.svg);
-  background-color: var(--color-defaut-dark);
+.rbtn.aucun {
+  background-image: url("../icons/delete.svg");
+  background-size: calc(100% - 8px) calc(100% - 8px);
+  /* Adjust size to create "margin" */
+  background-position: center;
+  background-repeat: no-repeat;
 }
 
 .rbtn.retard::before {
diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js
index e22764b5..a9ded03c 100644
--- a/app/static/js/assiduites.js
+++ b/app/static/js/assiduites.js
@@ -53,7 +53,7 @@ async function async_get(path, success, errors) {
  * @param {CallableFunction} errors fonction à effectuer en cas d'échec
  */
 async function async_post(path, data, success, errors) {
-  console.log("async_post " + path);
+  // console.log("async_post " + path);
   let response;
   try {
     response = await fetch(path, {
@@ -643,6 +643,9 @@ function mettreToutLeMonde(etat, el = null) {
 
   // Suppression des assiduités
   if (etat == "vide") {
+    if (!confirm("Effacer tout les évènements correspondant à cette plage ?")) {
+      return; // annulation
+    }
     const assiduites_id = lignesEtuds
       .filter((e) => e.getAttribute("type") == "edition")
       .map((e) => Number(e.getAttribute("assiduite_id")));
@@ -759,6 +762,7 @@ function envoiToastEtudiant(etat, etud) {
   pushToast(generateToast(span, getToastColorFromEtat(etat.toUpperCase()), 5));
 }
 
+// TODO commenter toutes les fonctions js
 function envoiToastTous(etat, count) {
   const span = document.createElement("span");
   let etatAffiche = etat;
@@ -817,9 +821,12 @@ function dateCouranteEstTravaillee() {
   if (!estJourTravail(date, nonWorkDays)) {
     const nouvelleDate = retourJourTravail(date);
     $("#date").datepicker("setDate", nouvelleDate);
-
+    let msg = "Le jour sélectionné";
+    if ((new Date()).format("YYYY-MM-DD") == date.format("YYYY-MM-DD")) {
+      msg = "Aujourd'hui";
+    }
     const att = document.createTextNode(
-      `Le jour sélectionné (${Date.toFRA(
+      `${msg} (${Date.toFRA(
         date.format("YYYY-MM-DD")
       )}) n'est pas un jour travaillé.`
     );
diff --git a/app/templates/assiduites/pages/bilan_dept.j2 b/app/templates/assiduites/pages/bilan_dept.j2
index c66ff1f1..1407067c 100644
--- a/app/templates/assiduites/pages/bilan_dept.j2
+++ b/app/templates/assiduites/pages/bilan_dept.j2
@@ -12,7 +12,7 @@
 
 <h1>Traitement de l'assiduité</h1>
 <p class="help">
-Pour saisir l'assiduité ou consulter les états, il est recommandé de passer par
+Pour saisir l'assiduité ou consulter les états, passer par
 le semestre concerné (saisie par jour ou saisie différée).
 </p>
 
-- 
GitLab