forked from ScoDoc/DocScoDoc
71 lines
2.5 KiB
HTML
71 lines
2.5 KiB
HTML
<!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}})
|
|
[version {{formation.version}}] code {{formation.code}}</h2>
|
|
|
|
<div class="tableau"></div>
|
|
|
|
<script>
|
|
$(function () {
|
|
$.getJSON("{{data_source}}", function (data) {
|
|
build_table(data);
|
|
});
|
|
});
|
|
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);
|
|
}
|
|
);
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |