blob: 8c4de98dd6cc54613339a97ddc8353ce0258d7a5 [file] [log] [blame]
Dani Vilardell21dacea2020-09-21 14:25:20 +02001<script type="text/javascript" src="./horaris.json"></script>
Dani Vilardell12518e22020-09-21 16:00:07 +02002<meta charset="utf-8">
Dani Vilardell21dacea2020-09-21 14:25:20 +02003
Andreu Huguet8d2e08f2020-09-17 14:15:23 +02004<html>
5 <head>
6 </head>
7 <body>
8 <h1>App de traçabilitat DAFME</h1>
Dani Vilardell21dacea2020-09-21 14:25:20 +02009 <h2 id = "assignatura"></h2>
Dani Vilardell21dacea2020-09-21 14:25:20 +020010 <h3 id = "aula"></h3>
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020011 <a href="#">No és així? Canvia-ho.</a>
12
13 <h2 id="hora">
14 <span id="inici"></span> -
15 <span id="fi"></span>
16 </h2>
17 <h3 id="data"></h3>
18 <a href="#">No és així? Canvia-ho.</a>
Dani Vilardell12518e22020-09-21 16:00:07 +020019
20 <form>
21 <label for="seient">Seient:</label><br>
22 <input type="text" id="seient" name="seient"><br>
23 </form>
24
25 <form id = "link" action = https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1063142948=S02>
26 <input type="submit" value="Continua"/>
27 </form>
28
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020029 <script>
Dani Vilardell12518e22020-09-21 16:00:07 +020030 //var linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1063142948=S03"
31 var linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform.entry.1063142948=S03"
32 //var linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1749141911=8:00"
33
Dani Vilardell21dacea2020-09-21 14:25:20 +020034 var mydata = JSON.parse(classes);
35
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020036 var hora_actual = new Date();
37 var minuts;
38
39 // Hora d'inici
40 hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts
41 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
42 document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
43
44 // Hora de fi
45 hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora
46 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
47 document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
48
49 // Data
50 var dia = hora_actual.getDate();
51 var mes = hora_actual.getMonth() + 1;
52 var any = hora_actual.getFullYear();
53 var data = dia.toString() + '/' + mes.toString() + '/' + any.toString();
Dani Vilardell21dacea2020-09-21 14:25:20 +020054
55 for (i = 0; i < mydata.length; i++) {
56 var h = mydata[i].hora.split(":");
57 if(h[0] == (hora_actual.getHours() - 1).toString()) {
58 console.log("trobat");
59 document.getElementById("assignatura").innerHTML = mydata[i].nom;
Dani Vilardell12518e22020-09-21 16:00:07 +020060 document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula;
61 linkOutput += "?entry.1063142948=" + mydata[i].aula;
Dani Vilardell21dacea2020-09-21 14:25:20 +020062 }
63 }
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020064 document.getElementById("data").innerHTML = data;
Dani Vilardell12518e22020-09-21 16:00:07 +020065 document.getElementById("link").action = linkOutput;
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020066 </script>
Dani Vilardell12518e22020-09-21 16:00:07 +020067
68
69
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020070 </body>
71</html>