<?php
session_start();
include "ajax/konnection.php";
include "ajax/func.php";

if (!isset($_SESSION["user"])) {
  header("location: login");
  die();
}

$email  = $_SESSION["user"];
$bal = getBal($email);
$user = getUserDetails($email);
$verifs = getReportCount($email);
$transC = getTransCount($email);
$site = getSite();
$page = "DASH";
$nubs = ['accountNumber' => null, 'bankName' => null, 'accountName' => null, 'bankImage' => null];
$reserveAcx = mysqli_query($conn, "SELECT * FROM reserveaccounts WHERE email = '$email'");
$reserveAcxRows = mysqli_num_rows($reserveAcx);

if ($reserveAcxRows == 0) {
  $configs = getPaymentsConfigs();
  //$webhook = "/callback/wiaxy/resp.php";
  $ref = $email;
  $names = explode(" ", str_replace(" ", "", $user["firstName"]) . " " . str_replace(" ", "", $user["lastName"]));
  $lastN = (isset($names[1])) ? $names[1] : $names[0];
  $firstName = str_replace("'", "", $names[0]);
  $firstName = str_replace(" ", "", $firstName);
  $lastName = str_replace("'", "", $lastN);
  $lastName = str_replace(" ", "", $lastName);


  $payvessel_api = $configs["payvessel_api_key"];
  getPayvesselNuban($payvessel_api, $email, $ref, $firstName, $lastName, $user["phone"]);
  
}
if ($reserveAcxRows > 0) {
  $parts = mysqli_fetch_array($reserveAcx);
  if (!empty($parts["psb9"] && $site["payvessel_payment"] == "ON")) {
    $nubs = json_decode($parts["psb9"], true);
  }
}
?>
<!DOCTYPE html>

<html lang="en" class="light-style layout-compact layout-navbar-fixed layout-menu-fixed     " dir="ltr" data-theme="theme-default" data-assets-path="/assets/" data-base-url="/assets" data-framework="html" data-template="vertical-menu-theme-default-light">


