<?php
/**
 * dashboard.php -- Dashboard
 */

include '../inc/config.inc.php'; // Configuration

ob_start();
session_start();

//date_default_timezone_set('Africa/Lagos');

error_reporting(E_ALL);
ini_set('display_errors', 1);

if ( !isset($_SESSION['admin']) || $_SESSION["loggedin"] !== true || trim($_SESSION['admin']) == '' ){
	//header('Location: ' . $BASE_URL . 'wp-admin/');
    header('Location: ' . $BASE_URL . 'signin');
	exit;
}

// Admin Details
$stmt = $db_con->prepare("SELECT * FROM admin WHERE id=:admin_id");
$stmt->execute(array(":admin_id"=>$_SESSION['admin']));
$adminRow = $stmt->fetch(PDO::FETCH_ASSOC);

// Users
$users = $db_con->prepare("SELECT * FROM users");
$users->execute();

// Deposits
$deposits = $db_con->prepare("SELECT transaction_id FROM user_transactions WHERE type='Deposit' AND status='Pending'");
$deposits->execute();

// Withdrawal
$withdrawal = $db_con->prepare("SELECT transaction_id FROM user_transactions WHERE type='Withdrawal' AND status='Pending'");
$withdrawal->execute();

?>

<!doctype html>
<html lang="en-uk">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Alert Signals Nations</title>
    <!-- Favicon -->
    <link rel="shortcut icon" href="../../img/Signals-Alert-3.png" />
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- Typography CSS -->
    <link rel="stylesheet" href="css/typography.css">
    <!-- Style CSS -->
    <link rel="stylesheet" href="css/style.css">
    <!-- Responsive CSS -->
    <link rel="stylesheet" href="css/responsive.css">

    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700" rel="stylesheet" />
    <style>
        /*------ Google Font Style ------ */
        body {font-family:'Roboto'!important;}
    </style>
    
