<?php
// Initialize the session
require_once "../includes/header.php";
?>

<body class="bg-light">

    <!-- loader -->
    <div id="loader">
        <img src="assets/img/logo-icon.png" alt="icon" class="loading-icon">
    </div>
    <!-- * loader -->

    <!-- App Header -->
    <div class="appHeader no-border">
        <div class="left">
            <a href="javascript:;" class="headerButton goBack">
                <ion-icon name="chevron-back-outline"></ion-icon>
            </a>
        </div>
        <div class="pageTitle"></div>
        <div class="right">
        </div>
    </div>
    <!-- * App Header -->

    <!-- App Capsule -->
    <div id="appCapsule">

        <div class="section mt-2 text-center">
            <h1>Reset password</h1>
            <h4>Type your e-mail to reset your password</h4>
        </div>
        <div class="section mt-2 mb-5 p-3">
           <form id="forgotForm">
                <div class="form-group basic">
                    <div class="input-wrapper">
                        <label class="label" for="email1">E-mail</label>
                      <input type="email" name="email" class="form-control" placeholder="Enter your email" required>
                        <i class="clear-input"><ion-icon name="close-circle"></ion-icon></i>
                    </div>
                </div>
                
                <div id="forgotLoader" class="text-center mt-3" style="display:none;">
                    <div class="spinner-border text-primary" role="status"></div>
                </div>

                <div class="form-button-group">
                     <button type="button" id="forgotBtn" class="btn btn-primary btn-block btn-lg">Reset Password</button>
                </div>

            </form>
        </div>

    </div>
    <!-- * App Capsule -->



    <!-- ///////////// Js Files ////////////////////  -->
    <!-- Jquery -->
    <script src="assets/js/lib/jquery-3.4.1.min.js"></script>
    <!-- Bootstrap-->
    <script src="assets/js/lib/popper.min.js"></script>
    <script src="assets/js/lib/bootstrap.min.js"></script>
    <!-- Ionicons -->
    <script src="../../../../unpkg.com/ionicons%405.0.0/dist/ionicons.js"></script>
    <!-- Owl Carousel -->
    <script src="assets/js/plugins/owl-carousel/owl.carousel.min.js"></script>
    <!-- Base Js File -->
    <script src="assets/js/base.js"></script>
    
    
    <script>
$("#forgotBtn").click(function () {

    $("#forgotLoader").show();
    $("#forgotBtn").prop("disabled", true);

    $.ajax({
        url: "../includes/forgot-process.php",
        type: "POST",
        data: $("#forgotForm").serialize(),
        dataType: "json",

        success: function(res){
            $("#forgotLoader").hide();
            $("#forgotBtn").prop("disabled", false);

            if(res.status === "success"){
                //alert("Password updated successfully");
                window.location.href = "app-reset-password.php";
            } else {
                alert("Reset failed");
            }
        }
    });
});
</script>



</body>

