blob: 77da1e43c5d7b02233c122ade8edd849c21449d7 [file] [log] [blame]
<script type="text/javascript" src="./horaris.json"></script>
<script type="text/javascript" src="./autocomplete.js"></script>
<meta charset="utf-8">
<html>
<head>
</head>
<link rel="stylesheet" href="autocomplete.css">
<body>
<h1>App de traçabilitat DAFME</h1>
<h2 id = "assignatura"></h2>
<h3 id = "aula"></h3>
<a href="#">No és així? Canvia-ho.</a>
<h2 id="hora">
<span id="inici"></span> -
<span id="fi"></span>
</h2>
<h3 id="data"></h3>
<a href="#">No és així? Canvia-ho.</a>
<form>
<label for="seient">Seient:</label><br>
<input type="text" id="seient" name="seient"><br>
</form>
<form autocomplete="off" action="/action_page.php">
<div class="autocomplete" style="width:300px;">
<input id="myInput" type="text" name="mySubject" placeholder="Subject">
</div>
<input type="submit">
</form>
<form id = "link" action = https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1063142948=S02>
<input type="submit" value="Continua"/>
</form>
<script>
var subjects = ["Calcul 1", "Calcul 2", "Algebra Lineal", "Geometria", "Numerica", "EDOS"];
autocomplete(document.getElementById("myInput"), subjects);
var linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform"
var mydata = JSON.parse(classes);
var hora_actual = new Date();
var minuts;
// Hora d'inici
hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts
minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
// Hora de fi
hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora
minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
// Data
var dia = hora_actual.getDate();
var mes = hora_actual.getMonth() + 1;
var any = hora_actual.getFullYear();
var data = dia.toString() + '/' + mes.toString() + '/' + any.toString();
for (i = 0; i < mydata.length; i++) {
var h = mydata[i].hora.split(":");
if(h[0] == (hora_actual.getHours() - 5).toString()) {
console.log("trobat");
document.getElementById("assignatura").innerHTML = mydata[i].nom;
document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula;
var datamap=[
"entry.1063142948=" + mydata[i].aula,
"entry.1749141911=" + (hora_actual.getHours().toString() - 11) +":00",
"entry.1827359679=" + (hora_actual.getHours().toString() - 10) +":00",
"entry.2115504093=" + data
];
var linkOutput = linkOutput+"?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0];
}
}
document.getElementById("data").innerHTML = data;
document.getElementById("link").action = linkOutput;
console.log(document.getElementById("link").action);
</script>
</body>
</html>