Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 1 | <script type="text/javascript" src="./horaris.json"></script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame^] | 2 | <meta charset="utf-8"> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 3 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 4 | <html> |
| 5 | <head> |
| 6 | </head> |
| 7 | <body> |
| 8 | <h1>App de traçabilitat DAFME</h1> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 9 | <h2 id = "assignatura"></h2> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 10 | <h3 id = "aula"></h3> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 11 | <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 Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame^] | 19 | |
| 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 Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 29 | <script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame^] | 30 | //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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 34 | var mydata = JSON.parse(classes); |
| 35 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 36 | 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 Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 54 | |
| 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 Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame^] | 60 | document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula; |
| 61 | linkOutput += "?entry.1063142948=" + mydata[i].aula; |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 62 | } |
| 63 | } |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 64 | document.getElementById("data").innerHTML = data; |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame^] | 65 | document.getElementById("link").action = linkOutput; |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 66 | </script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame^] | 67 | |
| 68 | |
| 69 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 70 | </body> |
| 71 | </html> |