2021-12-28 16:17:07 +01:00
|
|
|
{# -*- mode: jinja-html -*- #}
|
2022-03-15 23:09:41 +01:00
|
|
|
<h2>{% if not read_only %}Édition des c{% else %}C{%endif%}oefficients des modules vers les UEs</h2>
|
2021-11-18 22:46:18 +01:00
|
|
|
<div class="help">
|
2022-03-15 23:09:41 +01:00
|
|
|
{% if not read_only %}
|
2021-11-18 22:46:18 +01:00
|
|
|
Double-cliquer pour changer une valeur.
|
|
|
|
Les valeurs sont automatiquement enregistrées au fur et à mesure.
|
2022-03-15 23:09:41 +01:00
|
|
|
{% endif %}
|
|
|
|
|
2021-11-18 22:46:18 +01:00
|
|
|
</div>
|
|
|
|
<form class="semestre_selector">Semestre:
|
2021-11-18 11:29:38 +01:00
|
|
|
<select onchange="this.form.submit()"" name="semestre_idx" id="semestre_idx">
|
2021-11-17 10:28:51 +01:00
|
|
|
{% for i in semestre_ids %}
|
2021-11-18 00:24:56 +01:00
|
|
|
<option value="{{i}}" {%if semestre_idx==i%}selected{%endif%}>{{i}}</option>
|
2021-11-17 10:28:51 +01:00
|
|
|
{% endfor %}
|
2021-11-18 22:46:18 +01:00
|
|
|
<option value="" {%if semestre_idx is none%}selected{%endif%}>tous</option>
|
2021-11-17 10:28:51 +01:00
|
|
|
</select>
|
2021-11-18 11:29:38 +01:00
|
|
|
<input type="hidden" name="formation_id" value="{{formation.id}}"></input>
|
2021-11-18 00:24:56 +01:00
|
|
|
<span><a class="stdlink" href="{{
|
|
|
|
url_for('notes.ue_table', scodoc_dept=g.scodoc_dept,
|
|
|
|
formation_id=formation.id, semestre_idx=semestre_idx)
|
|
|
|
}}">revenir à la formation</a></span>
|
|
|
|
</form>
|
2021-11-17 10:28:51 +01:00
|
|
|
|
2021-11-18 00:24:56 +01:00
|
|
|
<div class="tableau"></div>
|
2021-11-12 22:17:46 +01:00
|
|
|
|
2021-11-18 00:24:56 +01:00
|
|
|
<script>
|
2022-03-15 23:09:41 +01:00
|
|
|
var read_only={{"true" if read_only else "false"}};
|
2021-11-18 00:24:56 +01:00
|
|
|
$(function () {
|
2021-11-18 22:46:18 +01:00
|
|
|
let data_url = "{{data_source}}";
|
|
|
|
$.getJSON(data_url, function (data) {
|
|
|
|
build_table(data);
|
|
|
|
});
|
2021-11-18 00:24:56 +01:00
|
|
|
});
|
|
|
|
function save(obj) {
|
|
|
|
var value = obj.innerText.trim();
|
|
|
|
if (value.length == 0) {
|
|
|
|
value = "0";
|
|
|
|
}
|
|
|
|
if (!/^[\d.,]+$/.test(value)) {
|
|
|
|
message("Il est attendu un nombre");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (value == obj.dataset.data) {
|
|
|
|
return true; // Aucune modification, pas d'enregistrement mais on continue normalement
|
|
|
|
}
|
|
|
|
obj.dataset.data = value;
|
|
|
|
obj.classList.add("wait");
|
|
|
|
// XXX DEBUG
|
|
|
|
// console.log(`
|
|
|
|
// x : ${getComputedStyle(obj).getPropertyValue("--x")}
|
|
|
|
// y : ${getComputedStyle(obj).getPropertyValue("--y")}
|
|
|
|
// data : ${value}
|
|
|
|
// ue_id: ${obj.dataset.ue_id}
|
|
|
|
// module_id : ${obj.dataset.module_id}
|
|
|
|
// `);
|
|
|
|
$.post("{{data_save}}",
|
|
|
|
{
|
|
|
|
module_id: obj.dataset.module_id,
|
|
|
|
ue_id: obj.dataset.ue_id,
|
|
|
|
coef: value
|
|
|
|
},
|
|
|
|
function (result) {
|
|
|
|
obj.classList.remove("wait");
|
|
|
|
if (obj.dataset.orig != value)
|
|
|
|
obj.classList.add("modified");
|
|
|
|
else
|
|
|
|
obj.classList.remove("modified");
|
|
|
|
// Lorsque les données sont bien enregistrées, on enlève
|
|
|
|
// l'indication que c'est bon au bout d'un temps
|
|
|
|
//setTimeout(() => {
|
|
|
|
// obj.classList.remove("modified");
|
|
|
|
//}, 1000);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
</script>
|