blob: 77da1e43c5d7b02233c122ade8edd849c21449d7 [file] [log] [blame]
Dani Vilardell21dacea2020-09-21 14:25:20 +02001<script type="text/javascript" src="./horaris.json"></script>
Dani Vilardelld4bfb752020-09-21 21:32:55 +02002<script type="text/javascript" src="./autocomplete.js"></script>
Dani Vilardell12518e22020-09-21 16:00:07 +02003<meta charset="utf-8">
Dani Vilardell21dacea2020-09-21 14:25:20 +02004
Andreu Huguet8d2e08f2020-09-17 14:15:23 +02005<html>
6 <head>
7 </head>
Dani Vilardelld4bfb752020-09-21 21:32:55 +02008 <link rel="stylesheet" href="autocomplete.css">
Andreu Huguet8d2e08f2020-09-17 14:15:23 +02009 <body>
10 <h1>App de traçabilitat DAFME</h1>
Dani Vilardell21dacea2020-09-21 14:25:20 +020011 <h2 id = "assignatura"></h2>
Dani Vilardell21dacea2020-09-21 14:25:20 +020012 <h3 id = "aula"></h3>
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020013 <a href="#">No és així? Canvia-ho.</a>
14
15 <h2 id="hora">
16 <span id="inici"></span> -
17 <span id="fi"></span>
18 </h2>
19 <h3 id="data"></h3>
20 <a href="#">No és així? Canvia-ho.</a>
Dani Vilardell12518e22020-09-21 16:00:07 +020021
22 <form>
23 <label for="seient">Seient:</label><br>
24 <input type="text" id="seient" name="seient"><br>
25 </form>
26
Dani Vilardelld4bfb752020-09-21 21:32:55 +020027 <form autocomplete="off" action="/action_page.php">
28 <div class="autocomplete" style="width:300px;">
29 <input id="myInput" type="text" name="mySubject" placeholder="Subject">
30 </div>
31 <input type="submit">
32 </form>
33
Dani Vilardell12518e22020-09-21 16:00:07 +020034 <form id = "link" action = https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1063142948=S02>
35 <input type="submit" value="Continua"/>
36 </form>
37
Dani Vilardell12518e22020-09-21 16:00:07 +020038
Dani Vilardelld4bfb752020-09-21 21:32:55 +020039
40 <script>
41
42 var subjects = ["Calcul 1", "Calcul 2", "Algebra Lineal", "Geometria", "Numerica", "EDOS"];
43
44 autocomplete(document.getElementById("myInput"), subjects);
45
46 var linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform"
47
Dani Vilardell21dacea2020-09-21 14:25:20 +020048 var mydata = JSON.parse(classes);
49
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020050 var hora_actual = new Date();
51 var minuts;
52
53 // Hora d'inici
54 hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts
55 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
56 document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
57
58 // Hora de fi
59 hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora
60 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
61 document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
62
63 // Data
64 var dia = hora_actual.getDate();
65 var mes = hora_actual.getMonth() + 1;
66 var any = hora_actual.getFullYear();
67 var data = dia.toString() + '/' + mes.toString() + '/' + any.toString();
Dani Vilardell21dacea2020-09-21 14:25:20 +020068
69 for (i = 0; i < mydata.length; i++) {
70 var h = mydata[i].hora.split(":");
Dani Vilardelld4bfb752020-09-21 21:32:55 +020071 if(h[0] == (hora_actual.getHours() - 5).toString()) {
Dani Vilardell21dacea2020-09-21 14:25:20 +020072 console.log("trobat");
73 document.getElementById("assignatura").innerHTML = mydata[i].nom;
Dani Vilardell12518e22020-09-21 16:00:07 +020074 document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula;
Dani Vilardelld4bfb752020-09-21 21:32:55 +020075
76 var datamap=[
77 "entry.1063142948=" + mydata[i].aula,
78 "entry.1749141911=" + (hora_actual.getHours().toString() - 11) +":00",
79 "entry.1827359679=" + (hora_actual.getHours().toString() - 10) +":00",
80 "entry.2115504093=" + data
81 ];
82 var linkOutput = linkOutput+"?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0];
Dani Vilardell21dacea2020-09-21 14:25:20 +020083 }
84 }
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020085 document.getElementById("data").innerHTML = data;
Dani Vilardell12518e22020-09-21 16:00:07 +020086 document.getElementById("link").action = linkOutput;
Dani Vilardelld4bfb752020-09-21 21:32:55 +020087 console.log(document.getElementById("link").action);
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020088 </script>
Dani Vilardell12518e22020-09-21 16:00:07 +020089
90
91
Andreu Huguet8d2e08f2020-09-17 14:15:23 +020092 </body>
93</html>