From 568a47ab7fd17d1a18b273e5cecb0ce009a23a70 Mon Sep 17 00:00:00 2001
From: freedomfeather <fadlurohmanakmal@rocketmail.com>
Date: Thu, 5 Oct 2017 22:31:20 +0700
Subject: [PATCH] Menambahkan halaman edit preferred location

---
 css/default_style.css      |   1 +
 css/location.css           |  14 +++++
 css/login.css              |   4 ++
 css/profile.css            | 117 +++++++++++++++++++++----------------
 login/login.html           |   4 +-
 profile/edit_location.html |   0
 profile/edit_location.php  |  35 +++++++++++
 profile/edit_profile.php   |  82 +++++++++++++-------------
 profile/profile.php        |  18 ++++--
 9 files changed, 177 insertions(+), 98 deletions(-)
 create mode 100644 css/location.css
 delete mode 100644 profile/edit_location.html
 create mode 100644 profile/edit_location.php

diff --git a/css/default_style.css b/css/default_style.css
index 7e1f9f7c..8dca10a5 100755
--- a/css/default_style.css
+++ b/css/default_style.css
@@ -72,3 +72,4 @@ a:hover {
     margin-left: auto;
     margin-right: auto;
 }
+
diff --git a/css/location.css b/css/location.css
new file mode 100644
index 00000000..7259a04a
--- /dev/null
+++ b/css/location.css
@@ -0,0 +1,14 @@
+.editloc_container {
+    margin-top: 10%;
+    height: 50%;
+}
+.subheader {
+    height: 15%;
+}
+.title {
+    float: left;
+}
+.title h1 {
+    text-align: left;
+    margin: 0;
+}
diff --git a/css/login.css b/css/login.css
index 35b67a9a..e987fd69 100755
--- a/css/login.css
+++ b/css/login.css
@@ -10,6 +10,7 @@
     margin-bottom: 20%;
     display: flex;
     font-size: 1.7em;
+    letter-spacing: -5px;
 }
 .login_header h1 {
     margin: 0px 8px;
@@ -58,6 +59,9 @@
     float: left;
     margin-top: 2%;
 }
+.login_field {
+    height: 30px;
+}
 .login_form {
     height: 30px;
 }
diff --git a/css/profile.css b/css/profile.css
index 0937b736..215515e1 100755
--- a/css/profile.css
+++ b/css/profile.css
@@ -1,31 +1,29 @@
-#profile_frame h1 {
-    text-align: left;
-    margin-top: 0;
-}
 .profile_container {
-    height: 70%;
+    margin-top: 10%;
+    height: 50%;
 }
