<!doctype html>
<html class="no-js" lang="en">

<head>
    <?php 
	include("../lincludes/session.php");
	include("../lincludes/lhead.php");
	include("../lincludes/ldb.php");
	$active = "borrowing";
	?>
</head>
<body>
    <!-- Start Left menu area -->
    <?php include("../lincludes/sidebar.php");?>
    <!-- End Left menu area -->
    <!-- Start Welcome area -->
    <div class="all-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="logo-pro">
                        <a href="index.html"><img class="main-logo" src="img/logo/logo.png" alt="" /></a>
                    </div>
                </div>
            </div>
        </div>
        <div class="header-advance-area">
            <div class="header-top-area">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                            <div class="header-top-wraper">
                                <?php include("../lincludes/topnav.php");?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="courses-area mg-b-15"> 
			<div class="product-payment-inner-st">
						</br></br><h2 style="text-align:center;color:blue;">View new notifications</h2>
                            <div id="myTabContent" class="tab-content custom-product-edit">
                                <div class="product-tab-list tab-pane fade active in" id="description">
                                   
									<div class="row">
                                        <div class="col-lg-4 col-md-4"></div>
										<div class="col-lg-4 col-md-4">
										<div align="right">
										<?php
										if(isset($_SESSION['typ'])){
											$ty = 2;
										}
										else{
											$ty=1;
                                        }
                                        $sql3 = mysqli_query($con,"update lnotifications set Viewed='1' where Reciever='$uid' && Type='$ty'");
										$sql = mysqli_query($con,"select * from lnotifications where Reciever='$uid' && Type='$ty' && Viewed='0'");
										$num = mysqli_num_rows($sql);
										$sql2 = mysqli_query($con,"select * from lnotifications where Reciever='$uid' && Type='$ty' order by NotificationID Desc");
                                        $num2 = mysqli_num_rows($sql2);
                                        
										?>
										<a href="newnoti"><button class="btn btn-warning">New(<?php echo$num;?>)</button></a>
										<a href="allnoti"><button class="btn btn-primary">All</button></a>
										</div>
										<?php
										if($num2>0){
										while($roww=mysqli_fetch_array($sql2)){
										?>
										</br><div align="right">
										<i><?php echo$roww['Date'];?></i>
										</div>
										<b><?php echo$roww['Sender'];?></b></br>
										<?php echo$roww['FullMsg'];?></br>
										<div align="right">
										<a href="deletenoti?nid=<?php echo$roww['NotificationID'];?>"><button class="btn btn-danger">delete</button></a>
										</div>
										<?php }}
										else{
											echo"<h4 style='color:red;'>No notifications for you</h4>";
										}
										?>
										</div>
										<div class="col-lg-4 col-md-4"></div>
                                    </div>
                                </div>
                                
                            </div>
                        </div>
        </div>
        <div class="footer-copyright-area">
            <div class="container-fluid">
                <?php include("../lincludes/lfooter.php");?>
            </div>
        </div>
    </div>

    <?php include("../lincludes/lfooterjs.php");?>
</body>
</html>