Only show enrolled subjects
diff --git a/autocomplete.css b/autocomplete.css
index bea6091..d56e088 100644
--- a/autocomplete.css
+++ b/autocomplete.css
@@ -46,4 +46,5 @@
   /*when navigating through the items using the arrow keys:*/
   background-color: DodgerBlue !important; 
   color: #ffffff; 
-}
\ No newline at end of file
+}
+
diff --git a/completeHTML.js b/completeHTML.js
new file mode 100644
index 0000000..38ee27a
--- /dev/null
+++ b/completeHTML.js
@@ -0,0 +1,21 @@
+
+function completaHTML() {
+    document.getElementById("data").innerHTML = data;
+    var trobat = false;
+    for (i = 0; i < dataHorarisAlumne.length; i++) { 
+    	var h = dataHorarisAlumne[i].hora.split(":");
+		var hAct = hora_actual.getHours() - 1;
+		console.log(h[0]);
+		console.log(hAct);
+        if(hAct < 10) hAct = "0" + hAct;
+        if(h[0] == hAct) {
+        	trobat = true;
+			document.getElementById("assignatura").innerHTML = dataHorarisAlumne[i].nom;
+			document.getElementById("aula").innerHTML = "Aula " + dataHorarisAlumne[i].aula;
+		}
+	}
+	if(!trobat) {
+		document.getElementById("assignatura").innerHTML = "No tens cap assignatura ara mateix de les que curses";
+	}
+
+}
\ No newline at end of file
diff --git a/completeLink.js b/completeLink.js
index 863e004..e3b63bb 100644
--- a/completeLink.js
+++ b/completeLink.js
@@ -1,23 +1,25 @@
 
 function completaLink() {
 	if(linkOutput == "") linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform";
-    for (i = 0; i < mydata.length; i++) { 
-    	var h = mydata[i].hora.split(":");
+    for (i = 0; i < dataHorarisAlumne.length; i++) { 
+    	var h = dataHorarisAlumne[i].hora.split(":");
         console.log(h[0]);
-        console.log((hora_actual.getHours()).toString() - 3);
-		if(h[0] == (hora_actual.getHours()).toString() - 1 - 2) {
+        console.log((hora_actual.getHours()).toString());
+        var hAct = hora_actual.getHours();
+        if(hAct < 10) hAct = "0" + hAct;
+		if(h[0] == hAct) {
 			console.log("trobat");
-			document.getElementById("assignatura").innerHTML = mydata[i].nom;
-			document.getElementById("aula").innerHTML = "Aula " + mydata[i].aula;
+			document.getElementById("assignatura").innerHTML = dataHorarisAlumne[i].nom;
+			document.getElementById("aula").innerHTML = "Aula " + dataHorarisAlumne[i].aula;
 
             var datamap=[
-                "entry.1063142948=" + mydata[i].aula,
+                "entry.1063142948=" + dataHorarisAlumne[i].aula,
                 "entry.1749141911=" + ((hora_actual.getHours() - 11).toString()) +":00",
                 "entry.1827359679=" + ((hora_actual.getHours() - 10).toString()) +":00",
                 "entry.2115504093=" + getYearFormat() + '-' + getMonthFormat() + '-' + getDayFormat(),
                 "entry.1077148310=Columna+" + document.getElementById("seientInput").value
                 ];
-            window.location.href = linkOutput + "?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0] + "&" + datamap[4] + "&entry." + codisFiles[document.getElementById("seientInput").value.toUpperCase().charCodeAt(0) - 65] + "=Columna+" + document.getElementById("seientInput").value.charAt(1);
+            window.location.href = linkOutput + "?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0] + "&" + datamap[4] + "&entry." + codisFiles[document.getElementById("seientInput").value.toUpperCase().charCodeAt(0) - 65] + "=Columna+" + document.getElementById("seientInput").value.charAt(1) + "&entry.1600275159=[Autogenerat+per+delefme/covid-tracability]";
 		}
 	}
 }
\ No newline at end of file
diff --git a/completeSubjectListInHTML.js b/completeSubjectListInHTML.js
index 6995911..1264ae1 100644
--- a/completeSubjectListInHTML.js
+++ b/completeSubjectListInHTML.js
@@ -1,13 +1,40 @@
 
 function completeSubjectList() {
-    classesAlumne[localStorage.pos] = document.getElementById("myInput").value;
-    localStorage.pos++;
-    document.getElementById("subjectList").innerHTML += "<br>" +  document.getElementById("myInput").value;
-    localStorage.classesAlumne = JSON.stringify(classesAlumne);
+	var trobat = false;
+	for(var i = 0; i < totesLesClasses.length; i++) {
+		if(document.getElementById("myInput").value == totesLesClasses[i].nom) {
+			dataHorarisAlumne.push({ "nom":totesLesClasses[i].nom, "hora":totesLesClasses[i].hora, "aula":totesLesClasses[i].aula })
+			document.getElementById("subjectList").innerHTML += "<br>" +  document.getElementById("myInput").value  + " " + dataHorarisAlumne[i].hora;
+	    	localStorage.dataHorarisAlumne = JSON.stringify(dataHorarisAlumne);
+			trobat = true;
+			completaHTML();
+		}
+	}
+	if(!trobat) {
+		showAlert();
+	}
+}
+
+function returnAllSubjectArray() {
+	for(var i = 0; i < totesLesClasses.length; i++) {
+		subjects.push(totesLesClasses[i].nom);
+	}
 }
 
 function writeSubjectList() {
-	for(i = 0; i < classesAlumne.length; i++) {
-        document.getElementById("subjectList").innerHTML += "<br>" +  classesAlumne[i];
+	for(var i = 0; i < dataHorarisAlumne.length; i++) {
+		console.log("hola");
+        document.getElementById("subjectList").innerHTML += "<br>" +  dataHorarisAlumne[i].nom + " " + dataHorarisAlumne[i].hora;
     } 
+}
+
+function showAlert()  {
+	document.getElementById("alert").innerHTML = "Aquesta assignatura no esta dins de la llista"
+    document.getElementById("alert").style.opacity = "1";
+    setTimeout(()=> dissapearAlert() ,2000); // hide the alert after 2.5s
+}
+
+function dissapearAlert() {
+	document.getElementById("alert").style.opacity = "0";
+	document.getElementById("alert").innerHTML = "";
 }
\ No newline at end of file
diff --git a/generalStyle.css b/generalStyle.css
new file mode 100644
index 0000000..92b6654
--- /dev/null
+++ b/generalStyle.css
@@ -0,0 +1,40 @@
+.myButton {
+	box-shadow:inset 0px 1px 0px 0px #6e9eb8;
+	background:linear-gradient(to bottom, #1a5b8c 5%, #4b84a3 100%);
+	background-color:#1a5b8c;
+	border:1px solid #22536e;
+	display:inline-block;
+	cursor:pointer;
+	color:#ffffff;
+	font-family:Arial;
+	font-size:13px;
+	font-weight:bold;
+	padding:6px 12px;
+	text-decoration:none;
+}
+.myButton:hover {
+	background:linear-gradient(to bottom, #4b84a3 5%, #1a5b8c 100%);
+	background-color:#4b84a3;
+}
+.myButton:active {
+	position:relative;
+	top:1px;
+}
+.alert  {
+  position: fixed;
+  top: 0;
+  right: 0.5rem;
+  border:1px solid rgba(0, 0, 0, 0.2);
+  border-radius: 0.25rem;
+  padding: 2rem;
+  background: #fff;
+  color: #f65656;
+  box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.5);
+  transition:  all 0.2s ease-in-out;
+  opacity: 0;
+}
+
+.visible {
+  opacity: 1;
+  transform: translateY(1.25rem);
+}
\ No newline at end of file
diff --git a/horaris.json b/horaris.json
index d938bb4..a0ca6a2 100644
--- a/horaris.json
+++ b/horaris.json
@@ -1,3 +1 @@
-classes = '[{"nom" : "ÀLGEBRA MULTILINIAL", "hora" : "08:00-9:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL2", "hora" : "09:00-10:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL3", "hora" : "10:00-11:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL4", "hora" : "11:00-12:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL5", "hora" : "12:00-13:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL6", "hora" : "13:00-14:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL7", "hora" : "14:00-15:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL8", "hora" : "15:00-16:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL9", "hora" : "16:00-17:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL10", "hora" : "17:00-18:00", "aula" : "S02"}]';
-
-classesAlumne = '[{"nom" : "ÀLGEBRA MULTILINIAL", "hora" : "08:00-9:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL3", "hora" : "10:00-11:00", "aula" : "S02"}]'
\ No newline at end of file
+classes = '[{"nom" : "Càlcul", "hora" : "08:00-9:00", "aula" : "S02"}, {"nom" : "Àlgebra Lineal", "hora" : "09:00-10:00", "aula" : "S02"}, {"nom" : "Àlgebra Multilineal", "hora" : "10:00-11:00", "aula" : "S02"}, {"nom" : "Geometria", "hora" : "11:00-12:00", "aula" : "S02"}, {"nom" : "EDOS", "hora" : "12:00-13:00", "aula" : "S02"}, {"nom" : "EDPS", "hora" : "13:00-14:00", "aula" : "S02"}, {"nom" : "Calcul Integral", "hora" : "14:00-15:00", "aula" : "S02"}, {"nom" : "Fonaments de les Matemàtiques", "hora" : "15:00-16:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL9", "hora" : "16:00-17:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL10", "hora" : "17:00-18:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL11", "hora" : "18:00-19:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL12", "hora" : "19:00-20:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL13", "hora" : "20:00-21:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL14", "hora" : "21:00-22:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL15", "hora" : "22:00-23:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL16", "hora" : "23:00-00:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL17", "hora" : "00:00-01:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL18", "hora" : "01:00-02:00", "aula" : "S02"}]';
diff --git a/main.html b/main.html
index b0c739a..67d5b82 100644
--- a/main.html
+++ b/main.html
@@ -4,70 +4,104 @@
 <script type="text/javascript" src="./completeLink.js"></script>
 <script type="text/javascript" src="./completeSubjectListInHTML.js"></script>
 <script type="text/javascript" src="./getTimeAndDate.js"></script>
+<script type="text/javascript" src="./completeHTML.js"></script>
+<script type="text/css" src="./autocomplete.css"></script>
+<script type="text/css" src="./generalStyle.css"></script>
 <meta charset="utf-8">
 
 <html>
     <head>
+    	<style type="text/css">
+    		.myButton {
+				box-shadow:inset 0px 1px 0px 0px #6e9eb8;
+				background:linear-gradient(to bottom, #1a5b8c 5%, #4b84a3 100%);
+				background-color:#1a5b8c;
+				border:1px solid #22536e;
+				display:inline-block;
+				cursor:pointer;
+				color:#ffffff;
+				font-family:Arial;
+				font-size:13px;
+				font-weight:bold;
+				padding:6px 12px;
+				text-decoration:none;
+			}
+			.myButton:hover {
+				background:linear-gradient(to bottom, #4b84a3 5%, #1a5b8c 100%);
+				background-color:#4b84a3;
+			}
+			.myButton:active {
+				position:relative;
+				top:1px;
+			}
+		</style>
     </head>
-    <link rel="stylesheet" href="autocomplete.css">
-    <body>
-        <h1>App de traçabilitat DAFME</h1>
-        <h2 id = "assignatura"></h2>
-        <h3 id = "aula"></h3>
-        <a href="#">No és així? Canvia-ho.</a>
-        
-        <h2 id="hora">
-            <span id="inici"></span> -
-            <span id="fi"></span>
-        </h2>
-        <h3 id="data"></h3>
-        <a href="#">No és així? Canvia-ho.</a>
+    <center>
+	    <link rel="stylesheet" href="autocomplete.css">
+	    <body>
+	        <h1>App de traçabilitat DAFME</h1>
+	        <h2 id = "assignatura"></h2>
+	        <h3 id = "aula"></h3>
+	        
+	        <h2 id="hora">
+	            <span id="inici"></span> -
+	            <span id="fi"></span>
+	        </h2>
+	        <h3 id="data"></h3>
+	        <p> <br></p>
 
-        <form id="subjectListInput" autocomplete="off">
-            <div class="autocomplete" id="input2" style="width:300px;">
-                <input id="myInput" type="text" name="mySubject" placeholder="Subject">
-            </div>
-            
-        </form>
-        <button onclick="completeSubjectList()">Afegeix</button>
+	        <form id="subjectListInput" autocomplete="off">
+	            <div class="autocomplete" id="input2" style="width:300px;">
+	                <input id="myInput" type="text" name="mySubject" placeholder="Subject">
+	            </div>
+	        </form>
 
-        <div id="subjectList"></div>
+	        <a class="myButton" onclick="completeSubjectList()">Afegeix</a>
 
-        <form>
-            <label for="seient" id="seient"></label><br>
-            <input type="text" id="seientInput" placeholder="Seient"><br>
-        </form>
+	        <p id="alert" style="opacity: 0; color:red;"> 
+				
+			</p> 
+	        <div id="subjectList"><b>Assignatures Cursades:</b></div>
 
-		<form id = "link">
-        <!--<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.208184485=Columna+3&entry.1600275159=[Autogenerat+per+delefme/covid-tracability]>-->
-        	https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1749141911=8:00&entry.1827359679=9:00&entry.2115504093=2020-9-22&entry.1063142948=S02&entry.1077148310=Columna+d4&entry.1686039024=Columna+4
-		<button type="reset" onclick="completaLink()">Continua</button>
-		</form>
+	        <form>
+	            <label for="seient" id="seient"></label><br>
+	            <input type="text" id="seientInput" placeholder="Seient" style="width:300px;"><br>
+	        </form>
 
-        <script>
-        	var codisFiles = ["208184485", "1077148310", "642851281", "1686039024", "697835787", "1511799646", "809853432", "182597499", "1890539481", "529159478", "1615241874", "1334263875"];
-            var classesAlumne = [{}];
-            var subjects = ["Calcul 1", "Calcul 2", "Algebra Lineal", "Geometria", "Numerica", "EDOS"];
-        	var linkOutput = "";      	
-        	var mydata = JSON.parse(classes);
-            let datahoraris = JSON.stringify(classesAlumne);
-            var hora_actual = new Date();
-            var minuts, dia, mes, any, data;
+			<form id = "link">
+	        <!--<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.208184485=Columna+3&entry.1600275159=[Autogenerat+per+delefme/covid-tracability]>-->
 
-            if(localStorage.pos == null) localStorage.pos = 0;
+			<a class="myButton" type="reset" onclick="completaLink()">Continua</a>
+			</form>
 
-            autocomplete(document.getElementById("myInput"), subjects);
-            	
-            getTimeAndDate();
-            
-            if(localStorage.classesAlumne != null) classesAlumne = JSON.parse(localStorage.classesAlumne);
+			<p> <br></p>
+			<a class="myButton" href="https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform">Hi ha errors? Completa formulari manualment</a>
 
-            writeSubjectList();
-           
-            document.getElementById("data").innerHTML = data;
+	        <script>
+	        	//localStorage.clear();
 
-        </script>
+	        	var codisFiles = ["208184485", "1077148310", "642851281", "1686039024", "697835787", "1511799646", "809853432", "182597499", "1890539481", "529159478", "1615241874", "1334263875"];
+	            var subjects = [];
+	        	var linkOutput = "";      	
+	        	var totesLesClasses = JSON.parse(classes);
+	            var dataHorarisAlumne = [];
+	            var hora_actual = new Date();
+	            var minuts, dia, mes, any, data;
+
+	            if(localStorage.dataHorarisAlumne != null) dataHorarisAlumne = JSON.parse(localStorage.dataHorarisAlumne);
+
+	            console.log(localStorage.dataHorarisAlumne);
+
+	           	//localStorage.clear();
+	            returnAllSubjectArray();
+	            autocomplete(document.getElementById("myInput"), subjects);
+	            getTimeAndDate();
+	            completaHTML();
+	            writeSubjectList();
+
+	        </script>
 
 
-    </body>
+	    </body>
+	</center>
 </html>