<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />

  <title><?= $site_title; ?> Dashboard</title>
  <meta name="description" content="" />
  <meta name="keywords" content="">
  <link rel="icon" type="image/x-icon" href="assets/Asphago.png" />
  <link rel="preconnect" href="https://fonts.googleapis.com/">
  <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&amp;display=swap" rel="stylesheet">

  <link rel="stylesheet" href="assets/vendor/fonts/boxiconsc4a7.css?id=87122b3a3900320673311cebdeb618da" />
  <link rel="stylesheet" href="assets/vendor/fonts/fontawesome8a69.css?id=a2997cb6a1c98cc3c85f4c99cdea95b5" />
  <link rel="stylesheet" href="assets/vendor/fonts/flag-icons80a8.css?id=121bcc3078c6c2f608037fb9ca8bce8d" />
  <!-- Core CSS -->
  <link rel="stylesheet" href="assets/vendor/css/rtl/corea8ac.css" class="template-customizer-core-css" />
  <link rel="stylesheet" href="assets/vendor/css/rtl/theme-default4c4b.css" class="template-customizer-theme-css" />
  <link rel="stylesheet" href="assets/css/demob77a.css?id=69dfc5e48fce5a4ff55ff7b593cdf93d" />
  <!-- Vendors CSS -->
  <link rel="stylesheet" href="assets/vendor/libs/perfect-scrollbar/perfect-scrollbare482.css?id=73d641bb8db2475ecafc6c68461ed01b" />
  <link rel="stylesheet" href="assets/vendor/libs/typeahead-js/typeahead05d2.css?id=de339ead5e9c9e36f12e46cbef7aaffd" />

  <!-- Vendor Styles -->
  <link rel="stylesheet" href="assets/vendor/libs/apex-charts/apex-charts.css">

  <style>
    .custom-row {
      display: flex;
      flex-wrap: wrap;
      margin: 0 -00001px;
      padding: 10px 10px;
    }

    .custom-col-6 {
      flex: 0 0 30%;
      max-width: 20%;
      padding: 0 10px;
    }

    .custom-col-sm-2 {
      flex: 0 0 16.66667%;
      max-width: 16.66667%;
      padding: 0 10px;
    }

    .custom-card {
      border: 1px solid #ddd;
      border-radius: 10px;
      overflow: hidden;
      margin-bottom: 10px;
      background-color: #fff;
    }

    .custom-card-body {
      text-align: center;
      padding: 10px;
    }

    .custom-card-title {
      font-size: 0.8rem;
      margin-bottom: 2px;
    }

    .custom-card-text {
      font-size: 0.7rem;
      color: #666;
      margin-bottom: 2px;
      font-weight: bold;
    }

    /* Media query for smaller screens */
    @media only screen and (max-width: 767px) {

      .custom-col-6,
      .custom-col-sm-2 {
        flex: 0 0 50%;
        max-width: 50%;
        margin: 0 auto;
      }
    }
  </style>
  <!-- Page Styles -->

  <!-- Include Scripts for customizer, helper, analytics, config -->
  <!-- $isFront is used to append the front layout scriptsIncludes only on the front layout otherwise the variable will be blank -->
  <!-- laravel style -->
  <script src="assets/vendor/js/helpers.js"></script>
  <!-- beautify ignore:start -->
  <!--! Template customizer & Theme config files MUST be included after core stylesheets and helpers.js in the <head> section -->
  <!--? Template customizer: To hide customizer set displayCustomizer value false in config.js.  -->
  <script src="assets/vendor/js/template-customizer.js"></script>

  <!--? Config:  Mandatory theme config file contain global vars & default theme options, Set your preferred theme option in this file.  -->
  <script src="assets/js/config.js"></script>

  <script>
    window.templateCustomizer = new TemplateCustomizer({
      cssPath: '',
      themesPath: '',
      defaultStyle: "light",
      defaultShowDropdownOnHover: "true", // true/false (for horizontal layout only)
      displayCustomizer: "true",
      lang: 'en',
      pathResolver: function(path) {
        var resolvedPaths = {
          // Core stylesheets
                      'core.css': '/assets/vendor/css/rtl/core.css?id=55b2a9dfaa009c41df62ca8d16e913a8',
            'core-dark.css': '/assets/vendor/css/rtl/core-dark.css?id=d98ae2a03b5b1b05651411ee58ef81a6',
          
          // Themes
                      'theme-default.css': '/assets/vendor/css/rtl/theme-default.css?id=9182924a7b965439eca5e189ba43eba1',
            'theme-default-dark.css':
            '/assets/vendor/css/rtl/theme-default-dark.css?id=ae30991ef3f62e7c03ca6f8930843e80',
                      'theme-bordered.css': '/assets/vendor/css/rtl/theme-bordered.css?id=a4f95a927b1e2bcdfd57a3bbfb2bd3d9',
            'theme-bordered-dark.css':
            '/assets/vendor/css/rtl/theme-bordered-dark.css?id=2a668deb480284f975db82d0a7277156',
                      'theme-semi-dark.css': '/assets/vendor/css/rtl/theme-semi-dark.css?id=9c02fb39c47f91b2d198f343fa8b4df7',
            'theme-semi-dark-dark.css':
            '/assets/vendor/css/rtl/theme-semi-dark-dark.css?id=c4b1950a14ffd431f752917b97a0ee51',
                  }
        return resolvedPaths[path] || path;
      },
      'controls': ["rtl","style","headerType","contentLayout","layoutCollapsed","layoutNavbarOptions","themes"],
    });
  </script>
</head>

