From 601ebb7dbffeaae7317afd8d74d463d70c16b4d4 Mon Sep 17 00:00:00 2001
From: Mikhael Artur <mikhael.artur.d@gmail.com>
Date: Fri, 6 Oct 2017 13:34:15 +0700
Subject: [PATCH] Minor tweaks edit pref loc display

---
 css/edit-prefered-location.css   |  2 +-
 js/edit-prefered-location.js     | 11 +++++------
 view/edit-prefered-locations.php | 12 ++++++------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/css/edit-prefered-location.css b/css/edit-prefered-location.css
index 2b33f6f4..7884ac90 100644
--- a/css/edit-prefered-location.css
+++ b/css/edit-prefered-location.css
@@ -36,7 +36,7 @@ table, th, td, tr{
 	width: 20%;
 }
 
-#locationinput{
+.locationinput{
 	 display: none;
 	 width: 100%;
 	 height: 100%;
diff --git a/js/edit-prefered-location.js b/js/edit-prefered-location.js
index 4fe430b1..5338cebd 100644
--- a/js/edit-prefered-location.js
+++ b/js/edit-prefered-location.js
@@ -1,9 +1,9 @@
-var textHidden = false;
-function hideMe(){
+function hideMe(i){
+	var textHidden = false;
 	textHidden = !textHidden;
-	var textBox = document.getElementById("locationtext");
-	var inputBox = document.getElementById("locationinput");
-	var image = document.getElementById("imageeditsave");
+	var textBox = document.getElementById("locationtext"+i);
+	var inputBox = document.getElementById("locationinput"+i);
+	var image = document.getElementById("imageeditsave"+i);
 	
 	if(textHidden){
 		textBox.setAttribute("style","display:none");
@@ -17,5 +17,4 @@ function hideMe(){
 		textBox.innerHTML = inputBox.value;
 		image.src = "../img/pencil.png";
 	}
-
 }
\ No newline at end of file
diff --git a/view/edit-prefered-locations.php b/view/edit-prefered-locations.php
index 0dbd6559..891b182b 100644
--- a/view/edit-prefered-locations.php
+++ b/view/edit-prefered-locations.php
@@ -7,7 +7,7 @@
 	</head>
 	<body>
 		<div class = "container">
-			<h1>EDIT PREFERED LOCATION</h1>
+			<h1>EDIT PREFERED LOCATIONS</h1>
 			<?php
 				include "../model/user.php";
 				$user = new User;
@@ -28,19 +28,19 @@
 							<tr>
 								<td class="tabno">'.$i.'</td>
 								<td class="tabloc">
-									<div  id="locationtext">'.$row["location"].'</div>
-									<input id="locationinput" type="text">
+									<div  id="locationtext'.$i.'">'.$row["location"].'</div>
+									<input class="locationinput" id="locationinput'.$i.'" type="text">
 								</td>
 								<td class="tabact">
 									<div class="addset" align="center">
 										<div class="editsavebox">
-											<button onClick=hideMe() class="editsave">
-												<img src="../img/pencil.png" class="editsavebutton" id="imageeditsave">
+											<button onClick=hideMe('.$i.') class="editsave">
+												<img src="../img/pencil.png" class="editsavebutton" id="imageeditsave'.$i.'">
 											</button>
 										</div>
 										<div>
 											<button onClick=f() class="delete">
-												<img src="../img/delete.png" class="deletebutton">
+												<img src="../img/delete.png" class="deletebutton" id="imagedelete'.$i.'">
 											</button>
 										</div>
 									</div>
-- 
GitLab