<?php 
		$adminName = 'Guest';
		$admin_profile_pic='';
		$role='';
		$adminEmail='';
		
 		$adminRow = $this->admin_model->getAdminRow($this->admin_model->login_id);
		if($adminRow){
			$adminName = $adminRow->accountUsername;
			$admin_profile_pic = $adminRow->accountImage;
			$role = $adminRow->accountType;
			$adminEmail = $adminRow->accountEmail;
		} 
		$admin_profile_pic=base_url() . 'uploads/default_profile.jpg';
		
		$data_background_color_1 ='blue2';
	    $data_background_color_2 ='blue2';
	    $data_background_color_3 ='white';
		if($role == "Administrator" || $role == "System" )
		{
		    $data_background_color_1 ='dark';
		    $data_background_color_2 ='dark';
		    $data_background_color_3 ='dark2';
		}
		
?>
<div class="main-header">
    
    <div class="logo-header" data-background-color="<?php echo $data_background_color_1; ?>">
		<a href="<?php echo base_url();?>" class="logo" style="padding-left:20px;padding-top: 2px;">
			<!--<img src="assets/img/logo.jpg" alt="navbar brand" class="navbar-brand">-->
			<h2 class="text-white fw-bold navbar-brand" style="font-size: larger;text-transform: uppercase;">
			    
			    <?php echo 'Admin Panel'; ?>
			    </h2>
		</a>
		<button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse" data-target="collapse" aria-expanded="false" aria-label="Toggle navigation">
			<span class="navbar-toggler-icon">
				<i class="icon-menu"></i>
			</span>
		</button>
		<button class="topbar-toggler more"><i class="icon-options-vertical"></i></button>
		<div class="nav-toggle">
			<button class="btn btn-toggle toggle-sidebar">
				<i class="icon-menu"></i>
			</button>
		</div>
    </div>

    <nav class="navbar navbar-header navbar-expand-lg" data-background-color="<?php echo $data_background_color_2; ?>">
        <div class="container-fluid">
			<text class="text-white fw-bold" style="font-size: larger;text-transform: uppercase;">  
		     <?php echo site_name();?>
		     </text>
			<!--<div class="collapse" id="search-nav">-->
   <!-- 			<form class="navbar-left navbar-form nav-search mr-md-3">-->
   <!-- 				<div class="input-group">-->
   <!-- 					<div class="input-group-prepend">-->
   <!-- 						<button type="submit" class="btn btn-search pr-1">-->
   <!-- 							<i class="fa fa-search search-icon"></i>-->
   <!-- 						</button>-->
   <!-- 					</div>-->
   <!-- 					<input type="text" placeholder="Search ..." class="form-control">-->
   <!-- 				</div>-->
   <!-- 			</form>-->
   <!-- 		</div>-->
					
			<ul class="navbar-nav topbar-nav ml-md-auto align-items-center">
			    
			    <?php
			    if($role == "Administrator" || $role == "System" )
			    {
			        
			     //   $no_Res_get = $this->admin_code_model->get_Notification_data();
			        $n_count =0;
			        $noti_Arr=array();
				    // if(!empty($no_Res_get))
				    // {
				    //     $n_count = count($no_Res_get);
				    //     $noti_Arr = $no_Res_get;
				    // }
			        ?>
			        <li class="nav-item dropdown hidden-caret">
			            
							<!--<a class="nav-link dropdown-toggle" href="#" id="notifDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">-->
							<!--	<i class="fa fa-bell"></i>-->
							<!--	<span class="notification"><?php echo $n_count; ?></span>-->
							<!--</a>-->
							<ul class="dropdown-menu notif-box animated fadeIn" aria-labelledby="notifDropdown">
								<li>
									<div class="dropdown-title">
									    <?php
    									    if($n_count == 0)
    									        echo 'Notification not available.';
    								        else echo 'You have '.$n_count.' new notification';
									    ?>
								    </div>
								</li>
								<li>
									<div class="notif-scroll scrollbar-outer">
										<div class="notif-center">
										    <?php
										  //  var_dump($noti_Arr);
										    if(!empty($noti_Arr) && 1)
										    {
										        foreach($noti_Arr as $row){
										          //  var_dump($row);
    										        ?>
    										       	<a href="<?php echo $row['red_link']; ?>">
        												<div class="notif-icon notif-primary"> <i class="fas fa-clipboard-check"></i> </div>
        												<div class="notif-content">
        													<span class="block">
        														<?php echo $row['n_name']; ?>
        													</span>
        													<span class="time"><?php echo $row['t_ago']; ?></span> 
        												</div>
        											</a>
    										        <?php
    										        }
										    }
										    ?>
										    
										    <!--<a href="#">-->
											<!--	<div class="notif-icon notif-primary"> <i class="fa fa-user-plus"></i> </div>-->
											<!--	<div class="notif-content">-->
											<!--		<span class="block">-->
											<!--			New user registered-->
											<!--		</span>-->
											<!--		<span class="time">5 minutes ago</span> -->
											<!--	</div>-->
											<!--</a>-->
										</div>
									</div>
								</li>
								<!--<li>-->
								<!--	<a class="see-all" href="javascript:void(0);">See all notifications<i class="fa fa-angle-right"></i> </a>-->
								<!--</li>-->
							</ul>
						</li>
			        <?php
			    }
			    ?>
			    
						
				<li class="nav-item dropdown hidden-caret">
    							<a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#" aria-expanded="false">
    								<div class="avatar-sm">
    									<img src="<?php echo $admin_profile_pic;?>" alt="img" class="avatar-img rounded-circle">
    								</div>
    							</a>
    							
    							<ul class="dropdown-menu dropdown-user animated fadeIn">
    								<div class="dropdown-user-scroll scrollbar-outer">
    									<li>
    										<div class="user-box">
    											<div class="avatar-lg"><img src="<?php echo $admin_profile_pic;?>" alt="image profile" class="avatar-img rounded"></div>
    											<div class="u-text">
    												<h4>
    												    <?php echo $adminName;?>
    												    </h4>
    												        <p class="text-muted">
    												    <?php echo $role;?>
    												    </p>
    												    <p class="text-muted">
    												    <?php echo $adminEmail;?>
    												    </p>
    												<!--<a href="profile.html" class="btn btn-xs btn-secondary btn-sm">View Profile</a>-->
    											</div>
    										</div>
    									</li>
    									<li>
    										<div class="dropdown-divider"></div>
    										<a class="dropdown-item" href="<?php echo base_url('admin/admin_accounts/my_account'); ?>">Update Profile</a>
    										<!--<a class="dropdown-item" href="#">My Balance</a>-->
    										<!--<a class="dropdown-item" href="#">Inbox</a>-->
    										<!--<div class="dropdown-divider"></div>-->
    										<!--<a class="dropdown-item" href="<?php //echo base_url('admin/settings/site_settings'); ?>">Settings</a>-->
    										<div class="dropdown-divider"></div>
    										<a class="dropdown-item" href="<?php echo base_url('admin/logout'); ?>">Logout</a>
    									</li>
    								</div>
    							</ul>
    							
    						</li>
    						
			</ul>
    					
		</div>
    </nav>
		
