1
0
forked from ScoDoc/ScoDoc
ScoDoc/app/templates/assiduites/pages/bilan_dept.j2

187 lines
4.8 KiB
Plaintext
Raw Normal View History

2023-06-28 17:15:24 +02:00
{% include "assiduites/widgets/tableau_base.j2" %}
<section class="alerte invisible">
<p>Attention, cet étudiant a trop d'absences</p>
</section>
<section class="nonvalide">
<!-- Tableaux des justificatifs à valider (attente / modifié ) -->
<h4>Justificatifs en attente (ou modifiés)</h4>
2023-09-15 09:13:25 +02:00
<span class="iconline">
<a class="icon filter" onclick="filterJusti(true)"></a>
<a class="icon download" onclick="downloadJusti()"></a>
</span>
2023-06-28 17:15:24 +02:00
{% include "assiduites/widgets/tableau_justi.j2" %}
</section>
<div class="annee">
<span>Année scolaire 2022-2023 Changer année: </span>
<select name="" id="annee" onchange="setterAnnee(this.value)">
</select>
</div>
<div class="legende">
2023-06-30 14:38:56 +02:00
<h3>Gestion des justificatifs</h3>
<p>
Faites
<span style="font-style: italic;">clic droit</span> sur une ligne du tableau pour afficher le menu contextuel :
<ul>
<li>Détails : Affiche les détails du justificatif sélectionné</li>
<li>Editer : Permet de modifier le justificatif (dates, etat, ajouter/supprimer fichier etc)</li>
<li>Supprimer : Permet de supprimer le justificatif (Action Irréversible)</li>
</ul>
</p>
2023-06-28 17:15:24 +02:00
</div>
<script>
let formsemestre_id = "{{formsemestre_id}}"
let group_id = "{{group_id}}"
2023-06-28 17:15:24 +02:00
function getDeptJustificatifsFromPeriod(action) {
const formsemestre = formsemestre_id ? `&formsemestre_id=${formsemestre_id}` : ""
const group = group_id ? `&group_id=${group_id}` : ""
const path = getUrl() + `/api/justificatifs/dept/${dept_id}/query?date_debut=${bornes.deb}&date_fin=${bornes.fin}&etat=attente,modifie${formsemestre}${group}`
2023-06-28 17:15:24 +02:00
async_get(
path,
(data, status) => {
2023-09-15 09:13:25 +02:00
if (action) {
action(data)
} else {
justificatifCallBack(data);
}
2023-06-28 17:15:24 +02:00
},
(data, status) => {
console.error(data, status)
errorAlert();
2023-06-28 17:15:24 +02:00
}
)
}
function generate(annee) {
if (annee < 1999 || annee > 2999) {
openAlertModal("Année impossible", document.createTextNode("L'année demandé n'existe pas."));
return;
}
bornes = {
deb: `${annee}-09-01T00:00`,
2023-09-12 09:37:03 +02:00
fin: `${annee + 1}-08-31T23:59`
2023-06-28 17:15:24 +02:00
}
defAnnee = annee;
2023-09-15 10:51:40 +02:00
loadAll();
}
2023-06-28 17:15:24 +02:00
2023-09-15 10:51:40 +02:00
function getJusti(action) {
try { getDeptJustificatifsFromPeriod(action) } catch (_) { }
2023-06-28 17:15:24 +02:00
}
function setterAnnee(annee) {
annee = parseInt(annee);
document.querySelector('.annee span').textContent = `Année scolaire ${annee}-${annee + 1} Changer année: `
generate(annee)
}
let defAnnee = {{ annee }};
let bornes = {
deb: `${defAnnee}-09-01T00:00`,
2023-09-12 09:37:03 +02:00
fin: `${defAnnee + 1}-08-31T23:59`
2023-06-28 17:15:24 +02:00
}
const dept_id = {{ dept_id }};
2023-09-12 09:37:03 +02:00
let annees = {{ annees | safe}}
annees = annees.filter((x, i) => annees.indexOf(x) === i)
2023-06-28 17:15:24 +02:00
window.addEventListener('load', () => {
filterJustificatifs = {
"columns": [
"formsemestre",
2023-06-28 17:15:24 +02:00
"etudid",
"entry_date",
"date_debut",
"date_fin",
"etat",
"raison",
"fichier"
],
"filters": {
"etat": [
"attente",
"modifie"
],
2023-06-28 17:15:24 +02:00
}
}
const select = document.querySelector('#annee');
2023-09-12 09:37:03 +02:00
annees.forEach((a) => {
2023-06-28 17:15:24 +02:00
const opt = document.createElement("option");
2023-09-12 09:37:03 +02:00
opt.value = a + "",
opt.textContent = `${a} - ${a + 1}`;
if (a === defAnnee) {
2023-06-28 17:15:24 +02:00
opt.selected = true;
}
select.appendChild(opt)
2023-09-12 09:37:03 +02:00
})
2023-06-28 17:15:24 +02:00
setterAnnee(defAnnee)
})
</script>
<style>
.stats-values-item {
display: flex;
justify-content: space-evenly;
align-items: center;
flex-direction: column;
}
.stats {
border: 1px solid #333;
padding: 5px 2px;
width: fit-content;
}
.stats-values {
display: flex;
justify-content: flex-start;
gap: 15px;
}
.stats-values-item h5 {
font-weight: bold;
text-decoration-line: underline;
}
.stats-values-part {
display: flex;
flex-direction: column;
}
.alerte {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
margin: 5px 0;
border-radius: 7px;
background-color: crimson;
}
.alerte.invisible {
display: none;
}
.alerte p {
font-size: larger;
color: whitesmoke;
}
.suppr {
margin: 5px 0;
}
</style>