<body>


  <!-- Layout Content -->
  <div class="layout-wrapper layout-content-navbar ">
  <div class="layout-container">

        <?php include  "includes/aside.php";
        ?>
    

    <!-- Layout page -->
    <div class="layout-page">

      
      

      <!-- BEGIN: Navbar-->
            <!-- Navbar -->
      <?php include "includes/navbar.php" ?>
  <!-- / Navbar -->
            <!-- END: Navbar-->


      <!-- Content wrapper -->
      <div class="content-wrapper">

        <!-- Content -->
                  <div class="container-xxl flex-grow-1 container-p-y">
            <h5>Welcome to <?= $site_title; ?>, <?php echo $user["firstName"]; ?>!</h5>
            <div class="row">
  
  <div class="col-lg-12 col-md-4 order-1">
    <div class="row">
      <div class="col-lg-4 col-md-12 col-12 mb-4">
        <div class="card">
          <div class="card-body pb-0">
            <span class="d-block fw-medium mb-1">Wallet Balance</span>
            <h3 class="card-title mb-1"><b>₦<?php echo number_format((float)$bal, 2); ?></b> </h3>
          </div>
          <div class="card-body mb-3">
              <a href="javascript:;" data-bs-toggle="modal" data-bs-target="#pricingModal" class="btn btn-medium btn-primary">Add Money</a>
          </div>
        </div>
      </div>

      <div class="col-lg-4 col-md-12 col-12 mb-4">
        <div class="card">
          <div class="card-body">
            <div class="card-title d-flex align-items-start justify-content-between mb-4">
              <div class="avatar flex-shrink-0">
                <img src="assets/img/icons/unicons/cube-secondary.png" alt="cube" class="rounded">
              </div>
              <div class="dropdown">
                <button class="btn p-0" type="button" id="cardOpt2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  <i class="bx bx-dots-vertical-rounded"></i>
                </button>
                <div class="dropdown-menu dropdown-menu-end" aria-labelledby="cardOpt2">
                  <a class="dropdown-item" href="verifications">Verifications History</a>
                  <a class="dropdown-item" href="fundings">Transaction History</a>
                </div>
              </div>
            </div>
            <span class="fw-medium d-block mb-1">Verifications History</span>
            <h4 class="card-title mb-2"><?php echo number_format((float)$verifs); ?></h4>
            
          </div>
        </div>
      </div>

    </div>

   <div class="row">

                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="nin" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h5 class="custom-card-title text-muted"><b>NIN VERIFICATION</b></h5>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="pnv" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>NIN WITH PHONE</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="bvn" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nibss.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>BVN VERIFICATION</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="ipe-clearence" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>IPE CLEARENCE</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="personalization" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>PERSONALIZATION</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="personalization" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>DEMOGRAPHIC SEARCH</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="validation" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>VALIDATION</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="enrollment" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h6 class="custom-card-title text-muted"><b>ENROLLMENT</b></h6>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>

                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="modification" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/nimc.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h5 class="custom-card-title text-muted"><b>MODIFICATION</b></h5>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="cac-reg" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/cac.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h5 class="custom-card-title text-muted"><b>CAC REGISTRATIONG</b></h5>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="tin_verificaton" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/tin.png" alt="..." class="avatar-img">
                                </div>
                                <P>
                                    <h5 class="custom-card-title text-muted"><b>TIN VERIFICATION</b></h5>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="custom-col-6 custom-col-sm-2">
                    <div class="custom-card">
                        <div class="custom-card-body">
                            <a href="verifications" class="">
                                <div class="avatar avatar-sm">
                                    <img src="/assets/img/history.png" alt="..." class="avatar-img"> 
                                </div>
                                <P>
                                    <h5 class="custom-card-title text-muted"><b>VERIFY REPORTS</b></h5>
                                </P>
                            </a>
                        </div>
                    </div>
                </div>


   </div>





    
    <div class="row">
  <!-- Performance -->
  <div class="col-md-12 col-lg-12 mb-4">
    <div class="card h-100">
      <div class="card-header d-flex align-items-center justify-content-between">
        <h5 class="card-title m-0 me-2">Verifications</h5>
        <div class="dropdown">
          <button class="btn p-0" type="button" id="performanceId" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <i class="bx bx-dots-vertical-rounded"></i>
          </button>
          <div class="dropdown-menu dropdown-menu-end" aria-labelledby="cardOpt2">
                  <a class="dropdown-item" href="verifications">Verifications History</a>
                  <a class="dropdown-item" href="fundings">Transaction History</a>
                  </div>
                  
          <!-- <div class="dropdown-menu dropdown-menu-end" aria-labelledby="performanceId">
            <a class="dropdown-item" href="javascript:void(0);">Last 28 Days</a>
            <a class="dropdown-item" href="javascript:void(0);">Last Month</a>
            <a class="dropdown-item" href="javascript:void(0);">Last Year</a>
          </div> -->
        </div>
      </div>
      <div class="card-body">
        <div class="row">
          <div class="col-6">
            <small>Verifications: <span class="fw-medium"><?php echo number_format((float)$verifs); ?></span></small>
          </div>
          <div class="col-6">
            <small>History: <span class="fw-medium"><?php echo number_format((float)$transC); ?></span></small>
          </div>
        </div>
      </div>
      <div id="performanceChart"></div>
    </div>
  </div>
  <!--/ Performance -->
  </div>
