<?php include("cn.php");?>
<?php $title = "Profile Settings";?>
<!DOCTYPE html>
<html lang="en">
<?php include("head-tag.php");?>

<?php 
       $sql_1 = mysqli_query($connect,"select * from users where
        Id = '".$_SESSION["userid"]."' ");
        $data_1 = mysqli_fetch_assoc($sql_1);
?>

<body>

<div class="inner-wrapper">
<?php include("pre-loader.php");?>

<?php include("header.php");?>

<div class="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-xl-3 col-lg-4 col-md-12 theiaStickySidebar">
<aside class="sidebar sidebar-user">
        <div class="card ctm-border-radius shadow-sm">
            <div class="card-body py-4">
                <div class="row">
                    <div class="col-md-12 mr-auto text-left">
                        <div class="custom-search input-group">
                            <div class="custom-breadcrumb">
                                <ol class="breadcrumb no-bg-color d-inline-block p-0 m-0 mb-2">
                                    <li class="breadcrumb-item d-inline-block"><a href="index.php" class="text-dark">Home</a></li>
                                    <li class="breadcrumb-item d-inline-block active"><?php echo $title?></li>
                                </ol>
                                <h4 class="text-dark">Admin Dashboard</h4>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <div class="user-card card shadow-sm bg-white text-center ctm-border-radius">
        <div class="user-info card-body">
            <div class="user-avatar mb-4">
                <img src="<?php 
                                                
        $sql_1 = mysqli_query($connect,"select * from users where
        Id = '".$_SESSION["userid"]."' ");
        $data_1 = mysqli_fetch_assoc($sql_1);
        echo $data_1["Image"];
    ?>" alt="User Avatar" class="img-fluid rounded-circle" width="100">
            </div>
            <div class="user-details">
                <h4><b>Welcome <?php echo $_SESSION["name"];?></b></h4>
            </div>
        </div>
    </div>
       
    </aside>
</div>
<div class="col-xl-9 col-lg-8  col-md-12">
<div class="row">
<div class="col-lg-6 d-flex">
<div class="card flex-fill ctm-border-radius shadow-sm">
<div class="card-header">
<h4 class="card-title mb-0">Change Password</h4>
<span class="ctm-text-sm">Your password needs to be at least 8 characters long.</span>
</div>
<div class="card-body">
<form class="change" action="">
<div class="form-group">
<input type="hidden" value="<?php echo $_SESSION["userid"]?>" name = "id" id = "id" >

<input type="password" class="form-control" name = "old_pass" id = "old_pass" placeholder="Current Password" minlength="8" required>
</div>
<div class="form-group">
<input type="password" class="form-control" name = "new_pass" id = "new_pass" placeholder="New Password" minlength="8" required>
</div>
<div class="form-group">
<input type="password" class="form-control" name = "confirm_pass" id = "confirm_pass" placeholder="Repeat Password" minlength="8" required>
</div>
<div class="text-center">
<button type="submit" class="btn btn-theme button-1 ctm-border-radius text-white text-center">Change My Password</button>
</div>
</form>

</div>
</div>
</div>
<div class="col-md-6 d-flex">
<div class="card ctm-border-radius shadow-sm flex-fill">
<div class="card-header">
<h4 class="card-title mb-0">
Edit Details
</h4>
</div>
<div class="card-body">
<form method = "POST" action="ajax/edit-profile.php" enctype="multipart/form-data">
<div class="row">
<div class="col-12">
<div class="form-group">
    
<input type="hidden" value="<?php echo $_SESSION["userid"]?>" name = "id" id = "id" >

<label>Profile Picture</label>
<input type="file" name="photo" id="photo" class="dropify" data-default-file="<?php echo $data_1["Image"];?>" 
data-allowed-file-extensions='["jpg", "png", "jpeg"]'/>
</div>
<div class="form-group">
<label>Full Name</label>
<input type="text" class="form-control" name="fullname" value="<?php echo $data_1["FullName"];?>">
</div>
<div class="form-group">
<label>Email</label>
<input type="text" class="form-control" name="email" value="<?php echo $data_1["Email"];?>">
</div>
<div class="text-center">
<button type="submit" class="btn btn-theme button-1 ctm-border-radius text-white text-center">Save Changes</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</div>

<div class="sidebar-overlay" id="sidebar_overlay"></div>

<?php include("scripts.php");?>
</body>

</html>