Assiduites : Calendrier date_pivot

This commit is contained in:
Iziram 2023-11-22 15:53:25 +01:00
parent 33c9a606b0
commit 38ba20aef6
2 changed files with 17 additions and 2 deletions

View File

@ -1476,3 +1476,14 @@ def is_assiduites_module_forced(
except (TypeError, ValueError):
retour = sco_preferences.get_preference("forcer_module", dept_id=dept_id)
return retour
def get_assiduites_time_config(config_type: str) -> str:
from app.models import ScoDocSiteConfig
match config_type:
case "matin":
return ScoDocSiteConfig.get("assi_morning_time", "08:00:00")
case "aprem":
return ScoDocSiteConfig.get("assi_afternoon_time", "18:00:00")
case "pivot":
return ScoDocSiteConfig.get("assi_lunch_time", "13:00:00")

View File

@ -343,6 +343,9 @@
</style>
<script>
const datePivot = "{{scu.get_assiduites_time_config("pivot")}}".split(":").map((el) => Number(el))
function getDaysBetweenDates(start, end) {
let now = new Date(start);
end = new Date(end);
@ -476,7 +479,7 @@
const matin = [new Date(date), new Date(date)]
color = "sans_etat"
matin[0].setHours(0, 0, 0, 0)
matin[1].setHours(12, 59, 59) // TODO Utiliser heure pivot (config)
matin[1].setHours(...datePivot)
@ -515,7 +518,8 @@
span_aprem.classList.add("color");
const aprem = [new Date(date), new Date(date)]
color = "sans_etat"
aprem[0].setHours(13, 0, 0, 0) // TODO Utiliser heure pivot (config)
aprem[0].setHours(...datePivot)
aprem[0].add(1, "seconds")
aprem[1].setHours(23, 59, 59)