<?php
$profilepix = "upload/". $rowUser['cust_photo'];
$defultpix = "webimg/default-img.jpg";

if($rowUser['cust_photo'] == "Nill" || $rowUser['cust_photo'] == ""){
$profile_src = $defultpix;  
}else{
 $profile_src = $profilepix;    
}
?>
<!--**********************************
            Nav header start
        ***********************************-->
        <div class="nav-header" style="background: #fff; ">
            <div class="brand-logo">
                <a href="dashboard">
                    <b class="logo-abbr"><img src="dist/logo-1.png" alt="" style="width: 50px; margin-right: 10px; "> </b>
                    <span class="logo-compact"><img src="dist/logo-1.png" alt=""></span>
                    <span class="brand-title">
                        <img src="dist/logo-1.png" alt="" id="main-logo">
                    </span>
                </a>
            </div>
        </div>
        <!--**********************************
            Nav header end
        ***********************************-->

        <!--**********************************
            Header start
        ***********************************-->
 


        <div class="header">    
            <div class="header-content clearfix">
                
                <div class="nav-control">
                    <div class="hamburger">
                        <span class="toggle-icon"><i class="icon-menu"></i></span>
                    </div>
                </div>
                <div class="header-left">
                    <div class="input-group icons">
                        <div class="input-group-prepend">
                            <span class="input-group-text bg-transparent border-0 pr-2 pr-sm-3" id="basic-addon1"><i class="mdi mdi-magnify"></i></span>
                        </div>
                        <input type="search" class="form-control" placeholder="Search Recent transactions" aria-label="Search Recent transactions">
                        <div class="drop-down animated flipInX d-md-none">
                            <form action="#">
                                <input type="text" class="form-control" placeholder="Search transactions.. ">
                            </form>
                        </div>
                    </div>
                </div>
                <div class="header-right">
                    <?php 
                    $selNotificntn = $conn->query("select * from user_notificatn where user_id = '" . $rowUser['user_id'] . "'  order by notifcatn_id DESC") or die($conn->error);
                    $numNotifcnt = $selNotificntn->num_rows;
                    $notifymsg = !$numNotifcnt ? "No notification" : "New Notifications";  
                    
                    // Get Pending Notification 
                    $pendingNotifcatn = $conn->query("select * from user_notificatn where user_id = '" . $rowUser['user_id'] . "' && stat = 'Pending' order by notifcatn_id DESC") or die($conn->error);

                    $numPendingnotfcn = $pendingNotifcatn->num_rows;  
                    ?>

                    <ul class="clearfix">
                        <li class="icons dropdown">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <i class="mdi mdi-bell-outline"></i>
                              <?php
                              if($numPendingnotfcn){
                                ?>
                                <span class="badge badge-pill gradient-2"><?php echo $numPendingnotfcn; ?></span>
                                <?php
                              }    
                                ?>
                            
                            </a>
                            <div class="drop-down animated fadeIn dropdown-menu dropdown-notfication">
                                <div class="dropdown-content-heading d-flex justify-content-between">
                                    <span class=""><?php echo $notifymsg; ?></span>  
                                    <a href="javascript:void()" class="d-inline-block">
                                        <span class="badge badge-pill gradient-2"><?php echo !$numPendingnotfcn ? "" : $numPendingnotfcn; ?></span>
                                    </a>
                                </div>
                                <div class="dropdown-content-body">
                                    <ul id="notifcn-list">
                                        <?php 
                                        if($numNotifcnt){
                                        while ($rowNotficnt = $selNotificntn->fetch_array()) {
                                        if($rowNotficnt['stat'] =="Pending"){
                                          $notifyclass = "pend-sb-div";  
                                        }else{
                                            $notifyclass = "read-sb-div";
                                        }
                                        ?>
                                        <li class="<?php echo $notifyclass; ?>">
                                            <a href="my-notification?id=<?php echo $rowNotficnt['notifcatn_id']; ?>">
                                                <span class="mr-3 avatar-icon bg-success-lighten-2"><i class="icon-present"></i></span>
                                                <div class="notification-content">
                                                    <h6 class="notification-heading"><?php echo $rowNotficnt['title']; ?></h6>
                                                    <span class="notification-text"><?php echo substr($rowNotficnt['descr'], 0, 60) . "..."; ?></span> 
                                                </div>
                                            </a>
                                        </li>
                                        <?php 
                                    }
                                    }
                                    ?>
                                    </ul>
                                    
                                </div>
                            </div>
                        </li>
                        <li class="icons dropdown d-none d-md-flex">
                            <?php include 'transl.php'; ?>
                        </li>
                        <li class="icons dropdown">
                            <div class="user-img c-pointer position-relative"   data-toggle="dropdown">
                                <span class="activity active"></span>
                                <img src="<?php echo $profile_src; ?>" height="40" width="40" alt="">
                            </div>
                            <div class="drop-down dropdown-profile animated fadeIn dropdown-menu">
                                <div class="dropdown-content-body">
                                    <ul>
                                        <li>
                                            <a href="profile"><i class="icon-user"></i> <span> Profile </span></a>
                                        </li>
                                        
                                        <hr class="my-2">
                                        <li>
                                            <a href="login.php?action=Logout user"><i class="icon-lock"></i> <span>Lock Screen</span></a>
                                        </li>
                                        <li><a href="login.php?action=Logout user"><i class="icon-key"></i> <span>Logout</span></a></li>
                                    </ul>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>