<?php




$pageName  = "Dashboard";
include($_SERVER['DOCUMENT_ROOT'] . "/admin/layout/header.php");

// Ofofonobs Developer WhatsAPP +2349064804335


// Bank Script Developer - Use For Educational Purpose Only

// Other scripts Available

$sql = "SELECT * FROM users";
$stmt = $conn->prepare($sql);
$stmt->execute();
$row_count = $stmt->rowCount();
$row = $stmt->fetch(PDO::FETCH_ASSOC);

if (isset($_POST['newsletter'])) {
    $user_id = $_POST['user_id'];
    $subjectid = $_POST['subjectid'];
    $messageid = $_POST['messageid'];



    // if (true) {

    //     $APP_NAME = $pageTitle;
    //     $message = $sendMail->MessageUsers($fullName, $subjectid, $messageid, $APP_NAME);
    //     $subject = "Notification - $APP_NAME";
    //     $email_message->send_mail($email, $message, $subject);


    //     if (true) {
    //         toast_alert('success', 'Email Successfully Sent', 'Approved');
    //     } else {
    //         toast_alert('error', 'Sorry Something Went Wrong');
    //     }
    // }
}

?>

<style>
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&display=swap');
.content-wrapper.adm-re,.content-wrapper.adm-re *{font-family:'DM Sans',sans-serif;}
.content-wrapper.adm-re{background:#f8f9fb;}
.adm-re .adm-hero{background:linear-gradient(135deg,#0f1729 0%,#1e3a5f 50%,#0f1729 100%);border-radius:18px;padding:32px;color:#fff;position:relative;overflow:hidden;margin-bottom:24px;}
.adm-re .adm-hero::before{content:'';position:absolute;top:-60px;right:-60px;width:200px;height:200px;border-radius:50%;background:rgba(37,99,235,.15);}
.adm-re .adm-hero::after{content:'';position:absolute;bottom:-40px;left:30%;width:150px;height:150px;border-radius:50%;background:rgba(5,150,105,.1);}
.adm-re .adm-hero .inner{position:relative;z-index:1;}
.adm-re .adm-hero h3{font-size:36px;font-weight:800;margin:0;letter-spacing:-.02em;color:#fff;}
.adm-re .adm-hero p{font-size:13px;opacity:.55;margin:6px 0 0;color:#fff;}

.adm-re .adm-card{background:#fff;border:1px solid #e8ecf1;border-radius:14px;padding:22px 24px;transition:all .25s ease;position:relative;overflow:hidden;display:block;text-decoration:none!important;color:inherit!important;height:100%;}
.adm-re .adm-card:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(0,0,0,.06);}
.adm-re .adm-card::before{content:'';position:absolute;top:0;left:0;width:4px;height:100%;border-radius:14px 0 0 14px;}
.adm-re .adm-card.c-aqua::before{background:#2563eb;}
.adm-re .adm-card.c-yellow::before{background:#d97706;}
.adm-re .adm-card.c-green::before{background:#059669;}
.adm-re .adm-card.c-red::before{background:#dc2626;}
.adm-re .adm-card.c-blue::before{background:#3b82f6;}
.adm-re .adm-card .adm-ic{width:44px;height:44px;border-radius:12px;display:flex;align-items:center;justify-content:center;margin-bottom:14px;font-size:18px;}
.adm-re .adm-card.c-aqua .adm-ic{background:#eff4ff;color:#2563eb;}
.adm-re .adm-card.c-yellow .adm-ic{background:#fffbeb;color:#d97706;}
.adm-re .adm-card.c-green .adm-ic{background:#ecfdf5;color:#059669;}
.adm-re .adm-card.c-red .adm-ic{background:#fef2f2;color:#dc2626;}
.adm-re .adm-card.c-blue .adm-ic{background:#eff4ff;color:#3b82f6;}
.adm-re .adm-card .inner h3{font-size:22px;font-weight:800;color:#0f1729;margin:0;letter-spacing:-.01em;}
.adm-re .adm-card .inner p{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:#8f99a8;margin:0 0 4px;font-weight:600;}
.adm-re .adm-card .small-box-footer{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:600;color:#2563eb;margin-top:14px;text-decoration:none;}
.adm-re .adm-card .small-box-footer:hover{text-decoration:underline;}
.adm-re .adm-card .icon{display:none;}

.adm-re .adm-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:24px;}
@media(max-width:991px){.adm-re .adm-grid{grid-template-columns:repeat(2,1fr);}.adm-re .adm-hero{padding:22px;}.adm-re .adm-hero h3{font-size:28px;}}
@media(max-width:480px){.adm-re .adm-grid{grid-template-columns:1fr;}}
</style>



<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper adm-re">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1 style="font-size:24px;font-weight:700;color:#0f1729;">
            Dashboard
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Dashboard</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">

        <!-- Hero Card -->
        <div class="adm-hero">
            <div class="inner">
                <p style="font-size:12px;text-transform:uppercase;letter-spacing:.08em;opacity:.6;margin:0 0 8px;">System Overview</p>
                <?php
                        $sql = "SELECT SUM(acct_balance) FROM users";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $sum = $total[0];
                        ?>
                <h3><?= $currency ?><?php echo number_format($sum); ?></h3>
                <p>Total system balance across all accounts</p>
            </div>
        </div>

        <!-- Small boxes (Stat box) -->
        <div class="adm-grid">
            <div>
                <!-- small box -->
                <a href="./fundings.php" class="adm-card c-aqua">
                    <div class="adm-ic"><i class="ion ion-bag"></i></div>
                    <div class="inner">
                        <p>Total Balance</p>
                        <h3><?= $currency ?><?php echo number_format($sum); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
            <div>
                <!-- small box -->
                <a href="./users.php" class="adm-card c-yellow">
                    <div class="adm-ic"><i class="ion ion-person-add"></i></div>
                    <div class="inner">
                        <?php

                        $stmt = $conn->query("SELECT * FROM users");
                        ?>
                        <p>User Registrations</p>
                        <h3><?= $stmt->rowCount() ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-person-add"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
            <div>
                <!-- small box -->
                <a href="./wire-trans.php" class="adm-card c-green">
                    <div class="adm-ic"><i class="ion ion-stats-bars"></i></div>
                    <div class="inner">
                        <?php
                        $sql = "SELECT SUM(amount) FROM transactions WHERE trans_type='Wire transfer'";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $wire = $total[0];
                        ?>
                        <p>Total Wire</p>
                        <h3><?= $currency ?><?php echo number_format($wire); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
            <div>
                <!-- small box -->
                <a href="./domestic-trans.php" class="adm-card c-red">
                    <div class="adm-ic"><i class="ion ion-pie-graph"></i></div>
                    <div class="inner">
                        <?php
                        $sql = "SELECT SUM(amount) FROM transactions WHERE trans_type='Domestic transfer'";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $dom = $total[0];
                        ?>
                        <p>Total Domestic</p>
                        <h3><?= $currency ?><?php echo number_format($dom); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-pie-graph"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
        </div>
        <!-- /.row -->
        <!-- Small boxes (Stat box) -->
        <div class="adm-grid">
            <div>
                <!-- small box -->
                <a href="./pending-deposit.php" class="adm-card c-red">
                    <div class="adm-ic"><i class="ion ion-bag"></i></div>
                    <div class="inner">
                        <?php
                        $sql = "SELECT SUM(amount) FROM transactions WHERE trans_type='Crypto Deposit' AND trans_status='processing'";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $depositpend = $total[0];
                        ?>
                        <p>Total Pending Deposit</p>
                        <h3><?= $currency ?><?php echo number_format($depositpend); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-bag"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
            <div>
                <!-- small box -->
                <a href="./deposit.php" class="adm-card c-green">
                    <div class="adm-ic"><i class="ion ion-person-add"></i></div>
                    <div class="inner">
                        <?php
                        $sql = "SELECT SUM(amount) FROM transactions WHERE trans_type='Crypto Deposit' AND trans_status='completed'";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $approveddeposit = $total[0];
                        ?>
                        <p>Total Deposit</p>
                        <h3><?= $currency ?><?php echo number_format($approveddeposit); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-person-add"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
            <div>
                <!-- small box -->
                <a href="./stocks-trans.php" class="adm-card c-blue">
                    <div class="adm-ic"><i class="ion ion-stats-bars"></i></div>
                    <div class="inner">
                        <?php
                        $sql = "SELECT SUM(amount) FROM transactions WHERE trans_type='Stocks'";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $stocks = $total[0];
                        ?>
                        <p>Total Stocks</p>
                        <h3><?= $currency ?><?php echo number_format($stocks); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-stats-bars"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
            <div>
                <!-- small box -->
                <a href="./loan-trans.php" class="adm-card c-yellow">
                    <div class="adm-ic"><i class="ion ion-pie-graph"></i></div>
                    <div class="inner">
                        <?php
                        $sql = "SELECT SUM(amount) FROM transactions WHERE trans_type='loan'";
                        $stmt = $conn->prepare($sql);
                        $stmt->execute();

                        $total = $stmt->fetch(PDO::FETCH_NUM);
                        $loan = $total[0];
                        ?>
                        <p>Total Loan</p>
                        <h3><?= $currency ?><?php echo number_format($loan); ?></h3>
                    </div>
                    <div class="icon">
                        <i class="ion ion-pie-graph"></i>
                    </div>
                    <span class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></span>
                </a>
            </div>
            <!-- ./col -->
        </div>
        <!-- /.row -->


    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->


<?php
include($_SERVER['DOCUMENT_ROOT'] . "/admin/layout/footer.php");

?>