<?php include($_SERVER['DOCUMENT_ROOT'] . "/COMPONENTS/root/path.php"); ?>
<style>
    .container-fluid {
        background: url("<?php echo $website_name ?>/assets/images/big/BooomersPhilly2022-2.png") no-repeat center center !important;

    }
</style>

<div id="main-wrapper" data-theme="light" data-layout="vertical" data-navbarbg="skin6" data-sidebartype="full" data-sidebar-position="fixed" data-header-position="fixed" data-boxed-layout="full">
    <header class="topbar" data-navbarbg="skin6">
        <nav class="navbar top-navbar navbar-expand-md">
            <div class="navbar-header" data-logobg="skin6">
                <!-- This is for the sidebar toggle which is visible on mobile only -->
                <a class="nav-toggler waves-effect waves-light d-block d-md-none" href="javascript:void(0)"><i class="ti-menu ti-close"></i></a>
                <!-- ============================================================== -->
                <!-- Logo -->
                <!-- ============================================================== -->
                <div class="navbar-brand">
                    <!-- Logo icon -->
                    <a href="index.html">
                        <b class="logo-icon">
                            <img src="<?php echo $website_name; ?>/assets/images/booomers-logo.png" alt="user" class="" width="200px">
                        </b>
                        <!--End Logo icon -->
                        <!-- Logo text -->
                        <span class="logo-text">

                        </span>
                    </a>
                </div>
                <!-- ============================================================== -->
                <!-- End Logo -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Toggle which is visible on mobile only -->
                <!-- ============================================================== -->
                <a class="topbartoggler d-block d-md-none waves-effect waves-light" href="javascript:void(0)" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><i class="ti-more"></i></a>
            </div>
            <!-- ============================================================== -->
            <!-- End Logo -->
            <!-- ============================================================== -->
            <div class="navbar-collapse collapse" style='box-shadow: 0 10px 20px rgba(0, 0, 0, 0.082), 0 6px 6px rgba(0, 0, 0, 0.082);' id="navbarSupportedContent">
                <!-- ============================================================== -->
                <!-- toggle and nav items -->
                <!-- ============================================================== -->
                <ul class="navbar-nav float-left mr-auto ml-3 pl-1">
                    <!-- Notification -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle pl-md-3 position-relative" href="javascript:void(0)" id="bell" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <span><i data-feather="bell" class="svg-icon"></i></span>
                            <span class="badge badge-primary notify-no rounded-circle">5</span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-left mailbox animated bounceInDown">
                            <ul class="list-style-none">
                                <li>
                                    <div class="message-center notifications position-relative">
                                        <!-- Message -->
                                        <a href="javascript:void(0)" class="message-item d-flex align-items-center border-bottom px-3 py-2">
                                            <div class="btn btn-danger rounded-circle btn-circle"><i data-feather="airplay" class="text-white"></i></div>
                                            <div class="w-75 d-inline-block v-middle pl-2">
                                                <h6 class="message-title mb-0 mt-1">Luanch Admin</h6>
                                                <span class="font-12 text-nowrap d-block text-muted">Just see
                                                    the my new
                                                    admin!</span>
                                                <span class="font-12 text-nowrap d-block text-muted">9:30 AM</span>
                                            </div>
                                        </a>
                                        <!-- Message -->
                                        <a href="javascript:void(0)" class="message-item d-flex align-items-center border-bottom px-3 py-2">
                                            <span class="btn btn-success text-white rounded-circle btn-circle"><i data-feather="calendar" class="text-white"></i></span>
                                            <div class="w-75 d-inline-block v-middle pl-2">
                                                <h6 class="message-title mb-0 mt-1">Event today</h6>
                                                <span class="font-12 text-nowrap d-block text-muted text-truncate">Just
                                                    a reminder that you have event</span>
                                                <span class="font-12 text-nowrap d-block text-muted">9:10 AM</span>
                                            </div>
                                        </a>
                                        <!-- Message -->
                                        <a href="javascript:void(0)" class="message-item d-flex align-items-center border-bottom px-3 py-2">
                                            <span class="btn btn-info rounded-circle btn-circle"><i data-feather="settings" class="text-white"></i></span>
                                            <div class="w-75 d-inline-block v-middle pl-2">
                                                <h6 class="message-title mb-0 mt-1">Settings</h6>
                                                <span class="font-12 text-nowrap d-block text-muted text-truncate">You
                                                    can customize this template
                                                    as you want</span>
                                                <span class="font-12 text-nowrap d-block text-muted">9:08 AM</span>
                                            </div>
                                        </a>
                                        <!-- Message -->
                                        <a href="javascript:void(0)" class="message-item d-flex align-items-center border-bottom px-3 py-2">
                                            <span class="btn btn-primary rounded-circle btn-circle"><i data-feather="box" class="text-white"></i></span>
                                            <div class="w-75 d-inline-block v-middle pl-2">
                                                <h6 class="message-title mb-0 mt-1">Pavan kumar</h6> <span class="font-12 text-nowrap d-block text-muted">Just
                                                    see the my admin!</span>
                                                <span class="font-12 text-nowrap d-block text-muted">9:02 AM</span>
                                            </div>
                                        </a>
                                    </div>
                                </li>
                                <li>
                                    <a class="nav-link pt-3 text-center text-dark" href="javascript:void(0);">
                                        <strong>Check all notifications</strong>
                                        <i class="fa fa-angle-right"></i>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <!-- End Notification -->
                    <!-- ============================================================== -->
                    <!-- create new -->
                    <!-- ============================================================== -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <i data-feather="settings" class="svg-icon"></i>
                        </a>
                    </li>
                    <li class="nav-item d-none d-md-block">
                        <a class="nav-link" href="javascript:void(0)">
                            <div class="customize-input">
                                <select class="custom-select form-control bg-white custom-radius custom-shadow border-0">
                                    <option selected>EN</option>
                                    <option value="1">AB</option>
                                    <option value="2">AK</option>
                                    <option value="3">BE</option>
                                </select>
                            </div>
                        </a>
                    </li>
                </ul>
                <!-- ============================================================== -->
                <!-- Right side toggle and nav items -->
                <!-- ============================================================== -->
                <ul class="navbar-nav float-right">
                    <!-- ============================================================== -->
                    <!-- Search -->
                    <!-- ============================================================== -->
                    <li class="nav-item d-none d-md-block">
                        <!-- <a class="nav-link" href="javascript:void(0)">
                            <form>
                                <div class="customize-input">
                                    <input class="form-control custom-shadow custom-radius border-0 bg-white" type="search" placeholder="Search" aria-label="Search">
                                    <i class="form-control-icon" data-feather="search"></i>
                                </div>
                            </form>
                        </a> -->
                    </li>
                    <!-- ============================================================== -->
                    <!-- User profile and search -->
                    <!-- ============================================================== -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">

                            <img src="assets/images/users/mlss-sos-user.webp" alt="user" class="rounded-circle" width="30">
                            <span class="ml-2 d-none d-lg-inline-block"><span>Hello,</span> <span class="text-dark fullname">User Name</span> <i data-feather="chevron-down" class="svg-icon"></i></span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right user-dd animated flipInY">
                            <a class="dropdown-item" href="javascript:void(0)"><i data-feather="user" class="svg-icon mr-2 ml-1"></i>
                                My Profile</a>
                            <a class="dropdown-item" href="javascript:void(0)"><i data-feather="credit-card" class="svg-icon mr-2 ml-1"></i>
                                My Balance</a>
                            <a class="dropdown-item" href="javascript:void(0)"><i data-feather="mail" class="svg-icon mr-2 ml-1"></i>
                                Inbox</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="javascript:void(0)"><i data-feather="settings" class="svg-icon mr-2 ml-1"></i>
                                Account Setting</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="javascript:void(0)"><i data-feather="power" class="svg-icon mr-2 ml-1"></i>
                                Logout</a>
                            <div class="dropdown-divider"></div>
                            <div class="pl-4 p-3"><a href="javascript:void(0)" class="btn btn-sm btn-info">View
                                    Profile</a></div>
                        </div>
                    </li>
                    <!-- ============================================================== -->
                    <!-- User profile and search -->
                    <!-- ============================================================== -->
                </ul>
            </div>
        </nav>
    </header>
    <aside class="left-sidebar" data-sidebarbg="skin6">
        <!-- Sidebar scroll-->
        <div class="scroll-sidebar" data-sidebarbg="skin6">
            <!-- Sidebar navigation-->
            <nav class="sidebar-nav">
                <ul id="sidebarnav">
                    <?php
                    $_SESSION["role"] = $_GET["role"];
                    $_SESSION["userId"] = $_GET["userId"];
                    $role = $_GET["role"];
                    $userId = $_GET["userId"];
                    if (empty($role)) {
                        $role = $_SESSION["role"];
                        $userId = $_SESSION["userId"];
                    }
                    if ($_GET["role"] == "Super Admin") {
                        $query1 = mysqli_query($business_conn, "SELECT * FROM businesses_menu GROUP BY Category");
                        while ($spec1 = mysqli_fetch_assoc($query1)) {

                    ?>
                            <li class="list-divider"></li>
                            <li class="nav-small-cap"><span class="hide-menu"><?php echo $spec1["Category"] ?></span></li>
                            <?php
                            $query = mysqli_query($business_conn, "SELECT * FROM businesses_menu WHERE Category = '" . $spec1["Category"] . "'");
                            while ($spec = mysqli_fetch_assoc($query)) {
                            ?>
                                <li class="sidebar-item">
                                    <a class="nav-item sidebar-link <?php echo $spec["HasArrow"]; ?>" href="#" data-url="<?php echo $spec["MenuItemFileName"]; ?>.php" aria-expanded="false"><i data-feather="<?php echo $spec["Icon"]; ?>" class="feather-icon"></i><span class="hide-menu"><?php echo $spec["MenuItem"] ?>
                                        </span> <span class="total_agents"></span></a>
                                    <ul aria-expanded="false" class="collapse  first-level base-level-line">
                                        <?php
                                        $query2 = mysqli_query($business_conn, "SELECT * FROM businesses_menu_sub WHERE MajorMenuId = '" . $spec["id"] . "'");
                                        while ($spec2 = mysqli_fetch_assoc($query2)) {
                                        ?>

                                            <li class="sidebar-item">
                                                <a href="#" data-url="<?php echo $spec2["SubMenuItemFileName"]; ?>.php" class="nav-item nav-item sidebar-link <?php echo $spec2["HasArrow"]; ?>"><span class="hide-menu"><?php echo $spec2["SubMenuItem"] ?>
                                                    </span> <span class="individual_company"></span></a>
                                            </li>

                                        <?php
                                        }
                                        ?>
                                    </ul>
                                </li>
                            <?php
                            }
                            ?>
                        <?php
                        }
                    } else {
                        $query1 = mysqli_query($business_conn, "SELECT * FROM businesses_menu WHERE MenuItem = 'Dashboard'");
                        while ($spec1 = mysqli_fetch_assoc($query1)) {
                        ?>
                            <li class="sidebar-item">
                                <a class="nav-item sidebar-link <?php echo $spec1["HasArrow"]; ?>" href="#" data-url="<?php echo $spec1["MenuItemFileName"]; ?>.php" aria-expanded="false"><i data-feather="<?php echo $spec1["Icon"]; ?>" class="feather-icon"></i><span class="hide-menu"><?php echo $spec1["MenuItem"] ?>
                                    </span> <span class="total_agents"></span></a>
                                <ul aria-expanded="false" class="collapse  first-level base-level-line">
                                    <?php
                                    $query2 = mysqli_query($business_conn, "SELECT * FROM businesses_menu_sub WHERE MajorMenuId = '" . $spec1["id"] . "'");
                                    while ($spec2 = mysqli_fetch_assoc($query2)) {
                                    ?>

                                        <li class="sidebar-item">
                                            <a href="#" data-url="<?php echo $spec2["SubMenuItemFileName"]; ?>.php" class="nav-item nav-item sidebar-link <?php echo $spec2["HasArrow"]; ?>"><span class="hide-menu"><?php echo $spec2["SubMenuItem"] ?>
                                                </span> <span class="individual_company"></span></a>
                                        </li>

                                    <?php
                                    }
                                    ?>
                                </ul>
                            </li>

                        <?php
                        }
                        $query1 = mysqli_query($conn, "SELECT * FROM user_accessible_features WHERE unique_user_id = '" . $_GET["userId"] . "'");
                        while ($spec1 = mysqli_fetch_assoc($query1)) {
                        ?>
                            <?php
                            $query = mysqli_query($business_conn, "SELECT * FROM businesses_menu WHERE MenuItem = '" . $spec1["MenuItemId"] . "'");
                            while ($spec = mysqli_fetch_assoc($query)) {
                            ?>
                                <li class="sidebar-item">
                                    <a class="nav-item sidebar-link <?php echo $spec["HasArrow"]; ?>" href="#" data-url="<?php echo $spec["MenuItemFileName"]; ?>.php" aria-expanded="false"><i data-feather="<?php echo $spec["Icon"]; ?>" class="feather-icon"></i><span class="hide-menu"><?php echo $spec["MenuItem"] ?>
                                        </span> <span class="total_agents"></span></a>
                                    <ul aria-expanded="false" class="collapse  first-level base-level-line">
                                        <?php
                                        $query2 = mysqli_query($business_conn, "SELECT * FROM businesses_menu_sub WHERE MajorMenuId = '" . $spec["id"] . "'");
                                        while ($spec2 = mysqli_fetch_assoc($query2)) {
                                        ?>

                                            <li class="sidebar-item">
                                                <a href="#" data-url="<?php echo $spec2["SubMenuItemFileName"]; ?>.php" class="nav-item nav-item sidebar-link <?php echo $spec2["HasArrow"]; ?>"><span class="hide-menu"><?php echo $spec2["SubMenuItem"] ?>
                                                    </span> <span class="individual_company"></span></a>
                                            </li>

                                        <?php
                                        }
                                        ?>
                                    </ul>
                                </li>
                            <?php
                            }
                            ?>

                    <?php
                        }
                    }
                    ?>
                    <li class="sidebar-item"> <a class="logout sidebar-link" href="#" aria-expanded="false"><i data-feather="power" class="feather-icon"></i><span class="hide-menu">Log Out
                            </span></a>
                    </li>
                </ul>
            </nav>
            <!-- End Sidebar navigation -->
        </div>
        <!-- End Sidebar scroll-->
    </aside>
    <div class="page-wrapper">
        <div class="page-breadcrumb">
            <div class="row">
                <div class="col-7 align-self-center">
                    <h3 class="page-title text-truncate text-dark font-weight-medium mb-1"><span class="greeting">Good Evening</span> <span class='firstname'>First Name</span></h3>
                    <div class="d-flex align-items-center">
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb m-0 p-0">
                                <li class="breadcrumb-item"><a href="#" class='role'>Role</a>
                                </li>
                            </ol>
                        </nav>
                    </div>
                </div>

                <div class="col-5 align-self-center">
                    <div class="customize-input float-right">
                        <select class="custom-select custom-select-set form-control bg-white border-0 custom-shadow custom-radius">
                            <option selected><?php echo Date('M d', strtotime("today")); ?></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>

        <div class="preloader1 lds-ripple" style='background:none;'>
            <div class="lds-pos"></div>
            <div class="lds-pos"></div>
        </div>
        <div class="container-fluid" style="max-height:100vh; overflow-y: auto;">


        </div>



        <footer class="footer text-center text-muted">
            All Rights Reserved by booomers bamboo bikes. Designed and Developed by <a href="#">Aura-rich Consult & Technologies</a>.
        </footer>

    </div>

