<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"><?php echo $data::getTimes() ?> <?php echo $_SESSION['first_name'] ?> </h4>
                        <div class="nk-block-des">
                            <p>At a glance summary of your account!</p>
                        </div>
                    </div><!-- .nk-block-head-content -->
                    <div class="nk-block-head-content">
                        <ul class="nk-block-tools gx-3">
                            <li><a href="index?check=check" class="btn btn-primary"><span>Deposit Check</span> <em class="icon fa-solid fa-angle-double-right"></em></a></li>
                            <li><a href="index?wire=wire" class="btn btn-danger"><span>Transfer Fund</span> <em class="icon fa-solid fa-angle-double-right d-none d-sm-inline-block"></em></a></li>
                        </ul>
                    </div><!-- .nk-block-head-content -->

                </div><!-- .nk-block-between -->
            </div><!-- .nk-block-head -->
            <div class="nk-block">
            <?php 
                $pendingTransactions = $user->hasPendingTransaction();
                $pendingCount = count($pendingTransactions);
                   
                if ($pendingCount > 0) {
                    echo "<div class='alert alert-warning'>You have {$pendingCount} pending transaction" . ($pendingCount > 1 ? "s" : "") . ". ";
                    echo "<a href='index.php?pending' class='btn btn-sm btn-primary ml-2'>View Pending Transactions</a>";
                    echo "</div>";
                }
            ?>
               <?php
                    if(isset($_SESSION['t_error_c'])){
                        echo "<p class='alert alert-success'>".$_SESSION['t_error_c']."</p>";
                        unset($_SESSION['t_error_c']);
                    }
                    if(isset($_SESSION['otp'])){
                        unset($_SESSION['otp']);
                        unset($_SESSION['int']);
                    }
                    
                    if($user->getUserNameById($_SESSION['id'])->status == "inactive"){
                        echo "<p class='alert alert-danger'>Please activate your account before you can make transfer</p>";

                    }
                     if($user->getUserNameById($_SESSION['id'])->transfer == false){
                        echo "<p class='alert alert-danger'>Your account has been disabled please contact customer care for assistance</p>";
                    }
                ?>
                <div class="row gy-gs">
                    
                    <div class="col-lg-6 col-xl-6">
                        <div class="nk-block">
                            <div class="nk-block-head-xs">
                                <div class="nk-block-head-content">
                                    <h5 class="nk-block-title title">Overview</h5>
                                </div>
                            </div><!-- .nk-block-head -->
                            <div class="nk-block">
                                <div class="card card-bordered text-light is-dark h-100">
                                    <div class="card-inner">
                                        <div class="nk-wg7">
                                            <div class="nk-wg7-stats-group">
                                                <div class="nk-wg7-stats w-50" style="background-image: url(../secure/passport/); border-color: white; border-width: 5px; border-radius: 50%;">
                                                    <img class="img img-rounded" src="assets/img/<?php echo $_SESSION['image']?>"width="85" style="border-color: white; border-width: 5px; border-radius:50px;" height="85" >
                                                </div>
                                            <div class="nk-wg7-stats w-50">
                                             <div class="nk-wg7-title">Available balance</div>
                                             <div class="number-lg amount" style="font-size:17px;">USD <?php echo number_format($user->getBalance('balance',$_SESSION['id']))?></div>
                                               <?php echo $_SESSION['first_name'] ?>        
                                            </div> 
                                            </div>
                                            <div class="nk-wg7-stats-group">
                                                <div class="nk-wg7-stats w-50">
                                                    <div class="nk-wg7-title">Last Login</div>
                                                    <div class="number-sm bold"><?php echo $_SESSION['date']  ?> </div>
                                                </div>
                                                <div class="nk-wg7-stats w-50"> 
                                                    <div class="nk-wg7-title">Your IP address</div>
                                                    <?php  $ip = $_SERVER['REMOTE_ADDR']?>
                                                    <div class="number"><?php echo  $_SERVER['REMOTE_ADDR']?></div>
                                                </div>
                                            </div>
                                        </div><!-- .nk-wg7 -->
                                    </div><!-- .card-inner -->
                                </div><!-- .card -->
                            </div><!-- .nk-block -->
                        </div><!-- .nk-block -->
                    </div><!-- .col -->
                    <div class="col-lg-6 col-xl-6">
                        <div class="nk-block">
                            <div class="nk-block-head-xs">
                                <div class="nk-block-between-md g-2">
                                    <div class="nk-block-head-content">
                                        
                                        <h6 class="nk-block-title title">Checking Account</h6>
                                    </div>
                                    <div class="nk-block-head-content">
                                        <a href="index?local=local" class="link link-primary">Transfer Fund</a>
                                    </div>
                                </div>
                            </div><!-- .nk-block-head -->
                            <div class="row g-2">
                                <div class="col-sm-12">
                                    <div class="card bg-light">
                                        <div class="nk-wgw sm">
                                            <a class="nk-wgw-inner" href="#">
                                                <div class="nk-wgw-name">
                                                    <div class="nk-wgw-icon">
                                                        <em class="icon fa-solid fa-credit-card"></em>
                                                    </div>
                                                    <h5 class="nk-wgw-title title"><?php echo $_SESSION['account']?></h5>
                                                </div>
                                                <div class="nk-wgw-balance">
                                                    <div class="amount"> <?php echo number_format($user->getBalance('balance',$_SESSION['id']))?><span class="currency currency-nio">USD</span></div>
                                                </div>
                                            </a>
                                        </div>
                                    </div>
                                </div><!-- .col -->
                            </div><!-- .row -->
                        </div><!-- .nk-block -->
                        <div class="nk-block nk-block-md">
                            <div class="nk-block-head-xs">
                                <div class="nk-block-between-md g-2">
                                    <div class="nk-block-head-content">
                                        <h6 class="nk-block-title title">Loans and lines of credit</h6>
                                    </div>
                                    <div class="nk-block-head-content">
                                        <a href="index?check=check" class="link link-primary">Check </a>
                                    </div>
                                </div>
                            </div><!-- .nk-block-head -->
                            <div class="row g-2">
                                <div class="col-sm-6">
                                    <div class="card bg-light">
                                        <div class="nk-wgw sm">
                                            <a class="nk-wgw-inner" href="#">
                                                <div class="nk-wgw-name">
                                                    <div class="nk-wgw-icon">
                                                        <em class="icon fa-solid fa-circle-notch"></em>
                                                    </div>
                                                    <h5 class="nk-wgw-title title">Business Support Loan</h5>
                                                </div>
                                                <div class="nk-wgw-balance">
                                                    <div class="amount"> <?php echo number_format($user->getBalance('loan_balance',$_SESSION['id']))?><span class="currency currency-nio">USD</span></div>
                                                </div>
                                            </a>
                                        </div>
                                    </div>
                                </div><!-- .col -->
                                <div class="col-sm-6">
                                    <div class="card bg-light">
                                        <div class="nk-wgw sm">
                                            <a class="nk-wgw-inner" href="#">
                                                <div class="nk-wgw-name">
                                                    <div class="nk-wgw-icon">
                                                        <em class="icon fa-solid fa-credit-card"></em>
                                                    </div>
                                                    <h5 class="nk-wgw-title title"> FICO Credit Score</h5>
                                                </div>
                                                <div class="nk-wgw-balance">
                                                    <div class="amount text-dark">300 &nbsp;<span class="badge-pill bg-danger"> </span></div>
                                                </div>
                                            </a>
                                        </div>
                                    </div>
                                </div><!-- .col -->
                            </div><!-- .row -->
                        </div> <!-- .nk-block -->
                    </div><!-- .col -->
                </div><!-- .row -->
            </div><!-- .nk-block -->
            <div class="nk-block nk-block-lg">
                <div class="row gy-gs">
                    <div class="col-md-6">
                        <div class="card-head">
                            <div class="card-title  mb-0">
                                <h5 class="title">Recent Transaction Activities</h5>
                            </div>
                            <div class="card-tools">
                                <ul class="card-tools-nav">
                                    <li class="active"><a href="index?transs=transs">All</a></li>
                                </ul>
                            </div>
                        </div><!-- .card-head -->
                        <div class="tranx-list card card-bordered">
                        <?php $data = $user->getCurUser('transaction');?>
                           <?php  if(count($data) > 0):
                            foreach($data as $val):
                            ?>
                            
                            <div class="tranx-item">
                                <div class="tranx-col">
                                    <div class="tranx-info">
                                        <div class="tranx-data">
                                            <div class="tranx-label"><?php echo strtoupper($val->reference)?><em class="tranx-icon sm fa-solid fa-wallet"></em></div>
                                            <div class="tranx-date"><?php echo $val->date ?></div>
                                            <div class="text-primary"> TRANSFER/CTNYK/<?php echo random_int(123,656);?></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="tranx-col">
                                    <div class="tranx-amount">
                                        <div class="tranx-date">Amount</div>
                                        <div class="<?php echo $val->type == 'Credit' ? 'text-success' : 'text-danger'  ?> fs-16px"><?php echo $val->type == 'Credit' ?  $val->amount.'+' : '-' .$val->amount?> 
                                            <span class="currency currency-usd">
                                            <span class="currency currency-btc">USD</span>
                                        </div>
                                          <?php if($val->status == "pending"): ?>
                                            <div class="number-sm"><strong class='text-warning'><?php echo  $val->status?></strong></div>
                                        <?php else:?>
                                            <div class="number-sm"><strong class='text-success'><?php echo  $val->status?></strong></div>
                                        <?php endif;?>
                                    </div>
                                </div>
                                <div class="tranx-col">
                                    <div class="tranx-amount">
                                        <div class="number"><?php echo $val->type?><span class="currency currency-btc"></span></div>
                                        <!-- <span class="badge badge-dim badge-pill badge-outline-primary" data-toggle="modal" data-target="#modalDefault388">View Details</span> -->
                                    </div>
                                </div>
                            </div><!-- .tranx-item -->
                            <?php endforeach?>
                            <?php endif;?>
                            <input type="hidden" id="debit1" value="50">
                            <input type="hidden" id="credit1" value="50">
                        </div><!-- .tranx-list -->
                    </div><!-- .col -->
                    <div class="col-md-6">
                        <div class="card-head">
                            <div class="card-title mb-0">
                                <h5 class="title">Balance Flow</h5>
                            </div>
                            <div class="card-tools">
                                <ul class="card-tools-nav">
                                    <li class="active"><a href="#">All time</a></li>
                                </ul>
                            </div>
                        </div><!-- .card-title -->
                        <div class="card card-bordered">
                            <div class="card-inner">
                                <div class="nk-wg4">
                                    <div class="nk-wg4-group justify-center gy-3 gx-4">
                                        <div class="nk-wg4-item">
                                            <div class="sub-text">
                                                <div class="dot dot-lg sq" data-bg="#1ee0ac"></div> <span>Credit</span>
                                            </div>
                                        </div>
                                        <div class="nk-wg4-item">
                                            <div class="sub-text">
                                                <div class="dot dot-lg sq" data-bg="#f4aaa4"></div> <span>Debit</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="nk-ck3">
                                    <canvas class="pie-chart" id="pieChartData"></canvas>
                                </div>
                            </div><!-- .card-inner -->
                        </div><!-- .card -->
                        <p></p>
                        <div class="tradingview-widget-container" style="width: 100%;">
                        <div class="tradingview-widget-container__widget"></div>
                            <div class="tradingview-widget-copyright">
                                <a href="https://www.tradingview.com/symbols/EURUSD/?exchange=FX" rel="noopener" target="_blank">
                                    <span class="blue-text">EURUSD Rates</span></a>
                            </div>
                            <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js" async>
                                {
                                "symbol": "FX:EURUSD",
                                "width": 320 ,
                                "height": 220,
                                "locale": "en",
                                "dateRange": "12M",
                                "colorTheme": "dark",
                                "trendLineColor": "rgba(41, 98, 255, 1)",
                                "underLineColor": "rgba(41, 98, 255, 0.3)",
                                "underLineBottomColor": "rgba(41, 98, 255, 0)",
                                "isTransparent": false,
                                "autosize": true,
                                "largeChartUrl": ""
                                }
                            </script>
                        </div>
                    </div><!-- .col -->
                </div><!-- .row -->
            </div><!-- .nk-block -->
            <div class="nk-block">
                <div class="card card-bordered">
                    <div class="card-inner card-inner-lg">
                        <div class="align-center flex-wrap flex-md-nowrap g-4">
                            <div class="nk-block-image w-120px flex-shrink-0">
                                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 118">
                                    <path d="M8.916,94.745C-.318,79.153-2.164,58.569,2.382,40.578,7.155,21.69,19.045,9.451,35.162,4.32,46.609.676,58.716.331,70.456,1.845,84.683,3.68,99.57,8.694,108.892,21.408c10.03,13.679,12.071,34.71,10.747,52.054-1.173,15.359-7.441,27.489-19.231,34.494-10.689,6.351-22.92,8.733-34.715,10.331-16.181,2.192-34.195-.336-47.6-12.281A47.243,47.243,0,0,1,8.916,94.745Z" transform="translate(0 -1)" fill="#f6faff" />
                                    <rect x="18" y="32" width="84" height="50" rx="4" ry="4" fill="#fff" />
                                    <rect x="26" y="44" width="20" height="12" rx="1" ry="1" fill="#e5effe" />
                                    <rect x="50" y="44" width="20" height="12" rx="1" ry="1" fill="#e5effe" />
                                    <rect x="74" y="44" width="20" height="12" rx="1" ry="1" fill="#e5effe" />
                                    <rect x="38" y="60" width="20" height="12" rx="1" ry="1" fill="#e5effe" />
                                    <rect x="62" y="60" width="20" height="12" rx="1" ry="1" fill="#e5effe" />
                                    <path d="M98,32H22a5.006,5.006,0,0,0-5,5V79a5.006,5.006,0,0,0,5,5H52v8H45a2,2,0,0,0-2,2v4a2,2,0,0,0,2,2H73a2,2,0,0,0,2-2V94a2,2,0,0,0-2-2H66V84H98a5.006,5.006,0,0,0,5-5V37A5.006,5.006,0,0,0,98,32ZM73,94v4H45V94Zm-9-2H54V84H64Zm37-13a3,3,0,0,1-3,3H22a3,3,0,0,1-3-3V37a3,3,0,0,1,3-3H98a3,3,0,0,1,3,3Z" transform="translate(0 -1)" fill="#798bff" />
                                    <path d="M61.444,41H40.111L33,48.143V19.7A3.632,3.632,0,0,1,36.556,16H61.444A3.632,3.632,0,0,1,65,19.7V37.3A3.632,3.632,0,0,1,61.444,41Z" transform="translate(0 -1)" fill="#6576ff" />
                                    <path d="M61.444,41H40.111L33,48.143V19.7A3.632,3.632,0,0,1,36.556,16H61.444A3.632,3.632,0,0,1,65,19.7V37.3A3.632,3.632,0,0,1,61.444,41Z" transform="translate(0 -1)" fill="none" stroke="#6576ff" stroke-miterlimit="10" stroke-width="2" />
                                    <line x1="40" y1="22" x2="57" y2="22" fill="none" stroke="#fffffe" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" />
                                    <line x1="40" y1="27" x2="57" y2="27" fill="none" stroke="#fffffe" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" />
                                    <line x1="40" y1="32" x2="50" y2="32" fill="none" stroke="#fffffe" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" />
                                    <line x1="30.5" y1="87.5" x2="30.5" y2="91.5" fill="none" stroke="#9cabff" stroke-linecap="round" stroke-linejoin="round" />
                                    <line x1="28.5" y1="89.5" x2="32.5" y2="89.5" fill="none" stroke="#9cabff" stroke-linecap="round" stroke-linejoin="round" />
                                    <line x1="79.5" y1="22.5" x2="79.5" y2="26.5" fill="none" stroke="#9cabff" stroke-linecap="round" stroke-linejoin="round" />
                                    <line x1="77.5" y1="24.5" x2="81.5" y2="24.5" fill="none" stroke="#9cabff" stroke-linecap="round" stroke-linejoin="round" />
                                    <circle cx="90.5" cy="97.5" r="3" fill="none" stroke="#9cabff" stroke-miterlimit="10" />
                                    <circle cx="24" cy="23" r="2.5" fill="none" stroke="#9cabff" stroke-miterlimit="10" /></svg>
                            </div>
                            <div class="nk-block-content">
                                <div class="nk-block-content-head px-lg-4">
                                    <h5>We’re here to help you!</h5>
                                    <p class="text-soft">Ask a question or file a support ticket, manage request, report an issues. Our team support team will get back to you by email.</p>
                                </div>
                            </div>
                            <div class="nk-block-content flex-shrink-0">
                                <a href="#" class="btn btn-lg btn-outline-primary">Get Support Now</a>
                            </div>
                        </div>
                    </div><!-- .card-inner -->
                </div><!-- .card -->
            </div><!-- .nk-block -->
        </div>
    </div>
</div>