</div>

          </div>
          <!-- Pricing Modal -->
<div class="modal fade" id="pricingModal" tabindex="-1" aria-hidden="true">
  <div class="modal-dialog modal-xx modal-simple modal-pricing">
    <div class="modal-content p-0 p-md-2 p-xl-5">
      <div class="modal-body px-2 px-md-4">
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        <!-- Pricing Plans -->
        <div class="rounded-top">
          <h2 class="text-center mb-2 mt-0 mt-md-4 px-2">Fund Your Wallet</h2>
          <p class="text-center pb-3 px-2"> Send money to your <?= $site_title; ?> account!. </p>
          <center><img class="round" width="80px" src="<?php echo $nubs["bankImage"]; ?>" /></center>
          <center> <h4 class="mt-2"><?php echo $nubs["accountName"]; ?></h4> </center>
          <center> <h4 class="mt-2"><?php echo $nubs["bankName"]; ?></h4> </center>
        
          <center> <h4 class="mt-2" id="clipboard-example"><?php echo $nubs["accountNumber"]; ?> <i data-clipboard-action="copy" data-clipboard-target="#clipboard-example" class="bx bx-copy"></i></h4> </center>
          <div class="d-flex align-items-center justify-content-center flex-wrap  py-5 mb-0">
            
            <div class="mt-n5 ms-n5 ml-2 mb-2 d-sm-inline-flex align-items-start">
              <span class="badge badge-sm bg-label-primary">Send Money Here</span>
              <img style="transform: rotate(180deg);" src="assets/img/pages/pricing-arrow-light.png" alt="arrow img" class="scaleX-n1-rtl mt-2 pt-1" >
            </div>
          </div>
          <!--
              <div class="alert alert-dark d-flex" role="alert">
              <span class="badge badge-center rounded-pill bg-warning border-label-warning p-3 me-2"><i class="bx bx-wallet fs-6"></i></span>
              <div class="d-flex flex-column ps-1">
                <h6 class="alert-heading d-flex align-items-center mb-1">Charges</h6>
                <span>You'll be charged 0.00 Per Topup!</span>
              </div>
            </div> -->
          <div class="row mx-0 gy-3">
          </div>
        </div>
      </div>
      <!--/ Pricing Plans -->
    </div>
  </div>
</div>
<!--/ Pricing Modal -->
          <!-- / Content -->

          <!-- Footer -->
                    <!-- Footer-->
<footer class="content-footer footer bg-footer-theme">
  <div class="container-xxl d-flex flex-wrap justify-content-between py-2 flex-md-row flex-column">
    <div class="mb-2 mb-md-0">
      © <script>document.write(new Date().getFullYear())</script>
      ,All Rights Reserved Developed By <a href="https://wa.me/2349064699773">M SHETTY</a>
    </div>
  
  </div>
