forked from ScoDoc/ScoDoc
Assiduites : fix SignalAssiduiteDifferee: présentation #687
This commit is contained in:
parent
cd0b8b7ca9
commit
69eda90eea
@ -20,6 +20,14 @@
|
||||
<script>
|
||||
const etudsDefDem = {{ defdem | safe }}
|
||||
|
||||
const timeMorning = "{{ timeMorning | safe}}";
|
||||
const timeNoon = "{{ timeNoon | safe}}";
|
||||
const timeEvening = "{{ timeEvening | safe}}";
|
||||
|
||||
const defaultDates = {{ defaultDates | safe }}
|
||||
const nonWorkDays = [{{ nonworkdays| safe }}];
|
||||
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
[...document.querySelectorAll('.tr[etudid]')].forEach((a) => {
|
||||
try {
|
||||
@ -28,8 +36,33 @@
|
||||
a.classList.add(defdem);
|
||||
}
|
||||
} catch (_) { }
|
||||
})
|
||||
});
|
||||
|
||||
if (defaultDates != null) {
|
||||
defaultDates.forEach((dateString) => {
|
||||
|
||||
d = moment(dateString).weekday();
|
||||
|
||||
if (verifyNonWorkDays(d, nonWorkDays)) return;
|
||||
|
||||
matin = `${dateString}T${timeMorning}`;
|
||||
midi = `${dateString}T${timeNoon}`;
|
||||
soir = `${dateString}T${timeEvening}`;
|
||||
|
||||
console.log(matin, midi, soir)
|
||||
|
||||
createColumn(matin, midi);
|
||||
createColumn(midi, soir);
|
||||
});
|
||||
|
||||
updateAllCol();
|
||||
} else {
|
||||
createColumn();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -118,6 +118,8 @@
|
||||
window.forceModule = "{{ forcer_module }}"
|
||||
window.forceModule = window.forceModule == "True" ? true : false
|
||||
|
||||
createColumn();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -9,9 +9,8 @@
|
||||
|
||||
{% for etud in etudiants %}
|
||||
<div class="tr" etudid="{{etud.etudid}}">
|
||||
<div class="td sticky">
|
||||
<div class="td sticky etudinfo" id="row-{{etud.etudid}}">
|
||||
<span>{{etud.nomprenom}}</span>
|
||||
<img class="pdp-hover" src="" alt="No Img" etudid="{{etud.etudid}}">
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@ -40,6 +39,10 @@
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.tr[etudid] {
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
@ -72,13 +75,13 @@
|
||||
|
||||
.th,
|
||||
.td {
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
width: 225px;
|
||||
border: 1px solid #ddd;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.tr {
|
||||
@ -88,11 +91,17 @@
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
.td span {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.sticky {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background-color: #fafafa;
|
||||
border-right: 1px solid #ddd;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.mini-form {
|
||||
@ -120,7 +129,7 @@
|
||||
border-radius: 50%;
|
||||
right: -60px;
|
||||
top: calc(50% - 50px /2);
|
||||
background-color: #007BFF;
|
||||
background-color: #09c;
|
||||
color: white;
|
||||
border: none;
|
||||
outline: none;
|
||||
@ -133,13 +142,13 @@
|
||||
}
|
||||
|
||||
.th {
|
||||
background-color: #007BFF;
|
||||
background-color: #09c;
|
||||
color: white;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.th.error {
|
||||
background-color: crimson;
|
||||
background-color: #d71111;
|
||||
}
|
||||
|
||||
.tbody .tr:nth-child(even) {
|
||||
@ -219,7 +228,7 @@
|
||||
.th.error:hover .col-error {
|
||||
display: block;
|
||||
z-index: 2000;
|
||||
background-color: crimson;
|
||||
background-color: #d71111;
|
||||
width: 100%;
|
||||
min-height: 25%;
|
||||
bottom: -25%;
|
||||
@ -269,7 +278,7 @@
|
||||
currentDate = moment(currentDate).tz(TIMEZONE).format("YYYY-MM-DDTHH:mm");
|
||||
}
|
||||
|
||||
function createColumn() {
|
||||
function createColumn(dateStart = "", dateEnd = "") {
|
||||
let table = document.getElementById("studentTable");
|
||||
let th = document.createElement("div");
|
||||
th.classList.add("th", "error");
|
||||
@ -282,8 +291,8 @@
|
||||
<div class="btngroup" style="justify-content: flex-end;">
|
||||
<button class="closeCol" onclick="removeColumn(this)">x</button>
|
||||
</div>
|
||||
<input type="datetime-local" id="dateStart">
|
||||
<input type="datetime-local" id="dateEnd">
|
||||
<input type="datetime-local" id="dateStart" value="${dateStart}">
|
||||
<input type="datetime-local" id="dateEnd" value="${dateEnd}">
|
||||
{{moduleimpl_select|safe}}
|
||||
<div id="mass_action_${col_id}" class="mass">
|
||||
<input disabled="" type="radio" class="rbtn present" name="mass_action_${col_id}" value="present" onclick="massCol(this)">
|
||||
@ -300,8 +309,10 @@
|
||||
|
||||
|
||||
|
||||
const last = [...document.querySelectorAll("#dateStart")].pop();
|
||||
defaultDate(last);
|
||||
if (dateStart == "") {
|
||||
const last = [...document.querySelectorAll("#dateStart")].pop();
|
||||
defaultDate(last);
|
||||
}
|
||||
|
||||
try {
|
||||
const sl = th.querySelector('.dynaSelect');
|
||||
@ -614,7 +625,7 @@
|
||||
function updateAllCol() {
|
||||
const colIds = [...document.querySelectorAll("[col]")].map((col) => { return col.getAttribute('col') });
|
||||
colIds.forEach((colid) => {
|
||||
updateAssiduitesCol(colid);
|
||||
getAndUpdateCol(colid)
|
||||
})
|
||||
}
|
||||
|
||||
@ -1009,7 +1020,6 @@
|
||||
createColumn();
|
||||
});
|
||||
|
||||
createColumn();
|
||||
setEtuds();
|
||||
|
||||
document.querySelectorAll('.pdp-hover').forEach((el) => {
|
||||
|
@ -210,6 +210,7 @@ def signal_assiduites_etud():
|
||||
"js/assiduites.js",
|
||||
"libjs/moment.new.min.js",
|
||||
"libjs/moment-timezone.js",
|
||||
"js/etud_info.js",
|
||||
],
|
||||
cssstyles=[
|
||||
"css/assiduites.css",
|
||||
@ -880,6 +881,21 @@ def signal_assiduites_diff():
|
||||
group_ids: list[int] = request.args.get("group_ids", None)
|
||||
formsemestre_id: int = request.args.get("formsemestre_id", -1)
|
||||
date: str = request.args.get("jour", datetime.date.today().isoformat())
|
||||
|
||||
date_deb: str = request.args.get("date_deb")
|
||||
date_fin: str = request.args.get("date_fin")
|
||||
|
||||
semaine: str = request.args.get("semaine")
|
||||
|
||||
if semaine is not None:
|
||||
semaine = (
|
||||
f"{scu.annee_scolaire()}-W{semaine}" if "W" not in semaine else semaine
|
||||
)
|
||||
date_deb: datetime.date = datetime.datetime.strptime(
|
||||
semaine + "-1", "%Y-W%W-%w"
|
||||
)
|
||||
date_fin: datetime.date = date_deb + datetime.timedelta(days=6)
|
||||
|
||||
etudiants: list[dict] = []
|
||||
|
||||
titre = None
|
||||
@ -936,6 +952,7 @@ def signal_assiduites_diff():
|
||||
"js/assiduites.js",
|
||||
"libjs/moment.new.min.js",
|
||||
"libjs/moment-timezone.js",
|
||||
"js/etud_info.js",
|
||||
],
|
||||
)
|
||||
|
||||
@ -968,11 +985,35 @@ def signal_assiduites_diff():
|
||||
gr=gr_tit,
|
||||
sem=sem["titre_num"],
|
||||
defdem=_get_etuds_dem_def(formsemestre),
|
||||
timeMorning=ScoDocSiteConfig.get("assi_morning_time", "08:00:00"),
|
||||
timeNoon=ScoDocSiteConfig.get("assi_lunch_time", "13:00:00"),
|
||||
timeEvening=ScoDocSiteConfig.get("assi_evening_time", "18:00:00"),
|
||||
defaultDates=_get_days_between_dates(date_deb, date_fin),
|
||||
nonworkdays=_non_work_days(),
|
||||
),
|
||||
html_sco_header.sco_footer(),
|
||||
).build()
|
||||
|
||||
|
||||
def _get_days_between_dates(deb: str, fin: str):
|
||||
if deb is None or fin is None:
|
||||
return "null"
|
||||
try:
|
||||
if isinstance(deb, str) and isinstance(fin, str):
|
||||
date_deb: datetime.date = datetime.date.fromisoformat(deb)
|
||||
date_fin: datetime.date = datetime.date.fromisoformat(fin)
|
||||
else:
|
||||
date_deb, date_fin = deb.date(), fin.date()
|
||||
except ValueError:
|
||||
return "null"
|
||||
dates: list[str] = []
|
||||
while date_deb <= date_fin:
|
||||
dates.append(f'"{date_deb.isoformat()}"')
|
||||
date_deb = date_deb + datetime.timedelta(days=1)
|
||||
|
||||
return f"[{','.join(dates)}]"
|
||||
|
||||
|
||||
def _differee(
|
||||
etudiants, moduleimpl_select, date=None, periode=None, formsemestre_id=None
|
||||
):
|
||||
|
Loading…
Reference in New Issue
Block a user