<?php
require_once("../config/session.php");
require_once("../config/function.php");
$main_site_data = main_site_data();
$site_data = site_data();

if(isset($_SESSION["is_login"]) && isset($_SESSION["login_token"])){
if($_SESSION["is_login"]==true && !empty($_SESSION["login_token"])){
$user_data = user_data($_SESSION["login_token"]);
if(empty($user_data['user_id']) || $user_data['login_token']!=$_SESSION["login_token"]){
session_destroy();  
redirect("logout",0);
die; 
}
}else{
session_destroy();  
redirect("logout",0);
die;  
}
}else{
session_destroy();  
redirect("logout",0);
die;  
}

$csrf = aes_encrypt($user_data['login_token'],$site_data['user_id']);

if($user_data['usertype']=="White Label" && $user_data['site_id']==$site_data['site_id']){
session_destroy();  
redirect("logout",0);
die;
}

if($user_data['usertype']=="White Label" && $user_data['user_id']!=$site_data['user_id']){
session_destroy();  
redirect("logout",0);
die;
}

?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title> Dashboard | <?=$site_data['brand']?></title>
    <script>if(window.history.replaceState){window.history.replaceState(null,null,window.location.href);}</script>
    <meta name="author" content="MTG WEB OFFICIAL">
    <meta property="og:locale" content="en_US">
    <meta name="description" content="">
    <meta content="<?=$csrf?>" name="csrf" />
    <link rel="icon" href="<?=$site_data['logo']?>" type="image/*" sizes="16x16">
    <meta name="theme-color" content="#3063A0">
    <link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600" rel="stylesheet"><!-- End Google font -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/open-iconic/1.1.1/font/css/open-iconic-bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="../layouts/members/assets/stylesheets/theme.min.css" data-skin="default">
    <link rel="stylesheet" href="../layouts/members/assets/stylesheets/theme-dark.min.css" data-skin="dark">
    <link rel="stylesheet" href="../layouts/members/assets/stylesheets/custom.css">
    <script src="../layouts/members/assets/vendor/jquery/jquery.min.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
    <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
    <script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool@x.x.x'></script>
    <script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool@latest'></script>
<script>
   var skin = localStorage.getItem('skin') || 'default';
   var disabledSkinStylesheet = document.querySelector('link[data-skin]:not([data-skin="' + skin + '"])');
   disabledSkinStylesheet.setAttribute('rel', '');
   disabledSkinStylesheet.setAttribute('disabled', true);
   document.querySelector('html').classList.add('loading');
</script>

