<?php
include "db.php";
session_start();
if (!isset($_SESSION['email'])) {
  header("Location:login.php");
}
?>

<!DOCTYPE html>
<html lang="en" dir="ltr" data-bs-theme="light" data-color-theme="Blue_Theme" data-layout="vertical">

<head>
    <!-- Required meta tags -->
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <!-- Favicon icon-->
    <link rel="shortcut icon" type="image/png" href="../sglogo.png" />

    <!-- Core Css -->
    <link rel="stylesheet" href="assets/css/styles.css" />

    <title>Admin</title>
</head>

<body class="link-sidebar">
   
    <div id="main-wrapper">
        <!-- Sidebar Start -->

        <?php
    include "header.php";
    ?>

        <div class="body-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body p-4 pb-0" data-simplebar="">
                                <div class="row">
                                    <div class="col col-md-3">
                                      <a href="contact.php">
                                        <div class="card primary-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-primary flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="solar:dollar-minimalistic-linear"
                                                        class="fs-7 text-white"></iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Contacts</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                    <?php
                                                    include "db.php";

                                                    $count_query = "SELECT COUNT(*) AS total FROM contact";
                                                    $count_result = mysqli_query($conn, $count_query);
                                                    $row = mysqli_fetch_assoc($count_result);
                                                    echo number_format($row['total']);
                                                    ?>
                                                </h4>
                                            </div>
                                        </div>
                                      </a>
                                    </div>

                                    <div class="col col-md-3">
                                      <a href="hiring.php">
                                        <div class="card secondary-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-secondary flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="ic:outline-backpack" class="fs-7 text-white">
                                                    </iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Hiring</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                    <?php
                                                    include "db.php";
                                                    $count_query = "SELECT COUNT(*) AS total FROM hiring_applications";
                                                    $count_result = mysqli_query($conn, $count_query);
                                                    $row = mysqli_fetch_assoc($count_result);
                                                    echo number_format($row['total']);
                                                    ?>
                                                </h4>
                                            </div>
                                        </div>
                                      </a>
                                    </div>

                                    <div class="col col-md-3">
                                    <a href="inquiry.php">
                                        <div class="card danger-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-danger flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="ic:baseline-sync-problem"
                                                        class="fs-7 text-white"></iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Inquiry</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                <?php
                                                    include "db.php";
                                                    $count_query = "SELECT COUNT(*) AS total FROM quotes";
                                                    $count_result = mysqli_query($conn, $count_query);
                                                    $row = mysqli_fetch_assoc($count_result);
                                                    echo number_format($row['total']);
                                                    ?>
                                                </h4>
                                            </div>
                                        </div>
                                    </a>
                                    </div>

                                    <div class="col col-md-3">
                                      <a href="blog.php">
                                        <div class="card warning-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-warning flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="solar:recive-twice-square-linear"
                                                        class="fs-7 text-white"></iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Blogs</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                    <?php
                                                    include "db.php";

                                                    $count_query = "SELECT COUNT(*) AS total FROM blogs";
                                                    $count_result = mysqli_query($conn, $count_query);
                                                    $row = mysqli_fetch_assoc($count_result);
                                                    echo number_format($row['total']);
                                                    ?>
                                                </h4>
                                            </div>
                                        </div>
                                      </a>
                                    </div>

                                    <div class="col col-md-3">
                                    <a href="gallery.php">
                                        <div class="card success-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-success flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="ic:outline-forest" class="fs-7 text-white">
                                                    </iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Gallery Images</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                
                                                <?php
                                                    include "db.php";

                                                    $count_query = "SELECT COUNT(*) AS total FROM gallery";
                                                    $count_result = mysqli_query($conn, $count_query);
                                                    $row = mysqli_fetch_assoc($count_result);
                                                    echo number_format($row['total']);
                                                    ?>

                                                </h4>
                                            </div>
                                        </div>
                                    </a>
                                    </div>
                                    
                                    <div class="col col-md-3">
                                      <a href="review.php">
                                        <div class="card primary-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-primary flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="solar:dollar-minimalistic-linear"
                                                        class="fs-7 text-white"></iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Reviews</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                    <?php
                                                    include "db.php";

                                                    $count_query = "SELECT COUNT(*) AS total FROM reviews";
                                                    $count_result = mysqli_query($conn, $count_query);
                                                    $row = mysqli_fetch_assoc($count_result);
                                                    echo number_format($row['total']);
                                                    ?>
                                                </h4>
                                            </div>
                                        </div>
                                      </a>
                                    </div>

                                </div>

                                <!-- <div class="row">

                                    <div class="col col-md-3">
                                    <a href="gallery.php">
                                        <div class="card success-gradient">
                                            <div class="card-body text-center px-9 pb-4">
                                                <div
                                                    class="d-flex align-items-center justify-content-center round-48 rounded text-bg-success flex-shrink-0 mb-3 mx-auto">
                                                    <iconify-icon icon="ic:outline-forest" class="fs-7 text-white">
                                                    </iconify-icon>
                                                </div>
                                                <h6 class="fw-normal fs-3 mb-1">Total Gallery Images</h6>
                                                <h4 class="mb-3 d-flex align-items-center justify-content-center gap-1">
                                                   
                                                </h4>
                                            </div>
                                        </div>
                                    </a>
                                    </div>
                                    
                                </div> -->
                            </div>
                        </div>
                    </div>
                    <!-- ----------------------------------------- -->
                    <!-- Revenue Forecast -->
                    <!-- ----------------------------------------- -->

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


        <script>
        function handleColorTheme(e) {
            document.documentElement.setAttribute("data-color-theme", e);
        }
        </script>
    </div>


    </div>
    <div class="dark-transparent sidebartoggler"></div>
    <!-- Import Js Files -->
    <script src="assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="assets/libs/simplebar/dist/simplebar.min.js"></script>
    <script src="assets/js/theme/app.init.js"></script>
    <script src="assets/js/theme/theme.js"></script>
    <script src="assets/js/theme/app.min.js"></script>
    <script src="assets/js/theme/sidebarmenu-default.js"></script>

    <!-- solar icons -->
    <script src="https://cdn.jsdelivr.net/npm/iconify-icon@1.0.8/dist/iconify-icon.min.js"></script>

    <!-- highlight.js (code view) -->
    <script src="assets/js/highlights/highlight.min.js"></script>
    <script>
    hljs.initHighlightingOnLoad();


    document.querySelectorAll("pre.code-view > code").forEach((codeBlock) => {
        codeBlock.textContent = codeBlock.innerHTML;
    });
    </script>
    <script src="assets/libs/fullcalendar/index.global.min.js"></script>
    <script src="assets/js/apps/calendar-init.js"></script>
    <script src="assets/js/vendor.min.js"></script>
    <script src="assets/libs/apexcharts/dist/apexcharts.min.js"></script>
    <script src="assets/js/dashboards/dashboard3.js"></script>
</body>

</html>