</div>


<script src="<?php echo $website_name; ?>/dist/js/custom.min.js"></script>
<!-- <script src="<?php echo $website_name; ?>/dist/js/pages/dashboards/dashboard1.min.js"></script> -->

<script>
    var thehours = new Date().getHours();
    var themessage;
    var morning = ('Good Morning');
    var afternoon = ('Good Afternoon');
    var evening = ('Good Evening');

    if (thehours >= 0 && thehours < 12) {
        themessage = morning;
    } else if (thehours >= 12 && thehours < 17) {
        themessage = afternoon;
    } else if (thehours >= 17 && thehours < 24) {
        themessage = evening;
    }
    $('.greeting').html(themessage);
    $(".sidebar-link").removeClass("active");
    // $(".sidebar-link:first").addClass("active");
    $(".clickableLink").on("click", function() {
        var index = $(".sidebar-link").index(this);
        sessionStorage.removeItem("SigninPage");
        sessionStorage.setItem("nthChild", index);
        var url = $(this).attr("data-url");
        sessionStorage.setItem("contentPath", url);
        $(".preloader1").show();
        $(".sidebar-link").removeClass("active");
        $(this).addClass("active");

        if (url != undefined) {
            $(".container-fluid").load(domain + "/COMPONENTS/" + url, function(data) {
                $(".preloader1").fadeOut();
                $(".container-fluid,.footer").hide();
                $(".container-fluid,.footer").fadeIn(1000);
                // $(".container-fluid").load(domain + "/COMPONENTS/" + subUrl, function(data) {});
            })
        }
    });
    $(".logout").off().on("click", function() {
        $(".body").load(domain + "/COMPONENTS/signin/index.php", function() {
            $(".signin-signup-form").load(domain + "/COMPONENTS/signin/form.php", function() {
                $(".preloader").fadeOut();
                sessionStorage.clear();
                sessionStorage.setItem('SigninPage', "1");
            })
        });
    });

    var firstname = fullname.replace(/ .*/, '');
    $(".fullname").html(fullname);
    $(".firstname").html(firstname + "!")
    $(".role").html(role + " Dashboard");

    $('#sidebarnav a').on('click', function() {
        if (!$(this).hasClass("activee")) {
            // hide any open menus and remove all other classes
            $("ul", $(this).parents("ul:first")).removeClass("in");
            $("a", $(this).parents("ul:first")).removeClass("activee");

            // open our new menu and add the open class
            $(this).next("ul").addClass("in");
            $(this).addClass("activee");

        } else if ($(this).hasClass("activee")) {
            $(this).removeClass("activee");
            $(this).parents("ul:first").removeClass("activee");
            $(this).next("ul").removeClass("in");
        }
    });

    $.getJSON(domain_api + "/candidate/candidate-count.php?role=" + encodeURIComponent(role) + "&nationality=" + encodeURIComponent(user_nationality), function(results) {
        $(".total_candidates").html("&nbsp;(" + results.total_candidates + ")");
        $(".skilled_unskilled_total_candidates").html("&nbsp;(" + results.skilled_unskilled_total_candidates + ")");
        $(".skilled_unskilled_applied_pending").html("&nbsp;(" + results.skilled_unskilled_applied_pending + ")");
        $(".skilled_unskilled_shortlisted").html("&nbsp;(" + results.skilled_unskilled_shortlisted + ")");

        $(".skilled_unskilled_approved").html("&nbsp;(" + results.skilled_unskilled_approved + ")");
        $(".skilled_unskilled_rejected").html("&nbsp;(" + results.skilled_unskilled_rejected + ")");
        $(".skilled_unskilled_first_payment").html("&nbsp;(" + results.skilled_unskilled_first_payment + ")");
        $(".skilled_unskilled_hired_medicals").html("&nbsp;(" + results.skilled_unskilled_hired_medicals + ")");
        $(".skilled_unskilled_police_report").html("&nbsp;(" + results.skilled_unskilled_police_report + ")");
        $(".skilled_unskilled_training").html("&nbsp;(" + results.skilled_unskilled_training + ")");
        $(".skilled_unskilled_second_payment").html("&nbsp;(" + results.skilled_unskilled_second_payment + ")");
        $(".skilled_unskilled_travel_documents").html("&nbsp;(" + results.skilled_unskilled_travel_documents + ")");
        $(".skilled_unskilled_ready_to_be_deployed").html("&nbsp;(" + results.skilled_unskilled_ready_to_be_deployed + ")");
        $(".skilled_unskilled_currently_deployed").html("&nbsp;(" + results.skilled_unskilled_currently_deployed + ")");

        $(".masters_degree_total_candidates").html("&nbsp;(" + results.masters_degree_total_candidates + ")");
        $(".masters_degree_applied_pending").html("&nbsp;(" + results.masters_degree_applied_pending + ")");

        $(".diaspora_engagement_total_candidates").html("&nbsp;(" + results.diaspora_engagement_total_candidates + ")");
        $(".diaspora_engagement_applied_pending").html("&nbsp;(" + results.diaspora_engagement_applied_pending + ")");

        $(".all_total_candidates").html(results.total_candidates);
        $(".all_total_deployed").html(results.skilled_unskilled_currently_deployed);

        $(".all_skilled_unskilled_applied_pending").html(results.skilled_unskilled_applied_pending);
        $(".all_skilled_unskilled_shortlisted").html(results.skilled_unskilled_shortlisted);
        $(".all_skilled_unskilled_interview").html(results.skilled_unskilled_approved);
        $(".all_skilled_unskilled_first_payment").html(results.skilled_unskilled_first_payment);
        $(".all_skilled_unskilled_hired").html(results.skilled_unskilled_hired_medicals);
        $(".all_skilled_unskilled_police_report").html(results.skilled_unskilled_police_report);
        $(".all_skilled_unskilled_training").html(results.skilled_unskilled_training);
        $(".all_skilled_unskilled_second_payment").html(results.skilled_unskilled_second_payment);
        $(".all_skilled_unskilled_travel_documents").html(results.skilled_unskilled_travel_documents);
        $(".all_skilled_unskilled_deploy").html(results.skilled_unskilled_ready_to_be_deployed);
        $(".all_skilled_unskilled_deployed").html(results.skilled_unskilled_currently_deployed);
        $(".all_skilled_unskilled_rejected").html(results.skilled_unskilled_rejected);
        $(".all_masters_degree_applied_pending").html(results.masters_degree_applied_pending);
    });

    $.getJSON(domain_api + "/agent/agent-count.php?role=" + encodeURIComponent(role) + "&nationality=" + encodeURIComponent(user_nationality), function(results) {
        $(".total_agents").html("&nbsp;(" + results.total_agents + ")");
        $(".individual_company").html("&nbsp;(" + results.individual_company + ")");
        $(".chiefdom_focal_person").html("&nbsp;(" + results.chiefdom_focal_person + ")");
        $(".government").html("&nbsp;(" + results.government + ")");
        $(".sos").html("&nbsp;(" + results.sos + ")");

        $(".all_total_agents").html(results.total_agents);
    });

    $.getJSON(domain_api + "/employer/employer-count.php?role=" + encodeURIComponent(role) + "&nationality=" + encodeURIComponent(user_nationality), function(results) {
        $(".total_employers").html("&nbsp;(" + results.total_employers + ")");
        $(".all_total_employers").html(results.total_employers);
    });

    $.getJSON(domain_api + "/admin/admin-count.php?role=" + encodeURIComponent(role) + "&nationality=" + encodeURIComponent(user_nationality), function(results) {
        $(".total_admin").html("&nbsp;(" + results.total_admin + ")");
    });

    $.getJSON(domain_api + "/employer/available-vacancies.php", function(results) {
        $(".total_available_vacancies").html("&nbsp;(" + results.total_available_vacancies + ")");
    });
</script>