Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 1 | <script type="text/javascript" src="./horaris.json"></script> |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 2 | <script type="text/javascript" src="./autocomplete.js"></script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 3 | <meta charset="utf-8"> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 4 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 5 | <html> |
| 6 | <head> |
| 7 | </head> |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 8 | <link rel="stylesheet" href="autocomplete.css"> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 9 | <body> |
| 10 | <h1>App de traçabilitat DAFME</h1> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 11 | <h2 id = "assignatura"></h2> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 12 | <h3 id = "aula"></h3> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 13 | <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 Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 21 | |
| 22 | <form> |
| 23 | <label for="seient">Seient:</label><br> |
| 24 | <input type="text" id="seient" name="seient"><br> |
| 25 | </form> |
| 26 | |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 27 | <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 Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 34 | <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 Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 38 | |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 39 | |
| 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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 48 | var mydata = JSON.parse(classes); |
| 49 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 50 | 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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 68 | |
| 69 | for (i = 0; i < mydata.length; i++) { |
| 70 | var h = mydata[i].hora.split(":"); |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 71 | if(h[0] == (hora_actual.getHours() - 5).toString()) { |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 72 | console.log("trobat"); |
| 73 | document.getElementById("assignatura").innerHTML = mydata[i].nom; |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 74 | document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula; |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 75 | |
| 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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 83 | } |
| 84 | } |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 85 | document.getElementById("data").innerHTML = data; |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 86 | document.getElementById("link").action = linkOutput; |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame^] | 87 | console.log(document.getElementById("link").action); |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 88 | </script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 89 | |
| 90 | |
| 91 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 92 | </body> |
| 93 | </html> |