<?php
ob_start();
include('../includes/db_conx.php');

isset($_SESSION['detect_login']);
if (!isset($_SESSION['detect_login'])) {
    header("location: ../online/customer_login");
    exit();
} else {
    $id = $_SESSION['id'];
    // echo $id;
    // get all the varible from the database for personal information 
    include('../includes/cus-info.php');

    include('../includes/dash-header.php');
}
?>
<!--  -->
<!-- header begin-->

<body>
    <?php
    include('../includes/side-nav.php');
    ?>
    <div class="main-content" id="panel">
        <!-- Topnav -->
        <?php
        include('../includes/top-nav.php');
        ?>


        <div class="header pb-4">
            <div class="container-fluid">
                <div class="header-body">
                </div>
            </div>
        </div>
        <!-- header end -->

        <div class="header pb-6 d-flex align-items-center" style="min-height: 300px; background-image: url(../asset/images/shutterstock_1145329577-scaled.jpg); background-size: cover; background-position: center top;">
            <!-- Mask -->
            <span class="mask bg-gradient-default opacity-4"></span>
        </div>
        <div class="container-fluid mt--6">
            <div class="content-wrapper">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card bg-white">
                            <div class="card-body">
                                <div class="">
                                    <h3 class="">Welcome! <?= $first_name . ' ' . $last_name ?>
                                        <br />Acct - #<?= $account_no ?> ( <?= $account_no ?> )
                                    </h3>
                                    <h1 class="btn btn-lg btn-neutral">Available Balance $<?= number_format($avaliable_balance, 2) ?></h1>
                                    <h1 class="btn btn-lg btn-neutral">Current Balance $<?= number_format($leger_balance, 2) ?> </h1>

                                </div>
                                <br />

                                <div class="">
                                    <a href='coinpayment'>
                                        <marquee direction="left"> Heads up, you can now make deposit using crypto click here to continue </marquee>
                                    </a>


                                </div>

                                <br />
                                <div class='row'>
                                    <div class='col-4'>
                                        <a href="other_bank_dom" class="btn btn-primary btn-lg active w-100" role="button" aria-pressed="true"> <i class="ni ni-air-baloon"></i>
                                            Domestic Transfer</a>
                                    </div>
                                    <div class='col-4'>
                                        <a href="other_bank" class="btn btn-success btn-lg active w-100" role="button" aria-pressed="true"> <i class="ni ni-planet"></i> International Transfer</a>
                                    </div>
                                    <div class='col-4'>
                                        <a href="loan" class="btn btn-info btn-lg active w-100" role="button" aria-pressed="true"> <i class="ni ni-money-coins"></i> Loans</a>
                                    </div>

                                </div>



                            </div>
                        </div>
                    </div>
                </div>
                <div style="height:40px; padding:0px; margin:0px; width: 100%;"><iframe src="https://widget.coinlib.io/widget?type=horizontal_v2&amp;theme=light&amp;pref_coin_id=1505&amp;invert_hover=" width="100%" height="36px" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" border="0" style="border:0;margin:0;padding:0;"></iframe></div>
            </div>
            <div class="row">
                <div class="col-lg-4">
                    <div class="card bg-white border-0">
                        <div class="card-body">
                            <div class="row">
                                <div class="col">
                                    <h3 class="card-title mb-0">2fa security</h3>
                                    <span class="badge badge-pill badge-primary">
                                        Disabled
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="card bg-white shadow">
                        <!-- Card header -->
                        <div class="card-body">


                            <?php

                            if ($c_status == 0) {



                            ?>

                                <div class="row align-items-center">
                                    <div class="col-8">
                                        <!-- Title -->
                                        <h5 class="h4 mb-0 text-success">Need a Card?<span class="badge badge-pill badge-info"></span></h5>
                                    </div>
                                </div>
                                <br>

                                <div class="col-sm-4">
                                    <div class="card mb-3 mb-sm-0">

                                        <div class="cardcc" style="width: 100%;">
                                            <div class="cardcc__front cardcc__part">
                                                <img class="cardcc__front-square cardcc__square" src="../asset/images/favicoin.png">
                                                <img class="cardcc__front-logo cardcc__logo" src="../asset/images/visa.png">
                                                <p class="cardcc_numer"> XXXX XXXX XXXX XXXX </p>
                                                <div class="cardcc__space-75">
                                                    <span class="cardcc__label">card holder</span>
                                                    <p class="cardcc__info">***** *****</p>
                                                </div>
                                                <div class="cardcc__space-25">
                                                    <span class="cardcc__label">Expires</span>
                                                    <p class="cardcc__info">**/**</p>
                                                </div>
                                            </div>

                                            <div class="cardcc__back cardcc__part">
                                                <div class="cardcc__black-line"></div>
                                                <div class="cardcc__back-content">
                                                    <div class="cardcc__secret">
                                                        <p class="cardcc__secret--last">***</p>
                                                    </div>
                                                    <img class="cardcc__back-square cardcc__square" src="../asset/images/chip.png">
                                                    <img class="cardcc__back-logo cardcc__logo" src="../asset/images/visa.png">

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <br />

                                <a href="card_request"><i class="fa fa-arrow-right"></i> Request</a>

                            <?php
                            } else {


                            ?>

                                <div class="col-sm-4">
                                    <div class="card mb-3 mb-sm-0">

                                        <div class="cardcc" style="width: 100%;">
                                            <div class="cardcc__front cardcc__part">
                                                <img class="cardcc__front-square cardcc__square" src="../asset/images/favicoin.png">
                                                <img class="cardcc__front-logo cardcc__logo" src="../asset/images/visa.png">
                                                <?php $new_c_no = substr($c_number, 0, -15); ?>
                                                <p class="cardcc_numer"> <?= $new_c_no ?> XXXX XXXX XXXX </p>
                                                <div class="cardcc__space-75">
                                                    <span class="cardcc__label">card holder</span>
                                                    <p class="cardcc__info"><?= $first_name . ' ' . $last_name ?></p>
                                                </div>
                                                <div class="cardcc__space-25">
                                                    <span class="cardcc__label">Expires</span>
                                                    <p class="cardcc__info"><?= $c_exp_date ?></p>
                                                </div>
                                            </div>

                                            <div class="cardcc__back cardcc__part">
                                                <div class="cardcc__black-line"></div>
                                                <div class="cardcc__back-content">
                                                    <div class="cardcc__secret">
                                                        <p class="cardcc__secret--last"><?= $c_cvc ?></p>
                                                    </div>
                                                    <img class="cardcc__back-square cardcc__square" src="../asset/images/chip.png">
                                                    <img class="cardcc__back-logo cardcc__logo" src="../asset/images/visa.png">

                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <br />
                                <br />
                                <a href="#" data-toggle="modal" data-target="#exampleModal"><i class="fa fa-arrow-right"></i> See More</a>
                                <!-- Button trigger modal -->


                                <!-- Modal -->
                                <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h5 class="modal-title" id="exampleModalLabel"><?= $sitename ?> Virtual Card </h5>
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                    <span aria-hidden="true">&times;</span>
                                                </button>
                                            </div>
                                            <div class="modal-body">
                                                <small> Card Number </small>
                                                <p><?= $c_name ?></p>
                                                <!-- ================================ -->
                                                <small> Expiration </small>
                                                <p><?= $c_exp_date ?></p>
                                                <!-- ================================ -->
                                                <small> CVV </small>
                                                <p><?= $c_cvc ?></p>

                                                <!-- ================================ -->
                                                <small> Billing Address </small>
                                                <p><?= $address ?></p>

                                                <h4 class='text-center'>
                                                    CURRENT BALANCE 
                                                </h4>
                                                <h1 class='text-center'>
                                                    <small> <?= $currency ?></small> <?= number_format($withheld_fund, 2) ?>
                                                </h1>
                                                <p class='text-center'> Fund your Card below using funds from your <br /> <?= $sitename ?> Available Balance</p>
                                                <style>
                                                    .card_btn {
                                                        width: 90%;
                                                        display: block;
                                                        margin: 10px auto;
                                                    }
                                                </style>
                                                <div class='row'>
                                                    <div class='col-6'>
                                                        <a href='fund_card.php'>
                                                            <button type="button" class="btn btn-success card_btn">Fund</button>
                                                        </a>
                                                    </div>
                                                    <!-- <div class='col-6'> <button type="button" class="btn btn-primary card_btn">Withdraw</button></div> -->
                                                </div>


                                            </div>





                                        </div>
                                    </div>
                                </div>

                            <?php   }    ?>
                            <br>



                        </div>
                    </div>

                    <div class="card bg-white shadow">
                        <!-- Card header -->
                        <div class="card-body">
                            <div class="row align-items-center">
                                <div class="col-8">
                                    <!-- Title -->
                                    <h5 class="h4 mb-0 text-success">Savings <span class="badge badge-pill badge-info">Interest: 3%</span></h5>
                                </div>
                            </div>
                            <p class="card-text mb-4 text-dark">Join our program and learn to save wisely ahead for your future. Funds won't be available still target date is reached.</p>
                            <!-- <a href="save.html"><i class="fa fa-arrow-right"></i> Get started</a> -->
                        </div>
                    </div>

                    <div class="card bg-white shadow">
                        <!-- Card header -->
                        <div class="card-body">
                            <div class="row align-items-center">
                                <div class="col-8">
                                    <!-- Title -->
                                    <h5 class="h4 mb-0 text-success">Py scheme <span class="badge badge-pill badge-info">plan based</span></h5>
                                </div>
                            </div>
                            <p class="card-text mb-4 text-dark">A yearly investment feature that gives you the opportunity to earn more. Let your money work for you by learning to take advantage of py scheme plan. Invest today and save tomorrow. </p>
                            <!-- <a href="plans.html"><i class="fa fa-arrow-right"></i> Check out plans</a> -->
                        </div>
                    </div>

                </div>
                <div class="col-lg-8">
                    <div class="row">
                    </div>
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="card bg-white shadow">
                                <div class="card-header bg-transparent">
                                    <h3 class="mb-0 text-black">Recent Transaction</h3>
                                </div>
                                <div class="card-body">
                                    <div class="timeline timeline-one-side" data-timeline-content="axis" data-timeline-axis-style="dashed">



                                        <?php
                                        while ($row_trans = mysqli_fetch_assoc($query_trans)) {
                                            $name_bank = $row_trans['name_bank'];
                                            $b_name = $row_trans['b_name'];
                                            $b_acc_no = $row_trans['b_acc_no'];
                                            $amount = $row_trans['amount'];
                                            $t_time = $row_trans['t_time'];
                                            $ref = $row_trans['ref'];
                                            $trans_status = $row_trans['trans_status'];
                                            $mode = $row_trans['mode'];
                                            $description = $row_trans['description'];


                                        ?>

                                            <?php
                                            if ($trans_no <= 0) {
                                                echo '<div class="alert alert-info" role="alert">
                                                       No records found
                                                    </div>';
                                            } else {




                                            ?>



                                                <div class="timeline-block">
                                                    <span class="timeline-step badge-primary">
                                                        <i class="ni ni-like-2"></i>
                                                    </span>
                                                    <div class="timeline-content">
                                                        <small class="text-dark font-weight-bold">#<?= $ref ?></small>
                                                        <p class="text-primary text-sm mt-1 mb-0">Amt: <?= $currency ?><?= number_format($amount, 2) ?>, Acct:<?= $b_acc_no ?>, Date:<?= $t_time ?>, <?php
                                                                                                                                                                                                        if ($mode == 'deposit') {
                                                                                                                                                                                                            echo 'CR ';
                                                                                                                                                                                                        } else {
                                                                                                                                                                                                            echo 'DR ';
                                                                                                                                                                                                        }

                                                                                                                                                                                                        ?> Amt:<?= number_format($amount, 2) ?>USD,
                                                            Ref:<?= $ref ?>, Desc:<?= $description ?></p>
                                                        <div class="mt-3">
                                                            <?php
                                                            if ($mode == 'deposit') {
                                                                echo '<span class="badge badge-pill badge-success">
                                                                        Credit
                                                                    </span>';
                                                            } else {
                                                                echo '<span class="badge badge-pill badge-primary">
                                                                        Debit
                                                                    </span>';
                                                            }

                                                            ?>


                                                            <span class="badge badge-pill badge-secondary">
                                                                Successful
                                                            </span>
                                                        </div>
                                                    </div>
                                                </div>

                                        <?php
                                            }
                                        }

                                        ?>





                                    </div>
                                </div>
                            </div>

                            <div class="card">
                                <div class="card-header header-elements-inline">
                                    <h3 class="mb-0">News</h3>
                                </div>
                                <div style="height:560px; padding:0px; margin:0px; width: 100%;"><iframe src="https://widget.coinlib.io/widget?type=chart&amp;theme=light&amp;coin_id=859&amp;pref_coin_id=1505" width="100%" height="565px" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" border="0"></iframe></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card">
                <div class="card-header header-elements-inline">
                    <h3 class="mb-0">Asset rate</h3>
                </div>
                <div class="table-responsive">
                    <table class="table align-items-center table-flush">
                        <thead class="">
                            <tr>
                                <th>S/n</th>
                                <th>Name</th>
                                <th>Rate</th>
                                <th>Reserve</th>
                                <th>Coin</th>
                                <th>Buying</th>
                                <th>Selling</th>
                                <th>Exchange</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>1.</td>
                                <td>Gold</td>
                                <td class="text-red">1 USD = 0.043909XAG</td>
                                <td class="text-blue">1836.3075XAG</td>
                                <td>
                                    <span class="badge badge-success">Yes</span>
                                </td>
                                <td>4%</td>
                                <td>2%</td>
                                <td>6%</td>
                            </tr>
                            <tr>
                                <td>2.</td>
                                <td>Brazilian Real</td>
                                <td class="text-red">1 USD = 5.23055BRL</td>
                                <td class="text-blue">2487.48BRL</td>
                                <td>
                                    <span class="badge badge-danger">No</span>
                                </td>
                                <td>4%</td>
                                <td>2%</td>
                                <td>6%</td>
                            </tr>
                            <tr>
                                <td>3.</td>
                                <td>Argentine Peso</td>
                                <td class="text-red">1 USD = 71.83969ARS</td>
                                <td class="text-blue">69548.800ARS</td>
                                <td>
                                    <span class="badge badge-danger">No</span>
                                </td>
                                <td>4%</td>
                                <td>2%</td>
                                <td>6%</td>
                            </tr>
                            <tr>
                                <td>4.</td>
                                <td>Euro</td>
                                <td class="text-red">1 USD = 0.781769GBP</td>
                                <td class="text-blue">18952.236GBP</td>
                                <td>
                                    <span class="badge badge-danger">No</span>
                                </td>
                                <td>4%</td>
                                <td>2%</td>
                                <td>6%</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- </div>   
        </div>
      </div>
    </div> -->





            <!-- footer begin -->
            <footer class="footer pt-0">

            </footer>
        </div>
    </div>

    <?php
    include('../includes/dash_footer.php') ?>
</body>


<!-- -->

</html>

<script>
</script>
<script type="text/javascript">
    $('.preloader').fadeOut(1000);
</script>
<?php
ob_end_flush();
?>