<?php
$cid = explode('.', $_SERVER['HTTP_HOST'])[0];
?>


<script type="text/javascript" src="../../../assets/js/bootstrap.min.js"></script>

<style>
    .bold{
        font-weight: bold !important;
    }
    .bell-massage,.sing-out{
        font-size: 16px !important;
        background-color: whitesmoke;
        padding: 5px 8px !important;
    }
    
    #clock {
        position: relative !important;
        right: 0px !important;
        
        padding-right: 0px !important;
        color: #333 !important;
    }
    
    .Profile-set{
        left: -50%;
        right: -50%;
        padding: 0px;
    }
    .Profile-set .d-flex{
        margin: 0px;
        padding: 10px;
    }
    
    .userimg {
        width: 50px;
        height: 50px;
        margin-right: 2px;
        pointer-events: none;
        border-radius: 25px;
        border: 1px solid green;
    }
    .post{
        width: 100%;
        padding: 0px 5px;
    }
    
    .sign_out{
        padding: 6px 8px;
        background-color: #f5f5f5;
        border-radius: 5px;
        cursor: pointer;
    }
    .sign_out a{
        color:#333;
    }
    
    .sign_out:hover{
         border: 1px solid #ff6200;
    }
    
    .sign_out:hover>a{
         color: #ff6200 !important;
         cursor: pointer;
    }
    
    .nav-item:hover>.nav-link{
        color: #ff6200 !important;
          border: 1px solid #ff6200;
    } 
    
    .nav-item:hover>.titel_x{
        border:0px !important;
    }
    
    .dropdown:hover>.dropdown-toggle{
        color: #ff6200 !important;
    }
    
    .dropdown:hover .dropdown-menu, .dropdown-toggle:hover .dropdown-menu{
        display: block;
        opacity: 1;
        transform: scale(1);
      
    }
    
    
    
    .dropdown-menu .dropdown-item:hover, .dropdown-menu .dropdown-item:focus, .dropdown-menu a:hover, .dropdown-menu a:focus, .dropdown-menu a:active {
        box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(156, 39, 176, 0.4);
        color: #333;
        background-color: #fafafad1;
    }
    
    .dropdown-menu .a{
        background-color: #f5f5f5 !important;
        box-shadow: none !important;
    }

    


</style>



<nav class="navbar navbar-expand-md navbar-light mb-1" id="menu-sr-1"  aria-label="Extract Sidebar">
    <a href="#" class="navbar-brand" style="overflow: hidden !important;padding: 0;margin-left: 0px;"> 
		<img alt="this is img"  src="../../../logo/<?=$_SESSION['proj_id']?>.png" style="height: 100%;width: 100%;"> 
    </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar6">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="navbar-collapse collapse justify-content-stretch" id="navbar6">
        <ul class="navbar-nav">
                <?php if($title == Dashboard){?>
                            <li class="nav-item active">
                                <a class="nav-link titel_x m-0 pl-0 pr-0 text-capitalize" style="font-size: 14px; font-weight: 500;">
                                    <?=find_a_field('user_group','group_name','id='.$_SESSION['user']['group']); ?>
                                 </a>
                            </li>
                 <? } else { ?>
                             <li class="nav-item active">
                                <a class="nav-link titel_x m-0 pl-0 pr-0 bold"><?=$title?></a>
                            </li>
                 <? } ?> 
        </ul>

            
        <ul class="navbar-nav ml-auto">
			<li class="nav-item dropdown text-center">
                <a class="nav-link dropdown-toggle sing-out text-capitalize" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style=" margin-left: 5px !important; ">
                    <em class="fa-brands fa-windows"></em>               
                </a>
                <div class="dropdown-menu Profile-set" aria-labelledby="navbarDropdown">
						<a class="nav-link" href="#">HRM</a>
						<a class="nav-link" href="#">MIS</a>
                </div>
            </li>
			
			
			<li class="nav-item dropdown">
                <a href="#" class="bell-massage nav-link" data-toggle="tooltip" data-placement="bottom" data-original-title="Notifications" style=" margin-left: 5px !important;">
                    <span class="badge animated zoomIn"></span>
                    <em class="fa-light fa-bell"></em>
                  
                </a>
                 
            </li>
			
						
			<li class="nav-item dropdown">
                <a href="#" class="bell-massage nav-link" data-toggle="tooltip" data-placement="bottom" data-original-title="Notifications" style=" margin-left: 5px !important;">
                    <span class="badge animated zoomIn"></span>
                    <em class="fa-light fa-envelope"></em>
                   
                </a>
                 
            </li>
			
            
        
            <li class="nav-item dropdown text-center">
                <a class="nav-link dropdown-toggle sing-out text-capitalize" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style=" margin-left: 5px !important; ">
                    <em class="fa-light fa-user-gear"></em>
                    <span class="d-none d-sm-inline px-1">
                        <?						 
                            $user_info = find_all_field('user_activity_management','fname','user_id='.$_SESSION['user']['id']);
                             $new_nam = $user_info->fname;
                            echo substr_replace($new_nam, "..", 6);
                        ?>
                    </span>
                
                </a>
                
                <div class="dropdown-menu Profile-set" aria-labelledby="navbarDropdown">
                    <div class="d-flex dropdown-item justify-content-between">
                        <div class="img">
                            	<? 
    						     $find = find_a_field('user_activity_management','user_pic','user_id="'.$_SESSION['user']['id'].'"');
    							 
                            
								 if($find!=""){ ?>
							
								<img alt="this is img" src="../../../assets/support/upload_view.php?name=<?=$find?>&folder=user_pic&folder=user_pic&proj_id=<?=$cid?>&mod=mis_mod" class="userimg" />
								
								<? }else{ ?>
							   <img alt="this is img" src="../../../user_pic/user.png" class="userimg" alt=""/>
								<? } ?>
                        </div>
                        <div class="post">
                                                        
                                    <?
                                    $user_info = find_all_field('user_activity_management','fname','user_id='.$_SESSION['user']['id']);
                                    
                                        $longText = $user_info->fname;
                                        $shortenedText = shortenText($longText, 16);
                                      

                                    ?>  
                                <p class="username m-0 p-0 text-capitalize" title="<?=$user_info->fname;?>" style="font-size: 14px; font-weight: 400; text-align: center;">
                                    <? echo $shortenedText; ?>
                                </p>
            
                                <p class="company_name m-0 p-0"  style="text-align: center;">
                                    <?=$user_info->designation;?>
                                </p>
                        </div>
                        <div class="sign_out">
                            <a href="../../../login/pages/main/logout.php" class="a"><em class="fa-regular fa-power-off"></em> </a>
                        </div>
                    </div>
                </div>
            </li>
            


            <li class="nav-item">
                <div class="nav-link titel_x" id="clock">
                    <span class="date">{{ date }}</span>
                    <span class="time">{{ time }}</span>
                    <span class="text" >IP: <?=$_SERVER['REMOTE_ADDR']?></span>
                </div>
            </li>
            
        </ul>
    </div>
