<?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['kyc_status'] == "pending" || $row['kyc_status'] == "review" )


{
   header("Location:kyc.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>
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
<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><!-- .nk-sidebar-element -->
                <?php include 'includes/sidebar.php'?>

                <!-- main header @e --> <!-- content @s -->
                <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="kyc-app wide-sm m-auto">
                                <div class="nk-block-head nk-block-head-lg wide-xs mx-auto">
                                    <div class="nk-block-head-content text-center">
                                        <h2 class="nk-block-title fw-normal">Virtual Card Application</h2>
                                        <div class="nk-block-des">
                                            <p>The virtual card is issued instantly when requested on Internet Banking.
                                                To request, Fill the form below;</p>
                                        </div>
                                    </div>
                                </div><!-- nk-block-head -->
                                <div class="nk-block">
                                    <div class="card card-bordered">
                                        <div class="nk-kycfm">
                                            <div class="nk-kycfm-head">
                                                <div class="nk-kycfm-count">01</div>
                                                <div class="nk-kycfm-title">
                                                    <h5 class="title">Personal Details</h5>
                                                </div>
                                            </div><!-- .nk-kycfm-head -->
                                            <div class="nk-kycfm-content">
                                                <div class="nk-kycfm-note">
                                                    <em class="icon ni ni-info-fill" data-toggle="tooltip"
                                                        data-placement="right" title="Tooltip on right"></em>
                                                    <p>Please type carefully and fill out the form with your personal
                                                        details. Your can’t edit these details once you submitted the
                                                        form.</p>
                                                </div>
                                        <form  id="cardForm">
                                                    <div class="row g-4">
                                                        <div class="col-md-12">
                                                            <div class="form-group">
                                                                <div class="form-label-group">
                                                                    <label class="form-label">Card Holder Name<span
                                                                            class="text-danger">*</span></label>
                                                                </div>
                                                                <div class="form-control-group">
                                                                    <input type="text" id="fullname" name="fullname"
                                                                        required value="<?=$row['firstname']?> <?=$row['middlename']?> <?=$row['lastname']?>"
                                                                        class="form-control form-control-lg">
                                                                </div>
                                                            </div>
                                                        </div><!-- .col -->
                                                        <div class="col-md-6">
                                                            <div class="form-group">
                                                                <div class="form-label-group">
                                                                    <label class="form-label">Phone Number <span
                                                                            class="text-danger">*</span></label>
                                                                </div>
                                                                <div class="form-control-group">
                                                                    <input type="tel" name="phone" value="<?=$row['phone']?>"
                                                                        class="form-control form-control-lg" required>
                                                                </div>
                                                            </div>
                                                        </div><!-- .col -->
                                                        <div class="col-md-6">
                                                            <div class="form-group">
                                                                <div class="form-label-group">
                                                                    <label class="form-label">Email Address <span
                                                                            class="text-danger">*</span></label>
                                                                </div>
                                                                <div class="form-control-group">
                                                                    <input type="email" name="email" required
                                                                        value="<?=$row['email']?>"
                                                                        class="form-control form-control-lg">
                                                                </div>
                                                            </div>
                                                        </div><!-- .col -->
                                                        <div class="col-md-12">
                                                            <div class="form-group">
                                                                <div class="form-label-group">
                                                                    <label class="form-label">Address <span
                                                                            class="text-danger">*</span></label>
                                                                </div>
                                                                <div class="form-control-group">
                                                                    <input type="text" name="address"
                                                                        value="12 ZIEGLER AVE, POUGHKEEPSIE, NY, 12603 Poughkeepsie  New York USA"
                                                                        class="form-control form-control-lg">
                                                                </div>
                                                            </div>
                                                        </div><!-- .col -->
                                                        <div class="col-md-6">
                                                            <div class="form-group">
                                                                <div class="form-label-group">
                                                                    <label class="form-label">Security Question <span
                                                                            class="text-danger">*</span>
                                                                    </label>
                                                                </div>
                                                                <div class="form-control-group">
                                                                    <select type="text" name="question"
                                                                        class="form-control form-control-lg" required>
                                                                        <option value="">Please Select Question*
                                                                        </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>
                                                        </div><!-- .col -->
                                                        <div class="col-md-6">
                                                            <div class="form-group">
                                                                <div class="form-label-group">
                                                                    <label class="form-label">Answer <span
                                                                            class="text-danger">*</span></label>
                                                                </div>
                                                                <div class="form-control-group">
                                                                    <input type="text" name="answer" required
                                                                        class="form-control form-control-lg">
                                                                </div>
                                                            </div>
                                                        </div><!-- .col -->
                                                    </div><!-- .row -->
                                            </div><!-- .nk-kycfm-content -->
                                            <div class="nk-kycfm-head">
                                                <div class="nk-kycfm-count">02</div>
                                                <div class="nk-kycfm-title">
                                                    <h5 class="title">Card Preference</h5>
                                                </div>
                                            </div><!-- .nk-kycfm-head -->
                                            <div class="nk-kycfm-content">
                                                <div class="nk-kycfm-note">
                                                    <em class="icon ni ni-info-fill" data-toggle="tooltip"
                                                        data-placement="right" title="Tooltip on right"></em>
                                                    <p>Kindly select your preferred virtual card type.</p>
                                                </div>
                                                <ul class="nk-kycfm-control-list g-3">
                                                    <li class="nk-kycfm-control-item">
                                                        <input class="nk-kycfm-control" type="radio" name="card_type"
                                                            id="visa" data-title="visa" checked value="visa">
                                                        <label class="nk-kycfm-label" for="visa">
                                                            <span class="nk-kycfm-label-icon">
                                                                <div class="label-icon">
                                                                    <em class="icon ni ni-visa h3 text-primary"></em>
                                                                </div>
                                                            </span>
                                                            <span class="nk-kycfm-label-text">Visa</span>
                                                        </label>
                                                    </li><!-- .nk-kycfm-control-item -->
                                                    <li class="nk-kycfm-control-item">
                                                        <input class="nk-kycfm-control" type="radio" name="card_type"
                                                            id="mastercard" data-title="MasterCard" value="mastercard">
                                                        <label class="nk-kycfm-label" for="mastercard">
                                                            <span class="nk-kycfm-label-icon">
                                                                <div class="label-icon">
                                                                    <em
                                                                        class="icon ni ni-master-card h3 text-danger"></em>
                                                                </div>
                                                            </span>
                                                            <span class="nk-kycfm-label-text">MasterCard</span>
                                                        </label>
                                                    </li><!-- .nk-kycfm-control-item -->
                                                    <li class="nk-kycfm-control-item">
                                                        <input class="nk-kycfm-control" type="radio" name="card_type"
                                                            id="discover" data-title="Discover" value="discover">
                                                        <label class="nk-kycfm-label" for="discover">
                                                            <span class="nk-kycfm-label-icon">
                                                                <div class="label-icon">
                                                                    <em
                                                                        class="icon ni ni-cc-discover h3 text-primary"></em>
                                                                </div>
                                                            </span>
                                                            <span class="nk-kycfm-label-text">Discover</span>
                                                        </label>
                                                    </li><!-- .nk-kycfm-control-item -->
                                                </ul><!-- .nk-kycfm-control-list -->
                                                <h6 class="title">Features and Benefits of  <?= htmlspecialchars(getSetting('site_name', 'Deutsche Bank Holdings Delaware')) ?>  Virtual Card:
                                                </h6>
                                                <ul class="list list-sm list-checked">
                                                    <li>It’s Virtual: You don’t need to carry it out around to use it
                                                        for online transactions as it's virtually available on your
                                                        Internet Banking.</li>
                                                    <li>The card can be loaded from your existing Account via Internet
                                                        Banking.</li>
                                                    <li>It's readily available after approval.</li>
                                                    <li>It valid for 3 years.</li>
                                                </ul>
                                            </div><!-- .nk-kycfm-content -->
                                            <div class="nk-kycfm-footer">
                                                <div class="form-group">
                                                    <div class="custom-control custom-control-xs custom-checkbox">
                                                        <input type="checkbox" class="custom-control-input"
                                                            id="tc-agree" required>
                                                        <label class="custom-control-label" for="tc-agree">I Have Read
                                                            The <a href="">Terms Of Condition</a> And <a
                                                                href="privacy">Privacy Policy</a></label>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <div class="custom-control custom-control-xs custom-checkbox">
                                                        <input type="checkbox" class="custom-control-input"
                                                            id="info-assure" required>
                                                        <label class="custom-control-label" for="info-assure">All The
                                                            Personal Information I Have Entered Is Correct.</label>
                                                    </div>
                                                </div>
                                                <div id="cardResult"></div>
                                                <div class="nk-kycfm-action pt-2">
                                                    <button type="submit" class="btn btn-lg btn-primary"
                                                        id="btn">Apply</button>
                                                </div>
                                            </div><!-- .nk-kycfm-footer -->
                                        </div><!-- .nk-kycfm -->
                                    </form>
                                    </div><!-- .card -->
                                </div><!-- nk-block -->
                            </div><!-- kyc-app -->
                        </div>
                    </div>
                </div>
                <script src="../js/jquery.min.js"></script>
                <script type="text/javascript">
$(document).ready(function (e) {
    $("#cardForm").on('submit', function (e) {
        e.preventDefault();
        document.getElementById("btn").disabled = true;

        $.ajax({
            url: "../apps/user/auth.php",
            type: "POST",
            data: new FormData(this),
            contentType: false,
            cache: false,
            processData: false,
            success: function (data) {
                document.getElementById("btn").disabled = false;
                var info = data.trim();
                if (info === 'success') {
                    Swal.fire({
                        icon: 'success',
                        title: 'Application Submitted',
                        text: 'Your virtual card application has been submitted and is awaiting approval.',
                        showConfirmButton: true
                    }).then(function () {
                        window.location = 'virtual-card';
                    });
                } else {
                    Swal.fire({
                        icon: 'warning',
                        title: 'Notice',
                        text: info,
                        showConfirmButton: true
                    });
                }
            },
            error: function () {
                Swal.fire({
          icon: 'error',
          title: 'Error',
          text: 'There was a problem with the request. Please try again later.',
          showConfirmButton: true
        });

        console.log(data);
            }
        });
    });
});
</script>
                <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>