<?php
session_start();
if(isset($_SESSION['user_email'])){
    $email=$_SESSION['user_email'];
    require_once("sidebar.php");
    require_once("header.php");
    require_once('database.php');
    $query="SELECT name,email,password,phone,address FROM customers WHERE email='$email'";
    $rec=db::getRecord($query);
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" />
 
<style>
.field-icon {
  float: right;
  margin-left: -25px;
  margin-top: -25px;
  position: relative;
  z-index: 2;
}
    .field_icon{
    float: right;
    margin-top: -20px;    
    }
</style>
      <div class="content" >
        <div class="content">
          <div class="container-fluid" style="margin-top:-40px">
            <div class="row">
              <div class="col-md-12">
                <div class="card " style="min-height:550px">
                    
                <div class="card-header card-header-info" style="background:#E93E21">
                  <h4 class="card-title ">Edit Profile</h4>
                </div>
                    
                   <div class="content">
        <div class="container-fluid">
            <br> <br>
          <div class="row">
              <div class="col-md-3">
              </div>
            <div class="col-md-6">
              <div class="card">
                <div class="card-header card-header-icon card-header-info">
                  <div class="card-icon">
                    <i class="material-icons">perm_identity</i>
                  </div>
                  <h4 class="card-title">Edit Profile
                  </h4>
                </div>
                <div class="card-body">
                  <form method="POST" action="action.php" enctype="multipart/form-data">
                    <div class="row">
                    
                      <div class="col-md-12">
                        <div class="form-group">
                          <labe l>Name</label>
                          <input name="name" type="text" class="form-control" value="<?php  echo $rec['name']; ?>">
                        </div>
                      </div>
                      <div class="col-md-12">
                        <div class="form-group">
                          <labe l>Email address</label>
                          <input name="email" type="text" class="form-control" value="<?php  echo $rec['email']; ?>" disabled>
                        </div>
                        </div>
                    </div>
                      

                          <div class="row">
                     <div class="col-md-6">
                        <div class="form-group">
                          <labe l>Phone Number</label>
                          <input name="number" type="text" class="form-control" value="<?php  echo $rec['phone']; ?>">
                        </div>
                      </div>
                      <div class="col-md-6">
                        <div class="form-group">
                          <labe l>Change password</label>
                          <input name="password" type="password" class="form-control" id="pass_log_id" value="<?php  echo $rec['password']; ?>">
                          <span toggle="#password-field" class="fa fa-fw fa-eye field_icon toggle-password"></span>
                        </div>
                      </div>
                    </div>
                    <!-- <div class="row">-->
                    <!-- <div class="col-md-12">-->
                    <!--    <div class="form-group">-->
                    <!--      <labe l>Change Address</label>-->
                    <!--      <input name="address" type="text" class="form-control" value="<?php  echo $rec['address']; ?>">-->
                    <!--    </div>-->
                    <!--  </div>-->
                    <!--</div>-->
                   
                      
                    <br>
                    <button type="submit" name="edit_user_profile" class="btn btn-info pull-right" style="background:#E93E21"">Update Profile</button>
                    <div class="clearfix"></div>
                  </form>
                </div>
              </div>
            </div>
           
          </div>
        </div>
      </div>
      
                          </div>
                          </div>
                        </div>
           
              
                      </div>
                    </div>
                  </div>
<script>
$(document).on('click', '.toggle-password', function() {

    $(this).toggleClass("fa-eye fa-eye-slash");
    
    var input = $("#pass_log_id");
    input.attr('type') === 'password' ? input.attr('type','text') : input.attr('type','password')
});
</script>

<?php
require_once('footer.php');
}

else{
   echo "<script>location='../index.php'</script>";   
}
?>