2021-11-12 22:17:46 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="fr">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<script src="/ScoDoc/static/jQuery/jquery.js"></script>
|
|
|
|
<script src="/ScoDoc/static/js/table_editor.js"></script>
|
|
|
|
<link href="/ScoDoc/static/css/table_editor.css" rel="stylesheet" type="text/css" />
|
|
|
|
<title>Édition coef. formation</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<h2>Formation {{formation.titre}} ({{formation.acronyme}})
|
2021-11-13 09:11:00 +01:00
|
|
|
[version {{formation.version}}] code {{formation.code}}</h2>
|
|
|
|
|
2021-11-12 22:17:46 +01:00
|
|
|
<div class="tableau"></div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(function () {
|
|
|
|
$.getJSON("{{data_source}}", function (data) {
|
|
|
|
build_table(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
function save(obj) {
|
2021-11-13 09:11:00 +01:00
|
|
|
var value = obj.innerText.trim();
|
|
|
|
if (value.length == 0) {
|
|
|
|
value = "0";
|
|
|
|
}
|
2021-11-13 09:43:13 +01:00
|
|
|
if (!/^[\d.,]+$/.test(value)) {
|
2021-11-13 09:11:00 +01:00
|
|
|
message("Il est attendu un nombre");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (value == obj.dataset.data) {
|
|
|
|
return true; // Aucune modification, pas d'enregistrement mais on continue normalement
|
2021-11-12 22:17:46 +01:00
|
|
|
}
|
2021-11-13 09:11:00 +01:00
|
|
|
obj.dataset.data = value;
|
|
|
|
obj.classList.add("wait");
|
2021-11-12 22:17:46 +01:00
|
|
|
// XXX DEBUG
|
2021-11-13 09:43:13 +01:00
|
|
|
// 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}
|
|
|
|
// `);
|
2021-11-12 22:17:46 +01:00
|
|
|
$.post("{{data_save}}",
|
|
|
|
{
|
2021-11-13 09:43:13 +01:00
|
|
|
module_id: obj.dataset.module_id,
|
|
|
|
ue_id: obj.dataset.ue_id,
|
|
|
|
coef: value
|
2021-11-12 22:17:46 +01:00
|
|
|
},
|
|
|
|
function (result) {
|
2021-11-13 09:11:00 +01:00
|
|
|
obj.classList.remove("wait");
|
2021-11-13 09:43:13 +01:00
|
|
|
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
|
2021-11-13 09:11:00 +01:00
|
|
|
// l'indication que c'est bon au bout d'un temps
|
2021-11-13 09:43:13 +01:00
|
|
|
//setTimeout(() => {
|
|
|
|
// obj.classList.remove("modified");
|
|
|
|
//}, 1000);
|
2021-11-12 22:17:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|