</footer>
<!--/ Footer-->
                    <!-- / Footer -->
          <div class="content-backdrop fade"></div>
        </div>
        <!--/ Content wrapper -->
      </div>
      <!-- / Layout page -->
    </div>

        <!-- Overlay -->
    <div class="layout-overlay layout-menu-toggle"></div>
        <!-- Drag Target Area To SlideIn Menu On Small Screens -->
    <div class="drag-target"></div>
  </div>
  <!-- / Layout wrapper -->
    <!--/ Layout Content -->

  
  
  <!-- Include Scripts -->
  <!-- $isFront is used to append the front layout scripts only on the front layout otherwise the variable will be blank -->
  <!-- BEGIN: Vendor JS-->
<script src="assets/vendor/libs/jquery/jquery1e84.js?id=0f7eb1f3a93e3e19e8505fd8c175925a"></script>
<script src="assets/vendor/libs/popper/popper0a73.js?id=baf82d96b7771efbcc05c3b77135d24c"></script>
<script src="assets/vendor/js/bootstrapcfc4.js?id=4648227467e3fd3f4cf976cfb0e43aea"></script>
<script src="assets/vendor/libs/perfect-scrollbar/perfect-scrollbar6188.js?id=44b8e955848dc0c56597c09f6aebf89a"></script>
<script src="assets/vendor/libs/hammer/hammer2de0.js?id=0a520e103384b609e3c9eb3b732d1be8"></script>
<script src="assets/vendor/libs/typeahead-js/typeahead60e7.js?id=f6bda588c16867a6cc4158cb4ed37ec6"></script>
<script src="assets/vendor/js/menu2dc9.js?id=c6ce30ded4234d0c4ca0fb5f2a2990d8"></script>
<script src="assets/vendor/libs/apex-charts/apexcharts.js"></script>
<!-- END: Page Vendor JS-->
<!-- BEGIN: Theme JS-->
<script src="assets/js/maind63d.js?id=6bea3f2e092d5fe7327c226f3242f31b"></script>

<!-- END: Theme JS-->
<script src="assets/js/app-ecommerce-dashboard.js"></script>
<script src="assets/js/extended-ui-misc-clipboardjs.js"></script>

<!-- END: Page JS-->

<!-- WhatsApp Widget -->
<style>
    .whatsapp-widget {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000;
    }
    
    .whatsapp-widget a {
        display: flex;
        align-items: center;
        background-color: #25D366;
        color: white;
        padding: 10px 15px;
        border-radius: 50px;
        font-weight: bold;
        text-decoration: none;
        box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    }

    .whatsapp-widget img {
        width: 25px;
        height: 25px;
        margin-right: 10px;
    }
</style>

<div class="whatsapp-widget">
    <a href="https://chat.whatsapp.com/IVeuVW5SKXN7vnI23nXclJ" target="_blank">
        <img src="https://upload.wikimedia.org/wikipedia/commons/6/6b/WhatsApp.svg" alt="WhatsApp">WhatsApp
    </a>
</div>
<!-- Notification Popup -->
<div class="notification-overlay" id="notification">
    <div class="notification-box">
        <p><strong>Welcome to SHETTY VERIFY</strong></p>
        <p><strong>Note:</strong> Money deposited cannot be withdrawn back to your bank account. You can only use it for another service in case your work fails.</p>
        <button onclick="closeNotification()">Okay</button>
    </div>
</div>

<!-- CSS Styles -->
<style>
    .notification-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
    }
    .notification-box {
        background: white;
        padding: 20px;
        border-radius: 10px;
        text-align: center;
        width: 80%;
        max-width: 400px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    }
    .notification-box button {
        margin-top: 10px;
        padding: 10px;
        border: none;
        background: #28a745;
        color: white;
        cursor: pointer;
        border-radius: 5px;
    }
</style>

<!-- JavaScript -->
<script>
    function closeNotification() {
        document.getElementById("notification").style.display = "none";
    }
</script>

</body>
</html>