-.profile_header {
+.subheader {
     height: 15%;
 }
-.profile_title {
+.title {
     float: left;
 }
-.profile_title h1 {
+.title h1 {
     text-align: left;
     margin: 0;
 }
 .edit_profile_button {
     float: right;
-    margin-top: 0;
-    margin-right: 10 px;
+    margin-top: 10px;
+    margin-right: 10px;
 }
-.myprofile {
+.profile_info_container {
     text-align: center;
+    margin-top: 2%;
     margin-left: auto;
     margin-right: auto;
 }
-.profilepict_frame {
+.profile_pict_frame {
     width: 100px;
     height: 100px;
     overflow: auto;
@@ -33,63 +31,84 @@
     margin-left: auto;
     margin-right: auto;
 }
-.profilepict_frame img {
+.profile_pict_frame img {
     display: inline;
     margin: 0 auto;
     height: 100%;
     width: 100%;
 }
-.profile_info {
+.profile_data_container {
     height: 100px;
 }
-#edit_profile_page {
-    height: 550px;
-    width: 400px;
-}
-#edit_profile_page h1 {
-    text-align: left;
-    margin-top: 0;
-}
-#edit_profile_page input[type="text"] {
-    width: 180px;
+.edit_prefloc_button {
+    float: right;
+    margin-top: 10px;
+    margin-right: 10px;
 }
-.edit_profile_frame {
-    text-align: left;
+.edit_profile_container {
+    margin-top: 10%;
     overflow-y: scroll;
-    height: 415px;
+    height: 72%;
 }
-.edit_image_frame {
-    float: left;
-    width: 100px;
+.change_profilepict {
+    display: flex;
+    height: 25%;
+    width: 100%;
+    margin-bottom: 5%;
+}
+.current_pict_frame {
+    width: 170px;
     height: 100px;
     overflow: auto;
     border-radius: 50%;
+    margin-left: 5%;
 }
-.edit_image_frame img {
+.current_pict_frame img {
+    display: inline;
+    margin: 0 auto;
     height: 100%;
     width: 100%;
 }
-.select_pict {
-    display: flex;
-    position: relative;
-    top: 35px;
-    left: 5px;
+.pict_name_field {
+    margin-top: 35px;
+    margin-left: 5%;
 }
-.browse_file {
-    display: flex;
-    position: absolute;
-    top: 37px;
-    left: 300px;
+.pict_name_field input {
+    width: 100%;
+}
+.pict_picker_frame {
+    margin-top: 37px;
 }
-input.upload_file {
+.pict_picker_frame input {
+    border: 0px;
+}
+.current_profile {
+    height: 25%;
+    width: 100%;
     display: flex;
-    position: relative;
-    display: inline;
-    text-align: right;
-    left: 0px;
-    height: 17px;
-    width: 100px;
+}
+.form_name {
+    height: 100px;
+    width: 115px;
+    margin-left: 5%;
+    margin-right: 5%
+}
+.form_field {
+    height: 100px;
+    width: 250px;
+}
+.form_field input {
+    width: 100%;
+}
+.back {
+    width: 39px;
+    text-align: center;
+    padding: 3px;
+    font-size: 0.8em;
+}
+.save {
+    width: 50px;
 }
 #profile_link {
     background-color: #465d43;
-}
\ No newline at end of file
+}
diff --git a/login/login.html b/login/login.html
index 62929e6b..86eac2d7 100755
--- a/login/login.html
+++ b/login/login.html
@@ -16,10 +16,10 @@
             <form name="login" method="POST" action="login.php" onsubmit="return validate();">
                 <div class="login_container">
                     <div class="form_name">
-                        <div class="login_form">
+                        <div class="login_field">
                             Username
                         </div>
-                        <div class="login_form">
+                        <div class="login_field">
                             Password
                         </div>
                     </div>
diff --git a/profile/edit_location.html b/profile/edit_location.html
deleted file mode 100644
index e69de29b..00000000
diff --git a/profile/edit_location.php b/profile/edit_location.php
new file mode 100644
index 00000000..ce5f62b5
--- /dev/null
+++ b/profile/edit_location.php
@@ -0,0 +1,35 @@
+<html>
+<head>
+<title>U Wanna Call Me Beibh?</title>
+    <link rel="stylesheet" type="text/css" href="../css/default_style.css">
+    <link rel="stylesheet" type="text/css" href="../css/location.css">
+    <link rel="stylesheet" type="text/css" href="../css/header.css">
+</head>
+<body>
+    <div class="frame">
+        <div class="header">
+        <?php
+            $user_id = $_GET['id'];
+            include '../database/dbconnect.php';
+    
+            $query=mysqli_query($con,"SELECT * FROM user WHERE user_id='".$user_id."'") or die(mysqli_error());
+    
+            if(mysqli_num_rows($query)!=0)
+            {
+                $row=mysqli_fetch_assoc($query);
+                $username = $row['username'];
+                include("../template/header.php");
+            }
+            mysqli_close($con);
+            ?>
+        </div>
+    <div class="menu_container">
+        <?php include'../template/menu.php';?>
+    </div>
+    <div class="editloc_container">
+        <div class="subheader">
+            <div class="title"><h1>Edit Preferred Loaction</h1></div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/profile/edit_profile.php b/profile/edit_profile.php
index 69e1236e..5f6d0b7e 100644
--- a/profile/edit_profile.php
+++ b/profile/edit_profile.php
@@ -7,7 +7,7 @@
     <link rel="stylesheet" type="text/css" href="../css/switch.css">
 </head>
 <body>
-    <div class="frame" id="edit_profile_page">
+    <div class="frame">
         <div class="header">
             <?php
                 $user_id = $_GET['id'];
@@ -24,56 +24,56 @@
                 mysqli_close($con);
             ?>
         </div>
-        <div class="menu">
-            <?php include '../template/menu.php';?>
+        <div class="menu_container">
+            <?php include'../template/menu.php';?>
         </div>
-        <h1>Edit Profile</h1>
-        <div class="edit_profile_frame">
+        <div class="edit_profile_container">
+            <div class="subheader">
+                <div class="title"><h1>My Profile</h1></div>
+            </div>
             <form name="edit_identity" method="POST" action="update_profile.php" enctype="multipart/form-data">
-                <div>
-                    <div style="display: inline-block; position: relative; margin-left: 20px; height: 100px; width: 300px;">
-                        <div class="edit_image_frame">
-                            <img id="edit_profile_pict" src="../img/default_profile.jpeg">
+                <div class="change_profilepict">
+                    <div class="current_pict_frame">
+                        <img id="current_profile_pict" src="../img/default_profile.jpeg">
+                    </div>
+                    <div class="pict_name_field">
+                        <input id="file_name" type="text" readonly="readonly">
+                    </div>
+                    <div class="pict_picker_frame">
+                        <input type="file" name="profile_pictfile" class="upload_file" onchange="showFileName(this);">
+                    </div>
+                </div>
+                <div class="current_profile">
+                    <div class="form_name">
+                        <div style="height: 30px;">
+                            Your Name
                         </div>
-                        <div class="select_pict">
-                            <input id="file_name" type="text" readonly="readonly">
+                        <div style="height: 30px;">
+                            Phone
                         </div>
-                        <div class="browse_file">
-                            <input type="file" name="profile_pictfile" class="upload_file" onchange="showFileName(this);">
+                        <div style="height: 30px;">
+                            Status Driver
                         </div>
                     </div>
-                    <div style="display: inline; position: relative; margin-left: 20px; top: 20px;">
-                        <div style="display: inline-block; position: relative; height: 100px; width: 100px;">
-                            <div style="height: 30px;">
-                                Your Name
-                            </div>
-                            <div style="height: 30px;">
-                                Phone
-                            </div>
-                            <div style="height: 30px;">
-                                Status Driver
-                            </div>
+                    <div class="form_field">
+                        <div style="height: 30px;">
+                            <input id="current_name" name="edit_name" type="text">
+                        </div>
+                        <div style="height: 30px;">
+                            <input id="current_phone" name="edit_phone" type="text">
                         </div>
-                        <div style="display: inline-block; position: absolute; height: 100px; width: 250px;">
-                            <div style="height: 30px; margin-left: 10px;">
-                                <input id="current_name" name="edit_name" type="text" style="height: 20px; width: 260px;">
-                            </div>
-                            <div style="height: 30px; margin-left: 10px;">
-                                <input id="current_phone" name="edit_phone" type="text" style="height: 20px; width: 260px;">
-                            </div>
-                            <div style="height: 30px; margin-left: 10px;">
-                                <label class="switch" style="float: right;">
-                                    <input type="checkbox" name="is_driver" value="true">
-                                    <span class="slider round"></span>
-                                </label>
-                            </div>
+                        <div style="height: 30px;">
+                            <label class="switch" style="float: right;">
+                                <input type="checkbox" name="is_driver" value="true">
+                                <span class="slider round"></span>
+                            </label>
                         </div>
                     </div>
                 </div>
-                <div>
+                <div class="edit_profile_nav">
+                    <a href=<?php echo 'profile.php?id='.$user_id; ?>><div class="button red back" style="float: left; margin-left: 20px;">BACK</div></a>
+                    <input type="submit" value="SAVE" style="float: right;" class="button green save">
                     <input id="hidden_userid" name="hidden_userid" type="text" style="display:none;">
-                    <button class="button" style="float: left;"><a href="profile.php">BACK</a></button>
-                    <input type="submit" value="SAVE" style="float: right;" class="button">
                 </div>
             </form>
         </div>
@@ -82,7 +82,7 @@
         echo "<script>document.getElementById('current_name').value = '".$row['name']."'</script>";
         echo "<script>document.getElementById('current_phone').value = '".$row['phone']."'</script>";
         if (isset($row['pict'])) {
-            echo "<script>document.getElementById('edit_profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>";
+            echo "<script>document.getElementById('current_profile_pict').src ='getProfilePict.php?id=".$user_id."'</script>";
         }
         echo "<script>document.getElementById('hidden_userid').value =".$user_id."</script>";
     ?>
diff --git a/profile/profile.php b/profile/profile.php
index 6e1a1b5d..68583f72 100644
--- a/profile/profile.php
+++ b/profile/profile.php
@@ -29,16 +29,16 @@
         <div class="menu_container">
             <?php include'../template/menu.php';?>
         </div>
-        <div class="profile_container">
-            <div class="profile_header">
-                <div class="profile_title"><h1>My Profile</h1></div>
+        <div class="top_container">
+            <div class="subheader">
+                <div class="title"><h1>My Profile</h1></div>
                 <div class="edit_profile_button"><a href=<?php echo 'edit_profile.php?id='.$user_id; ?>>✎</a></div>
             </div>
-            <div class="myprofile">
-                <div class="profilepict_frame">
+            <div class="profile_info_container">
+                <div class="profile_pict_frame">
                     <img id="profile_pict" src="../img/default_profile.jpeg">
                 </div>
-                <div class="profile_info">
+                <div class="profile_data_container">
                     <?php
                         echo "</br><strong>".$row['username']."</strong></br>";
                         echo $row['name']."</br>";
@@ -54,6 +54,12 @@
                 </div>
             </div>
         </div>
+        <div class="top_container">
+            <div class="subheader">
+                <div class="title"><h1>Preferred Locations</h1></div>
+                <div class="edit_prefloc_button"><a href=<?php echo 'edit_location.php?id='.$user_id; ?>>✎</a></div>
+            </div>
+        </div>
     </div>
 </body>
 </html>
-- 
GitLab