<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
// Rest of your PHP code goes here
?>

<?php
 // super-admin-guard.php
session_start();

if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'super_admin') {
    	echo "
        <script>
            alert('Access Denied. You're not a Super-Admin. Please re-login.');
            window.location.href = 'sign-in.php';
        </script>
        ";
        exit;
}


$company_id = (int) $_SESSION['company_id'];




?>
<?php

include_once("includes/config.php");
include('functions.php');

//to block app usage entirely
session_start();
$sub = checkCompanySubscription($mysqli, $_SESSION['company_id']);


?>
<!DOCTYPE html>
<html>


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

   <meta content="FinVoice- Invoicing, Finance and Scheduling" name="description">
<meta content="FinVoice- Invoicing, Finance and Scheduling" name="keywords">

<meta content="FinVoice- Invoicing, Finance and Scheduling" property="og:title">

    <!-- Favicon -->
        <link rel="apple-touch-icon" sizes="180x180" href="app-assets/favicon/inv.png">
    <link rel="icon" type="image/png" sizes="32x32" href="app-assets/favicon/inv.png">
    <link rel="icon" type="image/png" sizes="16x16" href="app-assets/favicon/inv.png">
    <link rel="manifest" href="app-assets/favicon/inv.png">
    <link rel="mask-icon" href="app-assets/favicon/inv.png" color="#0010f7">
    <meta name="msapplication-TileColor" content="#0010f7">
    <meta name="theme-color" content="#ffffff">

    <!-- Font -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&amp;display=swap" rel="stylesheet" />

    <!-- Plugin -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/plugin/swiper-bundle.min.css">
    <link rel="stylesheet" type="text/css" href="app-assets/icons/iconly/index.min.css">
    <link rel="stylesheet" type="text/css" href="app-assets/icons/remix-icon/index.min.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/colors.css">

    <!-- Base -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/base/typography.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/base/base.css">

    <!-- Theme -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/theme/colors-dark.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/theme/theme-dark.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/custom-rtl.css">

    <!-- Layouts -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/layouts/sider.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/layouts/header.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/layouts/page-content.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/components.css">
    <!-- Customizer -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/layouts/customizer.css">

    <!-- Charts -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/plugin/apex-charts.css">

    <!-- Pages -->
    <link rel="stylesheet" type="text/css" href="app-assets/css/pages/dashboard-analytics.css">

    <!-- Custom -->
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <link rel="stylesheet" type="text/css" href="assets/css/all.min.css">

    <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  
<!-- Theme style -->
<link rel="stylesheet" href="css/AdminLTE.css">
    <!-- CSS -->
    
	<link rel="stylesheet" href="css/bootstrap.datetimepicker.css">
	<link rel="stylesheet" href="//cdn.datatables.net/1.10.7/css/jquery.dataTables.css">
	<link rel="stylesheet" href="//cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/styles.css">
	
  <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  	<!-- JS -->
	
	<script src="js/moment.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.js"></script>
	<script src="//cdn.datatables.net/plug-ins/1.10.7/integration/bootstrap/3/dataTables.bootstrap.js"></script>
	<script src="js/bootstrap.datetime.js"></script>
	<script src="js/bootstrap.password.js"></script>
	<script src="js/scripts.js"></script>


<?php include("new-css.php"); ?>




	
	<!-- AdminLTE App -->
	<script src="js/app.min.js"></script>

    <title>Invoice360- Invoices. Vouchers. Transactions </title>


</head>


<body>

<?php

$company = getCompanyDetails($mysqli, $_SESSION['company_id']);
    $company_name    = $company['company_name'] ?? '';
    $currency        = $company['currency'] ?? '';
    $vat_rate        = $company['vat_rate'] ?? '';
    $invoice_prefix  = $company['invoice_prefix'] ?? '';
    $company_logo    = $company['company_logo'] ?? '';
    $target          = $company['year_target'] ?? '';
    $enable_vat      = $company['enable_vat'] ?? '';







?>




<!-- Mobile-only menu -->
<div class="mobile-menu-fixed visible-xs text-right">
    <button class="btn btn-primary btn-sm dropdown-toggle"
            data-toggle="dropdown">
        <i class="fa fa-bars"></i> Menu
    </button>

<ul class="dropdown-menu dropdown-menu-end mobile-menu">

    <!-- Dashboard -->
    <li>
        <a class="dropdown-item" href="master-sub.php">
            <i class="fa fa-dashboard me-2"></i> Home
        </a>
    </li>

    <li>
        <a class="dropdown-item" href="master-send-admin-email.php">
            <i class="fa fa-list-alt me-2"></i> Send Email
        </a>
    </li>









</ul>

</div>


    <main class="hp-bg-color-dark-90 d-flex min-vh-100">
        <div class="hp-sidebar hp-bg-color-black-20 hp-bg-color-dark-90 border-end border-black-40 hp-border-color-dark-80">
            <div class="hp-sidebar-container">
                <div class="hp-sidebar-header-menu">
                    <div class="row justify-content-between align-items-end mx-0">
                        <div class="w-auto px-0 hp-sidebar-collapse-button hp-sidebar-visible">
                            <div class="hp-cursor-pointer">
                                <svg width="8" height="15" viewBox="0 0 8 15" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path d="M3.91102 1.73796L0.868979 4.78L0 3.91102L3.91102 0L7.82204 3.91102L6.95306 4.78L3.91102 1.73796Z" fill="#B2BEC3"></path>
                                    <path d="M3.91125 12.0433L6.95329 9.00125L7.82227 9.87023L3.91125 13.7812L0.000224113 9.87023L0.869203 9.00125L3.91125 12.0433Z" fill="#B2BEC3"></path>
                                </svg>
                            </div>
                        </div>

                        <div style="max-height: 100px; display: flex; align-items: center;" class="logo-class w-auto px-0">
                            
                                

                            <a href="dashboard.php" ><img src="images/<?php echo $company_logo?>" float="left" alt="" width="auto"> </a>
                            
                        </div>

                        
                    </div>

                <ul>
                    <li>
                            <div class="menu-title">Master Admin</div>

                            <ul>
                                <li>
                                    <a href="master-sub.php">
                                        <div class="tooltip-item in-active" data-bs-toggle="tooltip" data-bs-placement="right" title="" data-bs-original-title="Analytics" aria-label="Analytics"></div>

                                        <span>
                                            <span class="submenu-item-icon">
                                            <i class="fa fa-tachometer"></i>

                                            </span>

                                            <span>Home</span>
                                        </span>
                                    </a>
                                </li>

                               
                                <li>
                                    <a  href="master-send-admin-email.php">
                                <div class="tooltip-item in-active" data-bs-toggle="tooltip" data-bs-placement="right" title="" data-bs-original-title="E-Commerce" aria-label="E-Commerce"></div>
                                        <span>
                                            <span class="submenu-item-icon">
                                            <i class="fa fa-envelope"></i>

                                            </span>

                                            <span>Send Email</span>
                                        </span>
                                    </a>
                                </li>
                                
                                
                            </ul>
                    


                    

                        

                               
                </ul>
                </div>

                <div class="row justify-content-between align-items-center hp-sidebar-footer mx-0 hp-bg-color-dark-90">
                    <div class="divider border-black-40 hp-border-color-dark-70 hp-sidebar-hidden mt-0 px-0"></div>

                    <div class="col">
                        <div class="row align-items-center">
                            <div class="w-auto px-0">
                                <div class="avatar-item bg-primary-4 d-flex align-items-center justify-content-center rounded-circle" style="width: 48px; height: 48px;">
                                    <img src="images/icon/user.png" height="100%" class="hp-img-cover">
                                </div>
                            </div>

                            <div class="w-auto ms-8 px-0 hp-sidebar-hidden mt-4">
                                <span style="font-family:'Calibri'; font-size: 17px;" class="d-block hp-text-color-black-100 hp-text-color-dark-0 hp-p1-body lh-1">
                                     <?php

if (!isset($_SESSION['user_id'])) {
    header("Location: login.php");
    exit;
}

echo "Every moment matters <br><b>" . $_SESSION['user_name'] . "!";
?>
</b>
                                </span>
                            
                            </div>
                        </div>
                    </div>

                    
                </div>
            </div>
        </div>
        
<div class="hp-main-layout">

        
            

            
