diff --git a/public/style.css b/public/style.css index 683b3811a4c9156b1e5a951feb762128d991472f..dd2cac97e056888066da36064f9dcf7cab68bc8f 100755 --- a/public/style.css +++ b/public/style.css @@ -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 { diff --git a/src/controller/ProfilController.php b/src/controller/ProfilController.php index 4a931895c240f08311091250b689c142334622c0..6a39d3b3e8d05cf0a752f1902561bf52b303386f 100644 --- a/src/controller/ProfilController.php +++ b/src/controller/ProfilController.php @@ -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 diff --git a/src/view/profil_edit.php b/src/view/profil_edit.php index 0b790460857bfdbb377b5a28dc1624e655aa739f..c0150991299e02b82663aa6c1a66659b79065f94 100644 --- a/src/view/profil_edit.php +++ b/src/view/profil_edit.php @@ -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>