<?php

include('php/database.php');
include('php/security.php');
session_start();
if (logged_in()) {
    header('location:../login.php');
}
$id = $_SESSION['id'];
$results = mysqli_query($connection, "SELECT `date`, `id`, `name`, `email`, `number`, `password`, `phone`, `address`, `country`, `gender`, `image`, `vcode`, `verified`, `verify`, `balance`, `totalbalance`, `investbalance`, `profit`, `totaldeposit`, `totalwithdrawal`, `loanlimit`, `availableloan`, `ongoingloan`, `savings`, `idcard`, `idcardback`, `accountstatus`, `pina`, `pinb`, `pinc`, `pind` FROM users WHERE id ='$id'");
$retrive = mysqli_fetch_array($results);
$date = $retrive['date'];
$id = $retrive['id'];
$name = $retrive['name'];
$email = $retrive['email'];
$number = $retrive['number'];
$password = $retrive['password'];
$phone = $retrive['phone'];
$address = $retrive['address'];
$country = $retrive['country'];
$gender = $retrive['gender'];
$image = $retrive['image'];
$vcode = $retrive['vcode'];
$verified = $retrive['verified'];
$verify = $retrive['verify'];
$balance = $retrive['balance'];
$totalbalance = $retrive['totalbalance'];
$investbalance = $retrive['investbalance'];
$profit = $retrive['profit'];
$totaldeposit = $retrive['totaldeposit'];
$totalwithdrawal = $retrive['totalwithdrawal'];
$loanlimit = $retrive['loanlimit'];
$availableloan = $retrive['availableloan'];
$ongoingloan = $retrive['ongoingloan'];
$savings = $retrive['savings'];
$idcard = $retrive['idcard'];
$idcardback = $retrive['idcardback'];
$accountstatus = $retrive['accountstatus'];
$pina = $retrive['pina'];
$pinb = $retrive['pinb'];
$pinc = $retrive['pinc'];
$pind = $retrive['pind'];

?>


<!DOCTYPE html>
<html lang="en">


<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=0.7, viewport-fit=cover">
    <title>home</title>
    <!-- Favicon and Touch Icons  -->
    <link rel="shortcut icon" href="images/logo.png" />
    <link rel="apple-touch-icon-precomposed" href="images/logo.png" />
    <!-- Font -->

    <!-- Icons -->
    <link rel="stylesheet" href="fonts/icons-alipay.css">
    <link rel="stylesheet" href="styles/bootstrap.css">
    <link rel="stylesheet" href="styles/swiper-bundle.min.css">
    <link rel="stylesheet" type="text/css" href="styles/styles.css" />
    <link rel="manifest" href="_manifest.json" data-pwa-version="set_in_manifest_and_pwa_js">
    <link rel="apple-touch-icon" sizes="192x192" href="app/icons/icon-192x192.png">

    <script src="https://cdn.tailwindcss.com"></script>
</head>

<body class="font-sans text-[12px] leading-[20px] font-medium text-textGray bg-white w-full m-auto overflow-hidden">
     <!-- preloade -->
     <div class="preload preload-container">
        <div class="preload-logo"></div>
    </div>
    <!-- /preload -->
    <div class="app-header">
        <div class="tf-container">
            <div class="tf-topbar d-flex justify-content-between align-items-center">
                <a class="user-info d-flex justify-content-between align-items-center" href="profile.php">
                    <img src="images/user/<?php echo $image ?>" alt="image">

                    <div class="content">
                        <h4 class="text-white"><?php echo $name ?></h4>
                        <p class="text-white fw_4"><?php echo $number ?></p>
                    </div>
                </a>
                 <div  class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}</script>