</head>
<body>
    <!-- loader Start -->
    <div id="loading">
        <div id="loading-center">
        </div>
    </div>
    <!-- loader END -->
    <!-- Wrapper Start -->
    <div class="wrapper">
        <!-- Sidebar  -->
        <?php include 'navbar.php' ?>
        <!-- TOP Nav Bar END -->
        <!-- Page Content  -->
        <div id="content-page" class="content-page">
            <div class="container-fluid">
                <div class="row content-body">
                    <div class="col-lg-8 row m-0 p-0">
                        <div class="col-sm-6 col-md-6 col-lg-6">
                            <div class="iq-card iq-card-block iq-card-stretch iq-card-height">
                                <div class="iq-card-body" style="background-color: rgb(196, 70, 70); border-radius: 20px;">
                                    <div class="icon iq-icon-box iq-bg-primary rounded" data-wow-delay="0.2s" style="font-size: 65px;">
                                        <i class="ri-user-line"></i>
                                    </div>
                                    <div class="mt-4">
                                        <h5 class="text-primary text-uppercase" style="font-size: 45px;">Users</h5>
                                        <h3 class="d-flex text-primary" style="font-size: 50px;"> <?= $users->rowCount(); ?><i class="ri-arrow-up-line"></i></h3>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6 col-md-6 col-lg-6">
                            <div class="iq-card iq-card-block iq-card-stretch iq-card-height">
                                <div class="iq-card-body" style="background-color: rgb(196, 70, 70); border-radius: 20px;">
                                    <div class="icon iq-icon-box iq-bg-primary rounded" data-wow-delay="0.2s" style="font-size: 65px;">
                                        <i class="ri-mail-line"></i>
                                    </div>
                                    <div class="mt-4">
                                        <h5 class="text-primary text-uppercase" style="font-size: 45px;">Feedback</h5>
                                        <h3 class="d-flex text-primary" style="font-size: 50px;"> 3<i class="ri-arrow-up-line"></i></h3>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="col-sm-6 col-md-6 col-lg-6">
                            <div class="iq-card iq-card-block iq-card-stretch iq-card-height">
                                <div class="iq-card-body" style="background-color: rgb(196, 70, 70); border-radius: 20px;">
                                    <div class="icon iq-icon-box iq-bg-primary rounded" data-wow-delay="0.2s" style="font-size: 65px;">
                                        <i class="ri-safe-line"></i>
                                    </div>
                                    <div class="mt-4">
                                        <h5 class="text-primary text-uppercase" style="font-size: 45px;">Deposit</h5>
                                        <h3 class="d-flex text-primary" style="font-size: 50px;"> <?= $deposits->rowCount(); ?><i class="ri-arrow-up-line"></i></h3>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="col-sm-6 col-md-6 col-lg-6">
                            <div class="iq-card iq-card-block iq-card-stretch iq-card-height" style="background-color: rgb(196, 70, 70); border-radius: 20px;">
                                <div class="iq-card-body">
                                    <div class="icon iq-icon-box iq-bg-primary rounded" data-wow-delay="0.2s" style="font-size: 65px;">
                                        <i class="ri-swap-fill"></i>
                                    </div>
                                    <div class="mt-4">
                                        <h5 class="text-primary text-uppercase" style="font-size: 35px;">Withdrawal</h5>
                                        <h3 class="d-flex text-primary" style="font-size: 50px;"> <?= $withdrawal->rowCount(); ?><i class="ri-arrow-up-line"></i></h3>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>
            </div>
        </div>
    </div>
    <!-- Wrapper END -->
    <!-- Footer -->
    <?php include 'footer.php' ?>
    <!-- Footer END -->
    <!-- color-customizer -->

    <!-- color-customizer END -->
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="js/jquery.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <!-- Appear JavaScript -->
    <script src="js/jquery.appear.js"></script>
    <!-- Countdown JavaScript -->
    <script src="js/countdown.min.js"></script>
    <!-- Counterup JavaScript -->
    <script src="js/waypoints.min.js"></script>
    <script src="js/jquery.counterup.min.js"></script>
    <!-- Wow JavaScript -->
    <script src="js/wow.min.js"></script>
    <!-- Apexcharts JavaScript -->
    <script src="js/apexcharts.js"></script>
    <!-- Slick JavaScript -->
    <script src="js/slick.min.js"></script>
    <!-- Select2 JavaScript -->
    <script src="js/select2.min.js"></script>
    <!-- Owl Carousel JavaScript -->
    <script src="js/owl.carousel.min.js"></script>
    <!-- Magnific Popup JavaScript -->
    <script src="js/jquery.magnific-popup.min.js"></script>
    <!-- Smooth Scrollbar JavaScript -->
    <script src="js/smooth-scrollbar.js"></script>
    <!-- lottie JavaScript -->
    <script src="js/lottie.js"></script>
    <!-- am core JavaScript -->
    <script src="js/core.js"></script>
    <!-- am charts JavaScript -->
    <script src="js/charts.js"></script>
    <!-- am animated JavaScript -->
    <script src="js/animated.js"></script>
    <!-- am kelly JavaScript -->
    <script src="js/kelly.js"></script>
    <!-- am maps JavaScript -->
    <script src="js/maps.js"></script>
    <!-- am worldLow JavaScript -->
    <script src="js/worldLow.js"></script>
    <!-- Raphael-min JavaScript -->
    <script src="js/raphael-min.js"></script>
    <!-- Morris JavaScript -->
    <script src="js/morris.js"></script>
    <!-- Morris min JavaScript -->
    <script src="js/morris.min.js"></script>
    <!-- Flatpicker Js -->
    <script src="js/flatpickr.js"></script>
    <!-- Style Customizer -->
    <script src="js/style-customizer.js"></script>
    <!-- Chart Custom JavaScript -->
    <script src="js/chart-custom.js"></script>
    <!-- Custom JavaScript -->
    <script src="js/custom.js"></script>

</body>
</html>