forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -798,13 +798,16 @@ function estJourTravail(jour, nonWorkdays) {
|
||||
return !nonWorkdays.includes(d);
|
||||
}
|
||||
|
||||
function retourJourTravail(date) {
|
||||
function retourJourTravail(date, anti = true) {
|
||||
const jourMiliSecondes = 86400000; // 24 * 3600 * 1000 | H * s * ms
|
||||
let jour = date;
|
||||
let compte = 0;
|
||||
|
||||
while (!estJourTravail(jour, nonWorkDays) && compte++ < 7) {
|
||||
jour = new Date(jour - jourMiliSecondes);
|
||||
let temps = anti
|
||||
? jour - jourMiliSecondes
|
||||
: jour.valueOf() + jourMiliSecondes;
|
||||
jour = new Date(temps);
|
||||
}
|
||||
return jour;
|
||||
}
|
||||
@ -837,6 +840,17 @@ function dateCouranteEstTravaillee() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function jourSuivant(anti = false) {
|
||||
let date = $("#date").datepicker("getDate");
|
||||
|
||||
date = anti ? date.add(-1, "days") : date.add(1, "days");
|
||||
|
||||
const nouvelleDate = retourJourTravail(date, anti);
|
||||
|
||||
$("#date").datepicker("setDate", nouvelleDate);
|
||||
creerTousLesEtudiants(etuds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout de la visualisation des assiduités de la mini timeline
|
||||
* @param {HTMLElement} el l'élément survollé
|
||||
|
@ -153,8 +153,14 @@
|
||||
<div class="infos">
|
||||
<div class="infos-button">Groupes : {{grp|safe}}</div>
|
||||
<div>
|
||||
<button class="btn_date" onclick="jourSuivant(true)">
|
||||
⇤
|
||||
</button>
|
||||
<input type="text" name="date" id="date" class="datepicker" value="{{date}}">
|
||||
</div>
|
||||
<button class="btn_date" onclick="jourSuivant(false)">
|
||||
⇥
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div style="display: {{'none' if readonly == 'true' else 'block'}};">
|
||||
|
Loading…
Reference in New Issue
Block a user