From a1dbd35d19f8e59bdfd9491da2cc3383b1dbedb3 Mon Sep 17 00:00:00 2001
From: aldrichvalentino <aldrich.vh97@gmail.com>
Date: Fri, 6 Oct 2017 11:36:40 +0700
Subject: [PATCH] preferred location hidden if user is not a driver

---
 js/profile.js      | 5 +++++
 view/dashboard.php | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/js/profile.js b/js/profile.js
index bfbd93c7..91dffb11 100644
--- a/js/profile.js
+++ b/js/profile.js
@@ -42,6 +42,11 @@ function getUserProfile(){
                 singleList.innerHTML = loc;
                 listOfLocation.appendChild(singleList);
             }
+            //display preferred location if driver
+            if(isDriver == 0){
+                document.getElementById('preferred-location').style.display = 'none';
+                document.getElementById('user-location').style.display = 'none';
+            }
         }
     };
     xmlhttp.open('GET', '../controller/profile.php?id=' + id, true);
diff --git a/view/dashboard.php b/view/dashboard.php
index 98c44fe2..f6c82e3f 100644
--- a/view/dashboard.php
+++ b/view/dashboard.php
@@ -62,10 +62,10 @@
                 <img src="../img/mail.png" /><div id="email"></div><br />
                 <img src="../img/phone.png" /><div id="phone"></div><br />
             </div>
-            <div class="sub-header">
+            <div class="sub-header" id="preferred-location">
                 <div class="sub-header-heading"><h1>PREFERRED LOCATION</h1></div>
                 <div class="edit-icon">
-                    <a href="../view/edit-prefered-locations.html"><img src="../img/pencil.png" /></a>
+                    <a href="../view/edit-prefered-locations.php"><img src="../img/pencil.png" /></a>
                 </div>
             </div>
             <div class="user-location"><ul id="user-location"></ul></div>
-- 
GitLab