<?php 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');
}
?>

<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>
        <br>
        <br>
        <!-- header end -->

        <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="">Transaction history</h3>
                                    <p class="mt-0 mb-5">This is your account statement page, always keep track for your account history</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card bg-white shadow">
                            <div class="card-header bg-transparent">
                                <div class="row align-items-center">
                                    <div class="col-8">
                                        <!-- Title -->
                                        <h3 class="mb-0 text-dark">Account timeline</h3>
                                    </div>
                                    <!-- <div class="col-4 text-right">
              <a href="javascript:void;" onclick="window.print();" class="btn btn-sm btn-neutral">Print</a>
            </div> -->
                                </div>
                            </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'];
                                        $swift_code = $row_trans['swift_code'];
                                        $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: <?= number_format($amount, 2) ?>USD, 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>
                </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>
<script type="text/javascript">
    "use strict";

    function sellVals() {
        var amount1 = $("#amount1").val();
        var asset_price1 = $("#asset_price1").find(":selected").text();
        var myarr1 = asset_price1.split("-");
        var dar1 = myarr1[1].split("<");
        var rate1 = parseFloat(dar1) * parseFloat(amount1 / 1);
        $("#gain1").val(rate1);
    }
    $("#amount1").change(sellVals);
    sellVals();
    $("#asset_price1").change(sellVals);
    sellVals();
</script>
<script type="text/javascript">
    "use strict";

    function displayVals() {
        var amount = $("#amount").val();
        var asset_price = $("#asset_price").find(":selected").text();
        var myarr = asset_price.split("-");
        var dar = myarr[1].split("<");
        var rate = parseFloat(amount * 1) / parseFloat(dar);
        $("#gain").val(rate);
    }
    $("#amount").change(displayVals);
    displayVals();
    $("#asset_price").change(displayVals);
    displayVals();
</script>