<script src="https://cdn.gtranslate.net/widgets/latest/dropdown.js" defer></script>
                <div class="d-flex align-items-center gap-4">
                  
                    <a href="#" id="btn-popup-up" class="icon-notification1"></a>
                </div>
            </div>
        </div>
    </div>
    <div class="card-secton">
        <div class="tf-container">
            
            <?php
            if ($verify == '0') {

                if ($idcard == '') { ?>
                    <div class="w-full bg-red-500/50 border border-red-500 text-white-700 px-4 py-3 rounded-lg flex justify-between items-center">
            <span class="font-medium">Notice! Your account is not verified please submit all necessary documents.</span>
            <a href="verify-account.php" class="text-white font-semibold underline hover:text-red-800 transition">Submit Documents</a>
        </div>
                    
                      <?php
                } else {
                    ?>
                            <div class="w-full bg-yellow-500/40 border border-yellow-500 text-white-700 px-4 py-3 rounded-lg flex justify-between items-center">
            <span class="font-medium">Your Verification is pending Please wait.</span>

        </div>
                    
                    
                   <?php }

            } else {



            }


            ?>
            
            
        <div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg overflow-hidden p-4">
    <!-- Balance Section -->
    <div class="flex justify-between items-center">
        <!-- Available Balance -->
        <div class="flex-1 text-left">
            <p class="text-sm text-gray-500">Available Balance</p>
            <p class="text-xl font-semibold text-gray-800">$<?php echo number_format($balance, 2); ?></p>
        </div>

        <!-- Vertical Divider -->
        <div class="w-px h-10 bg-gray-300"></div>

        <!-- Total Balance -->
        <div class="flex-1 text-right">
            <p class="text-sm text-gray-500">Total Balance</p>
            <p class="text-xl font-semibold text-gray-800">$<?php echo number_format($totalbalance, 2); ?></p>
        </div>
    </div>

    <!-- Horizontal Divider -->
    <div class="my-4 border-t border-gray-300"></div>

    <!-- Centered Top Up Button -->
    <div class="flex justify-center">
        <a href="choose-topup.php" class="flex items-center justify-center gap-2 w-[200px] max-w-[350px] px-4 py-2 bg-blue-300/10 border border-blue-900/80 text-blue-900/80 rounded-lg text-sm font-medium hover:bg-blue-300/20 transition">
            <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                <line x1="12" y1="5" x2="12" y2="19"></line>
                <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
            Top Up
        </a>
    </div>
</div>

        </div>

    </div>

    
    <div class="mt-5">
        <div class="tf-container">
        <div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg overflow-hidden border-t-4 border-blue-900/80 p-4">
    <!-- Grid Menu (3 Equal Boxes Per Row) -->
    <div class="grid grid-cols-3 gap-2">
        <!-- Local Transfer -->
        <a href="transfer.php" class="flex flex-col items-center justify-center p-3 border rounded-lg shadow-sm hover:bg-gray-50 cursor-pointer">
         
            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-blue-500">
  <path stroke-linecap="round" stroke-linejoin="round" d="M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5" />
</svg>

            <span class="mt-1 text-xs font-medium text-gray-700 text-center">Local Transfer</span>
        </a>

        <!-- International Transfer -->
        <a href="transfer-to-bank.php" class="flex flex-col items-center justify-center p-3 border rounded-lg shadow-sm hover:bg-gray-50 cursor-pointer">
          
            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-green-500">
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418" />
</svg>

            <span class="mt-1 text-xs font-medium text-gray-700 text-center">International Transfer</span>
        </a>

        <!-- Loan -->
        <a href="loan.php" class="flex flex-col items-center justify-center p-3 border rounded-lg shadow-sm hover:bg-gray-50 cursor-pointer">
            
            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-yellow-500">
  <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 18.75a60.07 60.07 0 0 1 15.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 0 1 3 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 0 0-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 0 1-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 0 0 3 15h-.75M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm3 0h.008v.008H18V10.5Zm-12 0h.008v.008H6V10.5Z" />
</svg>

            <span class="mt-1 text-xs font-medium text-gray-700 text-center">Loan</span>
        </a>

        <!-- Savings -->
        <a href="savings.php" class="flex flex-col items-center justify-center p-3 border rounded-lg shadow-sm hover:bg-gray-50 cursor-pointer">
          
            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-purple-500">
  <path stroke-linecap="round" stroke-linejoin="round" d="M21 12a2.25 2.25 0 0 0-2.25-2.25H15a3 3 0 1 1-6 0H5.25A2.25 2.25 0 0 0 3 12m18 0v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 9m18 0V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v3" />
</svg>

            <span class="mt-1 text-xs font-medium text-gray-700 text-center">Savings</span>
        </a>

        <!-- Request ATM Card -->
        <a href="card.php" class="flex flex-col items-center justify-center p-3 border rounded-lg shadow-sm hover:bg-gray-50 cursor-pointer">
          
            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-red-500">
  <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z" />
</svg>

            <span class="mt-1 text-xs font-medium text-gray-700 text-center">Request Debit/Credit Card</span>
        </a>

        <!-- Customer Support -->
        <a href="support.php" class="flex flex-col items-center justify-center p-3 border rounded-lg shadow-sm hover:bg-gray-50 cursor-pointer">
            
            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-8 h-8 text-gray-500">
  <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z" />
