<!-- BEGIN Page Header -->
<header class="page-header" role="banner">
    <!-- we need this logo when user switches to nav-function-top -->
    <div class="page-logo">
        <a href="#" class="page-logo-link press-scale-down d-flex align-items-center position-relative" data-toggle="modal" data-target="#modal-shortcut">
            <img src="../img/logo/bm2.png" alt="Beam" style="width: 100px;" aria-roledescription="logo">
            <span class="page-logo-text mr-1"></span>
            <span class="position-absolute text-white opacity-50 small pos-top pos-right mr-2 mt-n2"></span>
        </a>
    </div>
    <!-- DOC: nav menu layout change shortcut -->
    <div class="hidden-md-down dropdown-icon-menu position-relative">
        <a href="#" class="header-btn btn js-waves-off" data-action="toggle" data-class="nav-function-hidden" title="Hide Navigation">
            <i class="fa fa-bars"></i>
        </a>
    </div>
    <!-- DOC: mobile button appears during mobile width -->

        <div class="hidden-lg-up">
            <a href="#" class="header-btn btn press-scale-down" data-action="toggle" data-class="mobile-nav-on">
                <i class="fa fa-bars"></i>
            </a>
        </div>
        <div class="ml-auto d-flex">
            <?php if($tle_id ==3 || $tle_id ==6 || $tle_id ==38 || $tle_id ==39){?>
            <!-- app notification -->
            <?php 
            $sttmt = $db->prepare("SELECT * FROM tbl_info_register r
            INNER JOIN tbl_con_infos c ON c.reg_info_id = r.regst_id WHERE c.info_sts=9
            ORDER BY con_info_id DESC");
            $sttmt->execute();
            ?>
            <div>
                <a href="#" class="header-icon" data-toggle="dropdown" title="You got 11 notifications">
                    <i class="fal fa-bell"></i>
                    <span class="badge badge-icon"><?php echo $sttmt->rowCount();?></span>
                </a>

                <div class="dropdown-menu dropdown-menu-animated dropdown-xl">
                    <div class="dropdown-header bg-trans-gradient d-flex justify-content-center align-items-center rounded-top mb-2">
                        <h4 class="m-0 text-center color-white">
                            <?php echo $sttmt->rowCount();?> Message
                            <small class="mb-0 opacity-80">Notifications</small>
                        </h4>
                    </div>

                    <ul class="nav nav-tabs nav-tabs-clean" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active px-4 fs-md js-waves-on fw-500" data-toggle="tab" href="#tab-messages" data-i18n="drpdwn.messages">Messages</a>
                        </li>
                    </ul>

                    <div class="tab-content tab-notification">
                        <div class="tab-pane active" id="tab-messages" role="tabpanel">
                            <div class="custom-scroll h-100">
                                <ul class="notification">

                                <?php 
                                    $sql = "SELECT * FROM tbl_role";					
                                    $stmt = $conn->query($sql);
                                    while($rr = $stmt->fetch()){
                                    $rolId = $rr['role_id'];
                                    
                                    $sth = $db->prepare("SELECT * FROM tbl_info_register r
                                    INNER JOIN tbl_con_infos c ON c.reg_info_id = r.regst_id
                                    WHERE c.dRcv = '".$rolId."' AND c.info_sts=9
                                    ORDER BY con_info_id DESC");
                                    $sth->execute();
                                ?>
                                    <li>
                                        <a href="bm?b=tckbox&&rleId=<?php echo $rolId;?>&rleNam=<?php echo $rr['role_name'];?>" class="d-flex align-items-center">
                                            <span class="status status-success mr-2">
                                                <span class="profile-image rounded-circle d-inline-block" style="background-image:url('../img/demo/avatars/avatar-e.png')"></span>
                                            </span>

                                            <span class="d-flex flex-column flex-1 ml-1">
                                                <span class="name"><?php echo $rr['role_name'];?><span class="badge badge-primary fw-n position-absolute pos-top pos-right mt-1"><?php echo $sth->rowCount();?></span></span>
                                                <span class="msg-a fs-sm">Inbox</span>
                                                <span class="fs-nano text-muted mt-1">Received message</span>
                                            </span>
                                        </a>
                                    </li>   
                                <?php }?>

                                </ul>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
            <!-- app notification menu -->
            <?php }?>
            <!-- app user menu -->
            <div>
            <a href="#" data-toggle="dropdown" title="" class="header-icon d-flex align-items-center justify-content-center ml-2">
                <img src="../img/demo/avatars/beamavatar5.png" class="profile-image rounded-circle" alt="<?php echo $title_name;?>">
            </a>

            <div class="dropdown-menu dropdown-menu-animated dropdown-lg">
                <div class="dropdown-header bg-trans-gradient d-flex flex-row py-4 rounded-top">
                    <div class="d-flex flex-row align-items-center mt-1 mb-1 color-white">
                        <span class="mr-2">
                            <img src="../img/demo/avatars/beamavatar5.png" class="rounded-circle profile-image" alt="<?php echo $title_name;?>">
                        </span>
                        <div class="info-card-text">
                            <div class="fs-lg text-truncate text-truncate-lg"><?php echo $RkName." ".substr($first_name, 0, 1)." ".$family_name;?></div>
                            <span class="text-truncate text-truncate-md opacity-80"><?php echo $title_name;?></span>
                        </div>
                    </div>
                </div>
                <div class="dropdown-divider m-0"></div>
                <a href="#" class="dropdown-item" data-toggle="modal" data-target=".js-modal-settings">
                    <span data-i18n="drpdwn.settings">Change Password</span>
                </a>

                <div class="dropdown-divider m-0"></div>
                <a class="dropdown-item fw-500 pt-3 pb-3" href="../logout">
                    <span data-i18n="drpdwn.page-logout">Logout</span>
                    <span class="float-right fw-n">&commat;<?php echo $role_name;?></span>
                </a>
            </div>

            </div>
        </div>
    </header>
    <!-- END Page Header -->