<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);

include "session.php"; 

 ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="Billing App - Admin Panel">
        <meta name="author" content="WIT Billing App">

        <!-- App Favicon 
        <link rel="shortcut icon" href="images/favicon.png"> -->

        <!-- App title -->
        <title>Billing Application | Admin Panel</title>

        <!--Morris Chart CSS -->
		<link rel="stylesheet" href="assets/plugins/morris/morris.css">

        <!-- Switchery css -->
        <link href="assets/plugins/switchery/switchery.min.css" rel="stylesheet" />
		
		
		<!-- DataTables -->
        <link href="assets/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
        <link href="assets/plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
        <!-- Responsive datatable examples -->
        <link href="assets/plugins/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
		
		<!-- Sweet Alert css -->
        <link href="assets/plugins/bootstrap-sweetalert/sweet-alert.css" rel="stylesheet" type="text/css" />
		
		<!-- Custom box css -->
        <link href="assets/plugins/custombox/css/custombox.min.css" rel="stylesheet">
		
		<!-- Selectbox search Plugins css-->
        <link href="assets/plugins/multiselect/css/multi-select.css"  rel="stylesheet" type="text/css" />
        <link href="assets/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
		
		
		<!-- Date and Date time pickers Plugins css -->
        <link href="assets/plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet">		
		<link href="assets/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">		
		<link href="assets/plugins/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
		
		<!-- Autocomplete -->
		<!--<link rel="stylesheet" href="assets/autocomplete/css/easy-autocomplete.css" type="text/css" rel="stylesheet" />
		<link rel="stylesheet" href="assets/autocomplete/css/easy-autocomplete.min.css" type="text/css" rel="stylesheet" />
		<link rel="stylesheet" href="assets/autocomplete/css/easy-autocomplete.themes.css" type="text/css" rel="stylesheet" />	-->
		
		
        <!-- App CSS -->
        <link href="assets/css/style.css" rel="stylesheet" type="text/css" />
		
		<!-- Developer  -->
		<link type="text/css" href="assets/css/developer.css" rel="stylesheet" /> 

        <!-- HTML5 Shiv and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
        <!-- Modernizr js -->
        <script src="assets/js/modernizr.min.js"></script>
		
		
<script type="text/javascript">		
function loading() {			
	document.getElementById("load").style.display = 'block';
}

function unloading() {
	document.getElementById("load").style.display = 'none';
}
</script>
		

</head>


<body>
	

<!-- loading div - START -->	
	<div id="load" style=" background:url(images/overly.png) repeat; width:100%; display:none; height:100%; position:fixed;top:0; left:0;z-index:10000; padding-top:1%; ">
    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" valign="middle"><table width="425" align="center"  style="border:0px solid #f0f0f0;"   border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="right" valign="middle">
         <div align="center" class="loading" style="border:0px solid #fff;">

         <img style="margin-top:150px; border-radius:6px; padding:3px; background:#fff;" src="images/loading_big.gif" alt="loading"  /> <br />  
				<br/>
				<div id="convprogress">			
									
				</div>			
				
		 
         </div>
      </td>
      </tr>
    </table></td>
      </tr>
    </table>
	
    </div>
<!-- loading div - END -->	

<?php 
$cls='active';
if($_SESSION["userPhoto"] != '')
	$usr_photo = $_SESSION["userPhoto"];
else 	
	$usr_photo = "NoImageAvailable.png";
?>	
	
	
	
	
	 <!-- Navigation Bar-->
        <header id="topnav">
            <div class="topbar-main">
                <div class="container">

                    <!-- LOGO -->
                    <div class="topbar-left">
                        <a href="dashboard.php" class="logo">                           
                            <!--<span>Uplon</span>-->
							<img src="images/logo.png" alt="logo" class="img-responsive"style="width:190px;" />
						</a>
                    </div>
                    <!-- End Logo container-->


                    <div class="menu-extras">

                        <ul class="nav navbar-nav pull-right">

                            <li class="nav-item">
                                <!-- Mobile menu toggle-->
                                <a class="navbar-toggle">
                                    <div class="lines">
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                </a>
                                <!-- End mobile menu toggle-->
                            </li>
                            
                            <li class="nav-item dropdown notification-list">
                                <a class="nav-link dropdown-toggle arrow-none waves-effect waves-light nav-user" data-toggle="dropdown" href="#" role="button"
                                   aria-haspopup="false" aria-expanded="false">                                    
									<img src="uploads/adminusers/<?php echo $usr_photo; ?>" alt="user-img" class="img-circle user-img">
                                </a>
                                <div class="dropdown-menu dropdown-menu-right dropdown-arrow profile-dropdown " aria-labelledby="Preview">
                                    <!-- item-->
                                    <div class="dropdown-item noti-title">
                                        <h5 class="text-overflow"><small>Welcome ! <?php echo $_SESSION["UName"]; ?></small> </h5>
                                    </div>

                                    <!-- item-->
                                    <a href="javascript:void(0);" class="dropdown-item notify-item">
                                        <i class="zmdi zmdi-account-circle"></i> <span>Profile</span>
                                    </a>
                                    
                                    <!-- item-->
                                    <a href="logout.php" class="dropdown-item notify-item">
                                        <i class="zmdi zmdi-power"></i> <span>Logout</span>
                                    </a>

                                </div>
                            </li>

                        </ul>

                    </div> <!-- end menu-extras -->
                    <div class="clearfix"></div>

                </div> <!-- end container -->
            </div>
            <!-- end topbar-main -->
			
<?php 
include_once "navmenu-functions.php"; 
$reslt_mnu = getTopMenuArray($db, $_SESSION['RoleId'],$admin_id); 	
?>

            <div class="navbar-custom">
                <div class="container">
                    <div id="navigation">
                        <!-- Navigation Menu-->
                        <ul class="navigation-menu">
                            <li class="<?php if($menudisp=="dashboard"){ echo $cls; }?>">
                                <a href="dashboard.php"><i class="zmdi zmdi-view-dashboard"></i> <span> Dashboard </span> </a>
                            </li>
							
                           <!-- <li class="has-submenu">
                                <a href="#"><i class="zmdi zmdi-album"></i> <span> Icons </span> </a>
                                <ul class="submenu">
                                    <li><a href="icons-materialdesign.html">Material Design</a></li>
                                    <li><a href="icons-ionicons.html">Ion Icons</a></li>
                                </ul>
                            </li>--> 
							
							<?php 
							for($ii=0;$ii<count($reslt_mnu);$ii++) {								
							?>
							<li class="has-submenu">
								<a href="#"><i class="zmdi zmdi-collection-item"></i> <span> <?php echo $reslt_mnu[$ii]['MenuName']; ?> </span> </a>
								<ul class="submenu">
									<?php 
									$mnuid = $reslt_mnu[$ii]['MenuId']; 
									$reslt_modm = getTopMenuModuleArray($db, $_SESSION['RoleId'],$admin_id,$mnuid);				
									for($nn=0;$nn<count($reslt_modm);$nn++)
									{
										$mdlnam = $reslt_modm[$nn]['ModuleName'];
										$mdlpath = $reslt_modm[$nn]['ModulePath'];	
										$mdldispname = $reslt_modm[$nn]['Description'];
									?>
									<li class=""><a href="<?php echo $mdlpath; ?>"><?php echo $mdldispname; ?></a></li>    	
									<?php	
									}	
									?>
								</ul>
							</li>
							<?php } ?>
							
							
                        </ul>
                        <!-- End navigation menu  -->
                    </div>
                </div>
            </div>
        </header>
        <!-- End Navigation Bar-->
                