<?php
include realpath(dirname(__DIR__) . '/include/header.php');
?>
<div class="col-xl-12">
  <div class="card">
    <div class="card-body">
      <h4 class="card-title">Change Password</h4>
      <p class="card-title-desc">Fill all information below to change your password.</p>
      <div class="alert alert-info" role="alert">
        <strong>Note:</strong> Please enter your current password and the new password you want to set.
      </div>
      <form class="needs-validation" action="?app_route=change_password_process" method="POST" id="changePasswordForm" novalidate>
        <div class="row">
          <div class="col-md-12">
            <div class="mb-3">
              <label for="username" class="form-label">Username</label>
              <input type="text" class="form-control" id="username" placeholder="Username" name="username" value="<?php echo $_SESSION['user']['username']; ?>" required>
            </div>
          </div>
          <input type="hidden" name="user_id" value="<?php echo $_SESSION['user']['id']; ?>">
          <div class="col-md-6">
            <div class="mb-3">
              <label for="currentPassword" class="form-label">New Password</label>
              <input type="password" class="form-control" id="newPassword" placeholder="Current Password" name="new_password">
            </div>
          </div>
          <div class="col-md-6">
            <div class="mb-3">
              <label for="newPassword" class="form-label">Confirm New Password</label>
              <input type="password" class="form-control" id="confirmNewPassword" placeholder="Confirm New Password" name="confirm_new_password">
            </div>
          </div>
        </div>
        <button class="btn btn-primary" type="submit" id="submitButton">Change Password</button>
      </form>
      <div class="mt-4 mb-0" id="passwordChangeResult"></div>
    </div>
  </div>
</div>

<?php
include realpath(dirname(__DIR__) . '/include/footer.php');
?>