<style>
.logo {
	max-width: 100%;
	height: auto;
}
.hand {
  cursor: pointer;
}
.hr {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}
.card-icon img {
    height: 60px;
}
.form-select {
    display: block;
    width: 100%;
    height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #363642;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #c6c9d5;
    border-radius: 0.25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.form-select-sm {
    height: calc(1.5em + 0.5rem + 2px);
    padding: 0.25rem 0.5rem;
    font-size: .875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
}
::-webkit-scrollbar {
  width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px grey; 
  border-radius: 10px;
}
 
/* Handle */
::-webkit-scrollbar-thumb {
  background: #346cb0; 
  border-radius: 10px;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
  background: #2f63a3; 
}
.modal-header {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(34,34,48,.1);
}

.modal-footer {
    padding: 0.35rem;
    border-top: 1px solid rgba(34,34,48,.1);
}
.text-white {
    color: #ffffff!important;
}

html, body {
  margin: 0;
  padding: 0;
}

</style>
</head>
  <body>

    <div class="app">
      <header class="app-header app-header-dark">
        <div class="top-bar">
          <div class="top-bar-brand">
            <button class="hamburger hamburger-squeeze mr-2" type="button" data-toggle="aside-menu" aria-label="toggle aside menu"><span class="hamburger-box"><span class="hamburger-inner"></span></span></button>
            <a href="dashboard"><img src="<?=$site_data['logo']?>" class="logo" style="height:50px;"></a>
          </div>
          <div class="top-bar-list">
            <div class="top-bar-item px-2 d-md-none d-lg-none d-xl-none">
              <button class="hamburger hamburger-squeeze" type="button" data-toggle="aside" aria-label="toggle menu"><span class="hamburger-box"><span class="hamburger-inner"></span></span></button> 
            </div>
            <div class="top-bar-item top-bar-item-right px-0">
              <ul class="header-nav nav">
                <li class="nav-item header-nav-dropdown">
                  <a class="btn btn-dark btn-sm mt-1" href="addmoney"><span class="fas fa-wallet"> <?=round($user_data['balance'],2)?></span></a>
                </li>
              </ul>
              <div class="dropdown">
                <button class="btn-account" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  <span class="tile tile-circle tile-md mr-2"> <span class="oi oi-person"></span> </span>
                  <span class="account-summary pr-lg-4 d-none d-lg-block"><span class="account-name"><?=$user_data['name']?></span> <span class="account-description"><?=$user_data['usertype']?></span></span></button> <!-- .dropdown-menu -->
                <div class="dropdown-menu">
                  <div class="dropdown-arrow d-lg-none" x-arrow=""></div>
                  <div class="dropdown-arrow ml-3 d-none d-lg-block"></div>
                  <h6 class="dropdown-header d-none d-md-block d-lg-none"> <?=$user_data['name']?> </h6>
                  <a class="dropdown-item" href="profile"><span class="dropdown-icon oi oi-person"></span> Profile</a> 
                  <a class="dropdown-item" href="logout"><span class="dropdown-icon oi oi-account-logout"></span> Logout</a>
                  <div class="dropdown-divider"></div><a class="dropdown-item" href="helpcenter">Help Center</a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </header>
      <aside class="app-aside app-aside-expand-md app-aside-light">
        <div class="aside-content">
          <div class="aside-menu overflow-hidden">
            <nav id="stacked-menu" class="stacked-menu">
              <ul class="menu">
                <li class="menu-item has-active mb-2">
                  <a href="dashboard" class="menu-link"><span class="menu-icon fas fa-home"></span> <span class="menu-text">Dashboard</span></a>
                </li>

             <?php if(in_array($user_data['usertype'], ['White Label','Master Distributor','Distributor','Retailer'])){ ?>
                <!--<li class="menu-item has-child mb-2">-->
                <!--  <a href="#" class="menu-link"><span class="menu-icon fas fa-id-card"></span> <span class="menu-text">PAN Find Services</span></a> -->
                <!--  <ul class="menu">-->
                <!--    <li class="menu-item">-->
                <!--      <a href="panfind" class="menu-link">PAN Find </a>-->
                <!--        <a href="PanDetails" class="menu-link">Pan Details</a>-->
                <!--    </li>-->
                <!--    <li class="menu-item">-->
                <!--      <a href="listofpanfind" class="menu-link">PAN Find List</a>-->
                <!--    </li>-->
                <!--  </ul>-->
                <!--</li>-->
                
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-leaf"></span> <span class="menu-text">Print Manage</span></a> 
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="printRecord" class="menu-link">Records</a>
                    </li>
                  </ul>
                </li>
                
                 <li class="menu-item mb-2">
                  <a href="listofpanfind" class="menu-link"><span class="menu-icon fas fa-id-card" ></span> <span class="menu-text">Pan Find List</span></a>
                </li>

                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-wallet"></span> <span class="menu-text">Wallet Manage</span> 
                    <span class="badge badge-subtle badge-success d-compact-menu-none">₹<?=round($user_data['balance'],2)?></span></a> 
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="addmoney" class="menu-link">Add Money</a>
                    </li>
                    <li class="menu-item">
                      <a href="walletledger" class="menu-link">Transaction</a>
                    </li>
                  </ul>
                </li>
            <?php } ?>
            <?php if(in_array($user_data['usertype'], ['Admin','Master Distributor','Distributor'])){ ?>               
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-users"></span> <span class="menu-text">Members Manage</span></a> 
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="addmember" class="menu-link">Add Member</a>
                    </li>
                    <li class="menu-item">
                      <a href="listofmember" class="menu-link">Member List</a>
                    </li>
                  </ul>
                </li>
            <?php } ?>
            <?php if (in_array($user_data['user_id'], ['1']) && in_array($user_data['usertype'], ['Admin'])) { ?>     
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fab fa-squarespace"></span> <span class="menu-text">Reports Manage</span></a> 
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="printRecord" class="menu-link">All Print Records</a>
                    </li>
                    <li class="menu-item">
                      <a href="listofpanfind" class="menu-link">PAN Find Reports</a>
                    </li>
                  </ul>
                </li>
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-wallet"></span> <span class="menu-text">Wallet Manage</span></a> 
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="wallettransfer" class="menu-link">Wallet Transfer</a>
                    </li>
                    <li class="menu-item">
                      <a href="walletledger" class="menu-link">Wallet Ledger</a>
                    </li>
                  </ul>
                </li>
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-commenting"></span> <span class="menu-text">Complaint Manage</span></a> 
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="opencomplaint" class="menu-link">Open Complaint</a>
                    </li>
                    <li class="menu-item">
                      <a href="listofcomplaint" class="menu-link">List of Complaint</a>
                    </li>
                  </ul>
                </li>
                
                <li class="menu-header">SYSTEM MANAGEMENT </li>
                
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-cog"></span> <span class="menu-text">Panel Settings</span></a>
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="Services_Manage" class="menu-link">Service Manage <sup style="color:red; font-weight:bold;"> All Users</sup></a>
                    </li>
                    <li class="menu-item">
                      <a href="importantlinks" class="menu-link">Important Links</a>
                    </li>
                    <li class="menu-item">
                      <a href="webdetails" class="menu-link">Web Details</a>
                    </li>
                    <li class="menu-item">
                      <a href="popupalert" class="menu-link">Popup Alert</a>
                    </li> 
                    <li class="menu-item">
                      <a href="noticealert" class="menu-link">Notice Alert</a>
                    </li>
                  </ul>
                </li>
                
                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-code-fork"></span> <span class="menu-text">Apis Settings</span></a>
                  <ul class="menu">
                    <?php if(in_array($user_data['usertype'], ['Admin'])){ ?>
                    <li class="menu-item">
                      <a href="paymentapi" class="menu-link">Portal API</a>
                    </li> 
                    <?php } ?>
                    <li class="menu-item">
                      <a href="messageapi" class="menu-link">Message API</a>
                    </li>
                  </ul>
                </li>
<?php } ?>               

                <li class="menu-item has-child mb-2">
                  <a href="#" class="menu-link"><span class="menu-icon fas fa-user"></span> <span class="menu-text">My Account</span></a>
                  <ul class="menu">
                    <li class="menu-item">
                      <a href="profile" class="menu-link">Profile</a>
                    </li>
                  </ul>
                </li>
                 <li class="menu-item mb-2">
                  <a href="pdf-service" class="menu-link"><span class="menu-icon fas fa-file-pdf" style="color:red;"></span> <span class="menu-text">Documents</span></a>
                </li>
                <li class="menu-item mb-2">
                  <a href="opencomplaint" class="menu-link"><span class="menu-icon fas fa-headset" style="color:red;"></span> <span class="menu-text"> Complaint</span></a>
                </li>
                <li class="menu-item mb-2">
                  <a href="logout" class="menu-link"><span class="menu-icon fas fa-sign-out"></span> <span class="menu-text">Logout</span></a>
                </li>
              </ul>
            </nav>
          </div>
          <footer class="aside-footer border-top p-2">
            <button class="btn btn-light btn-block text-primary" data-toggle="skin"><span class="d-compact-menu-none">Night mode</span> <i class="fas fa-moon ml-1"></i></button>
          </footer>
        </div>
      </aside>

<main class="app-main">
<div class="wrapper">
<div class="page-inner">
<header class="page-title-bar">


</body>
</html>