Skip to content
Snippets Groups Projects
Commit 40f133fb authored by Fadhil Imam Kurnia's avatar Fadhil Imam Kurnia
Browse files

Change driver status from radio button to toogle

parent 9426cf12
Branches
1 merge request!5Complete Bonus in profil and edit location page
......@@ -232,6 +232,63 @@ table, th, td {
content: "";
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 40px;
height: 22px;
}
/* Hide default HTML checkbox */
.switch input {display:none;}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 15px;
width: 15px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #008C14;
}
input:focus + .slider {
box-shadow: 0 0 1px #008C14;
}
input:checked + .slider:before {
-webkit-transform: translateX(17px);
-ms-transform: translateX(17px);
transform: translateX(17px);
}
.slider.round {
border-radius: 22px;
}
.slider.round:before {
border-radius: 50%;
}
/* ------------------------- ORDER -------------------------*/
.small-circle {
......
......@@ -74,7 +74,7 @@ class ProfilController {
public static function SaveProfil() {
// Check sending data
if (!isset($_POST["name"]) || !isset($_POST["phone"]) || !isset($_POST["isDriver"]) || !isset($_GET['u'])) {
if (!isset($_POST["name"]) || !isset($_POST["phone"]) || !isset($_GET['u'])) {
echo "Invalid data";
return;
}
......@@ -90,10 +90,12 @@ class ProfilController {
$conn = DB::getInstance();
var_dump($_POST);
$user_id = simpleCrypt($_GET['u'], 'd');
$user_name = $_POST["name"];
$user_phone = $_POST["phone"];
$user_driver = $_POST["isDriver"] == "yes" ? 1 : 0;
$user_driver = isset($_POST["isDriver"]) ? 1 : 0;
$user_photo = isset($_FILES["photo"]) ? $_FILES["photo"]["name"] : null;
// Saving image if available
......
......@@ -16,54 +16,60 @@
</div>
<div class="row">
<form action="/main/profil/edit/save?u=<?=$id?>" method="post" enctype="multipart/form-data">
<div class="container">
<div class="container" style="width: 65%">
<div class="row">
<div class="col-1 text-left"></div>
<div class="col-4 text-left">
<div class="col-6 text-left">
<h2>EDIT PROFILE INFORMATION</h2>
</div>
<div class="col-1 text-left"></div>
</div>
<div class="row">
<div class="col-1 text-left"></div>
<div class="col-2 text-left">
<img class="img-profile" src="<?=$user->photo?>">
</div>
<div class="col-2">
<div class="col-4">
<h3>Update profile picture</h3>
<form action="#">
<input type="file" name="photo" accept="image/*">
</form>
</div>
<div class="col-1 text-left"></div>
</div>
<br>
<div class="row">
<div class="col-1 text-left"></div>
<div class="col-2 text-left">
Your Name<br>
Phone<br>
<div class="col-2 text-left" style="line-height: 35px">
Your Name
</div>
<div class="col-4 line-height-medium">
<input style="width: 100%; height: 30px;padding-left: 5px;font-size: medium" type="text" name="name" value="<?=$user->name?>">
</div>
</div>
<div class="row">
<div class="col-2 text-left" style="line-height: 35px">
Phone
</div>
<div class="col-4 line-height-medium">
<input style="width: 100%; height: 30px;padding-left: 5px;font-size: medium" type="text" name="phone" value="<?=$user->phone?>"><br>
</div>
</div>
<div class="row" style="margin-top: 5px">
<div class="col-2 text-left" style="line-height: 30px">
Driver Status
</div>
<div class="col-2 line-height-medium">
<input style="width: 100%" type="text" name="name" value="<?=$user->name?>"><br>
<input style="width: 100%" type="text" name="phone" value="<?=$user->phone?>"><br>
<input style="width: 20%" type="radio" name="isDriver" value="yes" <?=$user->isDriver? 'checked':''?>>Yes
<input style="width: 20%" type="radio" name="isDriver" value="no" <?=$user->isDriver? '':'checked'?>>No<br>
<div class="col-4 line-height-medium text-right">
<label class="switch">
<input type="checkbox" name="isDriver" <?=$user->isDriver ? 'checked' : ''?>>
<span class="slider round"></span>
</label>
</div>
<div class="col-1 text-left"></div>
</div>
<br>
<br>
<div class="row">
<div class="col-1 text-left"></div>
<div class="col-2 text-left">
<div class="col-3 text-left">
<a class="btn red" href="/main/profil?u=<?=$id?>">BACK</a>
</div>
<div class="col-2 text-right">
<div class="col-3 text-right">
<input class="btn green" type="submit" value="SAVE">
</div>
<div class="col-1 text-left"></div>
</div>
</div>
</form>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment