<?php
require_once('../redd/lib/table-traits.php');
require_once('../redd/lib/basic-function.php');
require_once('../' . $basicFunctn->admin_url . '/lib/mailing/emails.php');
require_once('../' . $basicFunctn->admin_url . '/lib/user-functions.php');
// print_r($user);die();
$title = 'Forgot Password';
require_once('head-auth.php') ?>

<body class="uk-dark
    uk-background-cover uk-background-norepeat" style="background-image: url(assets/images/background/img-32.jpg);">

    <div class="uk-grid-collapse uk-flex" style="height: 100vh;" data-uk-grid>
        <div class="uk-padding-large uk-flex uk-flex-middle uk-flex-center  row mx-auto" data-uk-height-viewport>
            <div class="uk-width-3-4@s">
                <div class="uk-text-center uk-margin-bottom">
                    <a class="uk-logo uk-text-primary uk-text-bold"></a>
                    <img src="logo-dark.png" alt="" href="../index.html">
                </div>
                <div class="row flex-column card text-13">
                    <div class="uk-text-center text-theme">
                        <!-- <h2>Forgot Your Password?</h2> -->
                    </div>
                    <div class="pdd-horizon-30 pdd-vertical-30">
                        <div class="uk-text-center uk-margin">
                            <p class="uk-margin-remove">Forgot Your Password?</p>
                        </div>
                        <form class="forgot_pass_form">
                            <div class="uk-width-1-1 uk-margin">
                                <!-- <label class="uk-form-label" for="email">Email</label> -->
                                <input name="forgot_pass_email" class="uk-input uk-form-large form-control text-13" type="email" placeholder="Email">
                            </div>
                            <!-- <div class="uk-width-1-1 uk-margin uk-text-right">
                        <p class="uk-text-small uk-margin-remove"><a class="uk-link-border" href="#">Forgot Password?</a></p>
                    </div> -->
                            <div class="uk-width-1-1 uk-text-center">
                                <a class="uk-button  uk-button-large btn-secondary forgot_pass_btn btn font-poppins text-white">
                                    Submit
                                </a>
                            </div>

                            <!-- <div class="uk-width-1-1 uk-margin uk-text-center">
                        <h6 class="uk-text-small uk-margin-remove">Don't have an account? <a class="uk-link-border " href="register">Sign Up</a> </h6>
                    </div> -->
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- customs scripts starts -->
    <?php require_once('scripts-auth.php') ?>
    <!-- dashboard js ends -->

    <script>
        $(document).ready(function() {

            let referrer = $('.referrer').text();
            if (referrer.length !== 0) {
                $('.registerModal').modal('show');
            }


            $('.sign_in_btn').click(async function(e) {
                e.preventDefault();
                let sign_in_form = $('.sign_in_form').serializeArray();
                // console.log(sign_in_form);
                // return;
                let form_data = set_form_data(sign_in_form);
                let returned = await ajaxRequest('ajax.php', form_data);

                if (returned.error == 1) {
                    Swal.fire("Sorry", returned.msg, "error");
                } else if (returned.error == 0) {
                    Swal.fire("Congratulations!", returned.msg + returned.first_name, "success");
                    // swal('Congratulations', returned.msg + returned.first_name, 'success');
                    setTimeout(() => {
                        window.location.href = '../user/overview';
                    }, 2000);
                }
            });

            $('.register_user_btn').click(async function(e) {
                e.preventDefault();
                let register_form = $('.register_form').serializeArray();
                // console.log(register_form);return;
                let form_data = set_form_data(register_form);
                let returned = await ajaxRequest('ajax.php', form_data);
                throwSweetalert(returned, './', 1);
                // console.log(returned);return;
            });
            $('.forgot_pass_btn').click(async function(e) {
                e.preventDefault();
                let forgot_pass_form = $('.forgot_pass_form').serializeArray();
                let form_data = set_form_data(forgot_pass_form);
                // console.log(forgot_pass_form);
                let returned = await ajaxRequest('ajax.php', form_data);
                // console.log(returned);return;
                if (returned.error == 1) {
                    Swal.fire("Sorry", returned.msg, "error");
                } else if (returned.error == 0) {
                    Swal.fire("Congratulations!", returned.msg, "success");
                    // swal('Congratulations', returned.msg + returned.first_name, 'success');
                    setTimeout(() => {
                        window.location.href = './';
                    }, 3000);
                }
            });

        });
    </script>

</body>

</html>