</svg>

            <span class="mt-1 text-xs font-medium text-gray-700 text-center">Customer Support</span>
        </a>
    </div>
</div>




        </div>
    </div>
  
    <div class="app-section st1 mt-1 mb-5 bg_text-white">
                <div class="tf-container">
                    <div class="trading-month">
                            <div class="group-trading-history mb-5">
                   
                   
                        <div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg overflow-hidden mb-24">
    <!-- Title -->
    <div class="bg-blue-300/80 text-white text-lg font-semibold px-6 py-3">
        Transaction History
    </div>

    <ul>

    <?php
    $query = "SELECT * FROM `transactions` WHERE id='$id' ORDER by tid DESC";
    $query_run = mysqli_query($connection, $query);

    if (mysqli_num_rows($query_run) > 0) {
        while ($row = mysqli_fetch_assoc($query_run)) {
            $tdate = new DateTime($row['date']);
            $nicetime = $tdate->format("j F Y");

            if ($row['status'] == 'Completed') {

                $badge = "blue";
            }
            if ($row['status'] == 'Pending') {

                $badge = "yellow";
            }
            if ($row['status'] == 'Failed') {

                $badge = "red";
            }

            ?>
                <!-- Transaction Item 1 -->
                <li class="border-b hover:bg-gray-50 cursor-pointer">
                    <a href="details.php?tid=<?php echo $row['tid']; ?>" class="flex justify-between items-center px-6 py-4">
                        <div class="flex flex-col">
                            <span class="text-sm font-medium text-gray-700"><?php echo $row['type']; ?></span>
                            <span class="text-xs text-gray-500"><?php echo $nicetime; ?></span>
                        </div>
                        <div class="text-right">
                            <span class="text-sm text-<?php echo $row['color']; ?>-500 font-semibold"><?php echo $row['sign']; ?> $<?php echo $row['amount']; ?></span>
                            <span class="px-2 py-0.5 bg-<?php echo $badge; ?>-500 text-white text-[10px] rounded-full"><?php echo $row['status']; ?></span>
                        </div>
                    </a>
                </li>
        <?php
        }
    } else {
        ?>
  
        <!-- No Transactions Message -->
        <div class="flex flex-col items-center justify-center p-10 text-center">
            <p class="text-gray-500 text-sm mb-4">
                You have not made any transactions, make a transaction now.
            </p>
            <a href="transfer.php" class="px-5 py-2 bg-blue-300/80 text-white text-sm rounded-lg transition hover:bg-blue-300">
                Make a Transaction
            </a>
        </div>

          <?php
    }
    ?>

    
    </ul>
</div>


                         
                        </div>
                </div>

                </div>
            </div>
            <div class="fixed bottom-0 left-0 w-full bg-white border-t-4 border-blue-900/50 shadow-lg">
    <div class="flex justify-around items-center py-3 relative">
        <!-- Home (Active with Background & Badge) -->
        <a href="index.php" class="flex flex-col items-center text-blue-900/80  px-4 py-2 rounded-lg cursor-pointer relative">
           
            <svg xmlns="http://www.w3.org/2000/svg" fill="#90D5FF" viewBox="0 0 24 24" stroke-width="1.5" stroke="#90D5FF" class="size-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
</svg>

            <span class="text-xs  font-medium">Home</span>
            
            
        </a>

        <!-- History -->
        <a href="history.php" class="flex flex-col items-center text-gray-600 hover:text-blue-900 cursor-pointer px-4 py-2 rounded-lg">
        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
  <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
</svg>

            <span class="text-xs font-medium">History</span>
        </a>

        <!-- Top Up -->
        <a href="choose-topup.php" class="flex flex-col items-center text-gray-600 hover:text-blue-900 cursor-pointer px-4 py-2 rounded-lg">
            <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <line x1="12" y1="5" x2="12" y2="19"></line>
                <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
            <span class="text-xs font-medium">Top Up</span>
        </a>

        <!-- Cards (ATM Card Icon) -->
        <a href="card.php" class="flex flex-col items-center text-gray-600 hover:text-blue-900 cursor-pointer px-4 py-2 rounded-lg">
            <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <rect x="2" y="5" width="20" height="14" rx="2" ry="2"></rect>
                <line x1="2" y1="10" x2="22" y2="10"></line>
            </svg>
            <span class="text-xs font-medium">Cards</span>
        </a>

        <!-- Profile -->
        <a href="profile.php" class="flex flex-col items-center text-gray-600 hover:text-blue-900 cursor-pointer px-4 py-2 rounded-lg">
            <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <circle cx="12" cy="7" r="4"></circle>
                <path d="M5.5 20a7.5 7.5 0 0113 0"></path>
            </svg>
            <span class="text-xs font-medium">Profile</span>
        </a>
    </div>