</nav>

    
    
    
 <?php
     function shortenText($text, $maxLength) {
        if (strlen($text) <= $maxLength) {
            return $text;
        } else {
          
            $shortenedText = substr($text, 0, $maxLength - 3) . '...';
            return $shortenedText;
        }
    }
    
 ?>
    
    
    
    
    













  <style>
    
    .sarwar-drop .dropdown-menu {
      background-color: #f9f9f9;
      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    }

    .sarwar-drop .dropdown-submenu {
      position: relative;
    }

    .sarwar-drop .dropdown-submenu:hover .dropdown-menu {
      display: block;
      position: absolute;
      left: 100%;
      top: 0;
    }
    
    .dropdown-menu-two{
        position: absolute;
        display: none !important;
        top: 0px;
        left: 100%;
    }
    
    .dropdown-two:hover .dropdown-menu-two{
        display: block!important;
    }
    .dropdown-two{
        width:100%;
    }
    
    .dropdown-two .nav-link{
        text-align: left;
    }
    
    .dropdown-two .nav-link, .dropdown .nav-link{
        margin-left: 0px !important;
    }
    
    .dropdown-menu .nav-link{
        font-size: 11px !important;
        text-transform: capitalize !important;
    }
    
      
    ::-webkit-scrollbar {
      width: 5px;
    }
    
    
 
    ::-webkit-scrollbar-track {
	  background-color: #f1f1f1; 
      box-shadow: inset 0 0 5px grey; 
      border-radius: 10px;
    }
     

    ::-webkit-scrollbar-thumb {
      background-color: #333; 
      border-radius: 10px;
    }
    
    
    ::-webkit-scrollbar-thumb:hover {
      background: #555; 
    }
    
    .titel_x{
        padding: 10px 5px !important;
    }
    
    .nav-link{
        padding: 8px 10px !important;
        
    }


  </style>



<nav class="navbar navbar-expand-sm navbar-light bg-light m-0 p-0 zoom-menu" data-toggle="affix" id="menu-sr-2"  aria-label="Extract Sidebar">
    <div class="mx-auto d-sm-flex d-block flex-sm-nowrap">
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExample11" aria-expanded="false" aria-labelledby="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse text-center" id="navbarsExample11">
            <ul class="navbar-nav">
                
                <li class="nav-item" style=" margin: 0px 0px 0px 10px; ">
                    <a class="nav-link" href="#" style=" margin: 0px; padding: 4px; border: 1px solid #d0ced5;"><em class="fa-solid fa-house fa-lg"></em></a>

                </li>
                <li class="nav-item dropdown text-center">
                    
                <a class="nav-link titel_x dropdown-toggle text-capitalize" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="d-none d-sm-inline px-1">Configuration</span>      </a>
                
                
                    <div class="dropdown-menu m-0" aria-labelledby="navbarDropdown">
					 <a class="nav-link" href="../../../mis_mod/pages/admin/template.php">Template Configuration</a>
					 <a class="nav-link" href="#">Sub menu 2</a>
                    </div>
                </li>
       
            </ul>
        </div>
    </div>
</nav>



<script>
    $(".dropdown-menu a.dropdown-menu").on('click',function(){ 
    if(!$(this).next() .hasClass('show')){
        $(this).parents(".dropdown-menu").first() .find("show").removeClass("show");
    }
    var $subMenu = $(this).next('.dropdown-menu');
    $subMenu.taggleClass("show");

    $(this).parents("li.nev-item.dropdown.show") .on ('hidden.bs.dropdown',function(e){
        $(".dropdown-submenu . show").removeClass("show");
    });
    return false;
});
 </script>

