Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 1 | <!DOCTYPE html> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 2 | <script type="text/javascript" src="./horaris.json"></script> |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 3 | <script type="text/javascript" src="./autocomplete.js"></script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 4 | <meta charset="utf-8"> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 5 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 6 | <html> |
| 7 | <head> |
| 8 | </head> |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 9 | <link rel="stylesheet" href="autocomplete.css"> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 10 | <body> |
| 11 | <h1>App de traçabilitat DAFME</h1> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 12 | <h2 id = "assignatura"></h2> |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 13 | <h3 id = "aula"></h3> |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 14 | <a href="#">No és així? Canvia-ho.</a> |
| 15 | |
| 16 | <h2 id="hora"> |
| 17 | <span id="inici"></span> - |
| 18 | <span id="fi"></span> |
| 19 | </h2> |
| 20 | <h3 id="data"></h3> |
| 21 | <a href="#">No és així? Canvia-ho.</a> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 22 | |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 23 | <form id="subjectListInput" autocomplete="off"> |
| 24 | <div class="autocomplete" id="input2" style="width:300px;"> |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 25 | <input id="myInput" type="text" name="mySubject" placeholder="Subject"> |
| 26 | </div> |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 27 | |
| 28 | </form> |
| 29 | <button onclick="completeSubjectList()">Afegeix</button> |
| 30 | |
| 31 | <div id="subjectList"></div> |
| 32 | |
| 33 | <form> |
| 34 | <label for="seient" id="seient2"></label><br> |
| 35 | <input type="text" id="seientInput" placeholder="Seient"><br> |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 36 | </form> |
| 37 | |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 38 | <form id = "link"> |
| 39 | <!--<form id = "link" action = https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1063142948=S03&entry.2115504093=2020-09-14&entry.1749141911=9:00&entry.1827359679=10:00&entry.1077148310=Columna+3&entry.1600275159=[Autogenerat+per+delefme/covid-tracability]>--> |
| 40 | <input type="submit" value="Continua"/> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 41 | </form> |
| 42 | |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 43 | <script> |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 44 | var classesAlumne = [{}]; |
| 45 | if(localStorage.pos == null) localStorage.pos = 0; |
| 46 | |
| 47 | document.getElementById("seientInput").value = "hola"; |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 48 | |
| 49 | var subjects = ["Calcul 1", "Calcul 2", "Algebra Lineal", "Geometria", "Numerica", "EDOS"]; |
| 50 | |
| 51 | autocomplete(document.getElementById("myInput"), subjects); |
| 52 | |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 53 | |
| 54 | |
| 55 | var linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform"; |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 56 | |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 57 | var mydata = JSON.parse(classes); |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 58 | let datahoraris = JSON.stringify(classesAlumne); |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 59 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 60 | var hora_actual = new Date(); |
| 61 | var minuts; |
| 62 | |
| 63 | // Hora d'inici |
| 64 | hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts |
| 65 | minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString(); |
| 66 | document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts; |
| 67 | |
| 68 | // Hora de fi |
| 69 | hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora |
| 70 | minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString(); |
| 71 | document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts; |
| 72 | |
| 73 | // Data |
| 74 | var dia = hora_actual.getDate(); |
| 75 | var mes = hora_actual.getMonth() + 1; |
| 76 | var any = hora_actual.getFullYear(); |
| 77 | var data = dia.toString() + '/' + mes.toString() + '/' + any.toString(); |
Dani Vilardell | 21dacea | 2020-09-21 14:25:20 +0200 | [diff] [blame] | 78 | |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 79 | document.getElementById("link").onclick = completaLink(); |
Dani Vilardell | d4bfb75 | 2020-09-21 21:32:55 +0200 | [diff] [blame] | 80 | |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 81 | if(localStorage.classesAlumne != null) classesAlumne = JSON.parse(localStorage.classesAlumne); |
| 82 | |
| 83 | for(i = 0; i < classesAlumne.length; i++) { |
| 84 | document.getElementById("subjectList").innerHTML += "<br>" + classesAlumne[i]; |
| 85 | } |
| 86 | |
| 87 | |
| 88 | function completaLink() { |
| 89 | console.log(document.getElementById("seientInput").value); |
| 90 | for (i = 0; i < mydata.length; i++) { |
| 91 | var h = mydata[i].hora.split(":"); |
| 92 | if(h[0] == (hora_actual.getHours() - 7).toString()) { |
| 93 | console.log("trobat"); |
| 94 | document.getElementById("assignatura").innerHTML = mydata[i].nom; |
| 95 | document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula; |
| 96 | |
| 97 | var datamap=[ |
| 98 | "entry.1063142948=" + mydata[i].aula, |
| 99 | "entry.1749141911=" + (hora_actual.getHours().toString() - 11) +":00", |
| 100 | "entry.1827359679=" + (hora_actual.getHours().toString() - 10) +":00", |
| 101 | "entry.2115504093=" + any.toString() + '-' + mes.toString() + '-' + dia.toString(), |
| 102 | "entry.1077148310=Columna+" + document.getElementById("seientInput").value |
| 103 | ]; |
| 104 | linkOutput += "?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0] + "&" + datamap[4]; |
| 105 | } |
| 106 | } |
| 107 | //window.location.href = linkOutput; |
| 108 | } |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 109 | document.getElementById("data").innerHTML = data; |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 110 | //document.getElementById("link").action = linkOutput; |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 111 | </script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 112 | |
Dani Vilardell | 996d869 | 2020-09-21 23:48:12 +0200 | [diff] [blame^] | 113 | <script> |
| 114 | function completeSubjectList() { |
| 115 | classesAlumne[localStorage.pos] = document.getElementById("myInput").value; |
| 116 | localStorage.pos++; |
| 117 | console.log(document.getElementById("myInput").value); |
| 118 | document.getElementById("subjectList").innerHTML += "<br>" + document.getElementById("myInput").value; |
| 119 | localStorage.classesAlumne = JSON.stringify(classesAlumne); |
| 120 | } |
| 121 | |
| 122 | </script> |
Dani Vilardell | 12518e2 | 2020-09-21 16:00:07 +0200 | [diff] [blame] | 123 | |
Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame] | 124 | </body> |
| 125 | </html> |