</div>


 

  
    
    <div class="tf-panel up">
        <div class="panel-box panel-up panel-noti">
            <div class="header is-fixed">
                <div class="tf-container">
                    <div class="tf-statusbar d-flex justify-content-center align-items-center">
                        <a href="#" class="clear-panel"> <i class="icon-left"></i> </a>
                        <h3>Notification</h3>
                    </div>
                </div>
            </div>
            <div id="app-wrap" class="style1">
                <div class="tf-container">
                    <div class="tf-tab mt-3">
                        <div class="swiper-container tes-noti">
                            <ul class="swiper-wrapper menu-tabs">
                                <li class="swiper-slide nav-tab active "><a href="#">All Notification</a></li>
                                  </ul>
                        </div>
                        <div class="content-tab mt-5">
                            <div class="noti-box">
                            
                            
                             <?php
                             $notequery = "SELECT `date`, `nid`, `id`, `subject`, `message` FROM `notifications` WHERE id='$id' ORDER BY nid DESC LIMIT 12";
                             $notequery_run = mysqli_query($connection, $notequery);

                             if (mysqli_num_rows($notequery_run) > 0) {
                                 while ($noterow = mysqli_fetch_assoc($notequery_run)) {

                                     ?>
                                        <div class="noti-list">
                                            <div class="icon-box bg_service-4">
                                               <i class="icon icon-bell"></i>
                                            
                                            </div>
                                            <div class="content-right">
                                                <div class="title">
                                                    <h3 class="fw_6"><?php echo $noterow['subject']; ?></h3>
                                                    <span class="fw_6 on_surface_color"><?php echo $noterow['date']; ?></span>
                                                </div>
                                                <div class="desc">
                                                    <p class="on_surface_color fw_4"><?php echo $noterow['message']; ?></p>
                                            
                                                </div>
                                            </div>
                                        </div>
                               
                                          <?php
                                 }
                             } else {
                                 echo ' <span class="d-name"><b>No Notification</b></span>';
                             }

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

          
        </div>
        
    </div>
    <div class="tf-panel down">
        <div class="panel_overlay"></div>
        <div class="panel-box panel-down">
            <div class="header bg_text-white">
                <div class="tf-container">
                    <div class="tf-statusbar d-flex justify-content-center align-items-center">
                        <a href="#" class="clear-panel"> <i class="icon-close1"></i> </a>
                        <h3>Transfer Method</h3>
                        </div>
                </div>
            </div>
            <div class="wrap-transfer mb-5">
                <div class="tf-container">
        
                    <a href="transfer.php" class="action-sheet-transfer">
                        <div class="icon"><i class="icon-friends"></i></div>
                        <div class="content">
                            <h4 class="fw_6" >local transfer</h4>
                            <p>Transfer To Goldlinebanking Account</p>
                        </div>
        
                    </a>
                    <a href="transfer-to-bank.php" class="action-sheet-transfer">
                        <div class="icon"><i class="icon-bank2"></i></div>
                        <div class="content">
                            <h4 class="fw_6">Transfer to Other Bank</h4>
                            <p>Transfer to external bank accounts</p>
                        </div>
                    </a>
        
        
                </div>
        
            </div>
        </div>
    </div>


      <!-- Smartsupp Live Chat script -->
<script type="text/javascript">
var _smartsupp = _smartsupp || {};
_smartsupp.key = 'f2a51be4b05a569c93b11d4e21f7e525687efcd1';
window.smartsupp||(function(d) {
  var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];
  s=d.getElementsByTagName('script')[0];c=d.createElement('script');
  c.type='text/javascript';c.charset='utf-8';c.async=true;
  c.src='https://www.smartsuppchat.com/loader.js?';s.parentNode.insertBefore(c,s);
})(document);
</script>
<noscript>Powered by <a href="https://www.smartsupp.com" target="_blank">Smartsupp</a></noscript>



    <script type="text/javascript" src="javascript/jquery.min.js"></script>
    <script type="text/javascript" src="javascript/bootstrap.min.js"></script>
    <script type="text/javascript" src="javascript/swiper-bundle.min.js"></script>
    <script type="text/javascript" src="javascript/swiper.js"></script>
    <script type="text/javascript" src="javascript/main.js"></script>
   
</body>


</html>