<?php include 'inc/header.php'; ?>
<!-- ====== End Header ===== -->
<?php include 'inc/sidebar.php'; ?>

 <div class="main-content">
 	<section class="section">
 	<div class="section-header">
            <div class="row">
              <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12">
                <div class="section-header-breadcrumb-content">
                  <h1> Profile</h1>
                  <div class="section-header-breadcrumb">
                    <div class="breadcrumb-item active"><a href="#"><i class="fas fa-home"></i></a></div>
                    <div class="breadcrumb-item"><a href="#">Admin</a></div>
                    <div class="breadcrumb-item"><a href="#"> Profile</a></div>
                  </div>
                </div>
              </div>
             
            </div>
          </div>
       <div class="row justify-content-center">
         <div class="col-lg-3">
            <?php include 'admin_sidebar.php';?>
         </div>
        
         <div class="col-lg-9 mt-5 mt-lg-0">
         	<ul class="nav nav-pills nav-justified tab-nav">
               <li class="nav-item" role="presentation">
                  <a class="nav-link active" id="tutor-tab" data-toggle="tab" href="#tutor" role="tab" aria-controls="tutor" aria-selected="true">Admin Profile</a>
               </li>
              
            </ul>
            <div class="p-30 mb-35 bg-white shadow rounded" style="margin-top: 55px;
    padding: 30px;">
               
                <hr>
                
                    <form method="post" action="password_query.php">
                        <div class="row">
          
                            <div class="col-md-12">
                                <?php if (isset($_SESSION['msg_scs'])): ?>
            <p class="alert alert-success"><?= $_SESSION['msg_scs'];?></p>
          <?php endif ?>
          <?php unset($_SESSION['msg_err']);?>
             <?php if (isset($_SESSION['msg_err'])): ?>
            <p class="alert alert-danger"><?= $_SESSION['msg_err'];?></p>
          <?php endif ?>
          <?php unset($_SESSION['msg_err']);?>
           <?php unset($_SESSION['err']);?>
             <?php if (isset($_SESSION['err'])): ?>
            <p class="alert alert-danger"><?= $_SESSION['err'];?></p>
          <?php endif ?>
          <?php unset($_SESSION['err']);?>
                               <div class="form-group">
                                 <label>Current Password</label>
                                 <input type="password" name="cp" id="cp" class="form-control" placeholder="Current Password" required>
                               </div>
                             </div>
                             <div class="col-md-6">
                               <div class="form-group">
                                 <label>New Password</label>
                                 <input type="password" name="np" id="np" class="form-control"  placeholder="New Password" required>
                               </div>
                             </div>
                             <div class="col-md-6">
                               <div class="form-group">
                                <label>Confirm Password</label>
                                 <input type="hidden" name="user" id="user" value="<?php echo $ses_row['id'];?>">
                                 <input type="password" name="cnp" id="cnp" class="form-control"  placeholder="Confirm Passowrd" required>
                               </div>
                             </div>
                             <button class="btn btn-primary w-100 " name="change_password"  type="submit">Update Password</button>
                         </div>
                           </form>
                            <script>
                        $(document).ready(function(){
                            $('#individual_change_password').on('click', function(){
                                var cp = $('#op');
                                var np = $('#np');
                                var cnp = $('#cp');
                                    if(cp.val() == ''){
                                       cp.css('border', '1px solid red');
                                       alert("Current Password Required");
                                       return false;
                                    }

                                    else if(np.val() == ''){
                                        np.css('border', '1px solid red');
                                        alert("New Password Required");
                                        return false;
                                    }

                                    else if(cnp.val() == ''){
                                        cnp.css('border', '1px solid red');
                                        alert("Confrim Password Required");
                                        return false;
                                    }

                                    else if(np.val()!= cnp.val()){
                                        cnp.css('border', '1px solid red');
                                        alert("Password Not Matched");
                                        return false;
                                    }
                                    else{
                                        return true;
                                    }

                            });
                        });
                    </script>
                   
              

</section>
 </div>

<?php include 'inc/footer.php';  ?>