</div>

		
<div class="sidebar sidebar-style-2" data-background-color="<?php echo $data_background_color_3; ?>">
    <div class="sidebar-wrapper scrollbar scrollbar-inner">
				<div class="sidebar-content">
					<div class="user">
						<div class="avatar-sm float-left mr-2">
							<img src="<?php echo $admin_profile_pic;?>" alt="Img" class="avatar-img rounded-circle">
						</div>
						<div class="info">
							<a data-toggle="collapse" href="#collapseExample" aria-expanded="true">
								<span>
									<?php echo $adminName;?>
									<span class="user-level"><?php echo $role;?></span>
									<span class="caret"></span>
								</span>
							</a>
							<div class="clearfix"></div>

							<div class="collapse in" id="collapseExample">
								<ul class="nav">
									<!--<li>-->
									<!--	<a href="#profile">-->
									<!--		<span class="link-collapse">My Profile</span>-->
									<!--	</a>-->
									<!--</li>-->
									<li>
										<a href="<?php echo base_url('admin/admin_accounts/my_account'); ?>">
											<span class="link-collapse">Edit Profile</span>
										</a>
									</li>
									<!--<li>-->
									<!--	<a href="<?php //echo base_url('admin/settings/site_settings'); ?>">-->
									<!--		<span class="link-collapse">Settings</span>-->
									<!--	</a>-->
									<!--</li>-->
								</ul>
							</div>
						</div>
					</div>
					
					<ul class="nav nav-primary">
						
						<!--<li class="nav-section">-->
						<!--	<span class="sidebar-mini-icon">-->
						<!--		<i class="fa fa-ellipsis-h"></i>-->
						<!--	</span>-->
						<!--	<h4 class="text-section">Components</h4>-->
						<!--</li>-->
						<?php 
				// 		if(1){
						    if(0){
						    ?>
						    <li class="nav-item <?php if($this->uri->segment(2) == 'dashboard') echo 'active'; ?>" >
    						    <a href="<?php echo base_url(); ?>admin/dashboard" class="collapsed" aria-expanded="false">
    						        <i class="fas fa-home"></i>
    								<p>Dashboard</p>
    						    </a>
    					    </li>
						    <?php
						}
						?>
					    
					    <?php
	                    if(isset($GLOBALS['ARR_ACP_MENU'])){
	                        foreach($GLOBALS['ARR_ACP_MENU'] as $menuName => $arrMenuList){
	                            $menushow = true;
                        		if ($this->admin_model->login_type != 'System') { 
                        			$arrMyAccessModules = explode('|', $this->admin_model->login_access);
                        			//echo $menuName;
                        			if (!in_array($menuName, $arrMyAccessModules)) {
                        					$menushow = false;
                        			}
                        		}
                        		
                        		$menuActive = ' ';  
                        		$menuOpen='';
                        		if($this->uri->segment(2) == $menuName) {
                        			$menuActive = ' active';
                        			$menuOpen = 'show';
                        		} 
                        		 
                    		  //  if($menuName == 'masterdata'){
                        // 			if($this->uri->segment(2) == 'pages'  )
                        // 			$menuActive = ' active';
                        // 			$menuOpen = 'show';
                        // 		}
                        		 
                        		if($menushow){
                        			if($menuName == 'admin_accounts'){
                        				$mainMenuText = $GLOBALS['ARR_ADMIN_MODULES'][$menuName];
                    			    }
                        			?>
                        			
                        			<li class="nav-item <?php  echo $menuActive;?>"> 
                            			<a href="#<?php echo $menuName;?>" data-toggle="collapse" >
                            			    <i class="fas fa-th-list"></i>
                            			    <p>
                                                <?php 
                                				    if($menuName == 'admin_accounts'){
                                					  echo $mainMenuText ;
                                				    }else{
                                					   echo $GLOBALS['ARR_ADMIN_MODULES'][$menuName];
                                				    } 
                            				    ?>
                        				    </p>
                                            <span class="caret"></span>
                                        </a>
                                            
                                            <div class="collapse <?php echo $menuOpen; ?>" id="<?php echo $menuName;?>" >
                                                <ul class="nav nav-collapse">
                                                <?php
                                					foreach($arrMenuList as $mItemName => $mItemUrl){
                                						$activeLi = '';
                                						$subMainMenuText = $mItemName;;
                                						if($this->uri->uri_string == 'admin/'.$mItemUrl ){ $activeLi = 'active';}
                                						else if($this->uri->segment(3) == 'sub_admin_manager' && $mItemUrl == 'admin_accounts/sub_admins'){$activeLi = 'active';  
                                 						}
                                 						
                                						if(($this->uri->segment(3) == 'sub_admins'  || $this->uri->segment(3) == 'my_account' || $this->uri->segment(3) == 'sub_admin_manager' 
                                						|| $this->uri->segment(2) == 'dashboard' ) && $menuName == 'admin_accounts' && $mItemUrl != 'admin_accounts/my_account'){
                                						    
                                 						}
                                        						 
                                						?>
                                        						
                                						<li class="<?php echo $activeLi; ?>">
                    										<a href="<?php echo base_url().'admin/'.$mItemUrl; ?>">
                    											<span class="sub-item"><?php echo $subMainMenuText; ?></span>
                    										</a>
                    									</li>
                                                        <?php
                                					}
                            				    ?>
                                                </ul>
                                            </div>
                                            
                                            
                                        </li>
                        			
                        			<?php
    	                        }
    	                        
	                        }
	                    }
	                    ?>
	                    
						<li class="nav-item ">
							<a href="<?php echo base_url('admin/logout'); ?>" class="collapsed" aria-expanded="false">
								<i class="fas fa-sign-out-alt"></i>
								<p>Logout</p>
							</a>
						
						</li>
					</ul>
				</div>
			</div>
</div>