<?php 
include("includes/top-header.php"); 
include("includes/header.php"); 

$u__not="update notifications set status='1' where user_id='".$uid."'";			
$uNot=mysqli_query($conn,$u__not);
?>
        <!-- Left Panel End -->
        
        <!-- Middle Panel
        ============================================= -->
        <div class="col-lg-9"> 
          
          <!-- Notifications
          ============================================= -->
          <div class="bg-white shadow-sm rounded py-4 mb-4">
            <h3 class="text-5 fw-400 px-4 mb-4">Notifications</h3>
            <hr class="mb-0">
            
            <!-- Notifications List
            =============================== -->
            <div class="notifications-list">
              
              <?php
                  $sn = "select * from notifications where user_id='".$uid."' order by date desc";
                  $runq = $conn->query($sn);
                  $count = mysqli_num_rows($runq); 
                  
                  if($count > 0){
                      while($row = $runq->fetch_assoc())
                      {
                          $message=$row['notification'];
                          $n_date=$row['date'];
                          
                          $n_date_ = date("jS M, Y h:ia", strtotime($n_date));
                          
                          echo "
                            <div class='notifications-item px-4 py-3' data-bs-toggle='modal' data-bs-target='#notifications-detail'>
                              <div class='row align-items-center flex-row'>
                                <div class='col-2 col-sm-1 text-center text-8 icon-bell'><i class='far fa-bell'></i></div>
                                <div class='col col-sm-10'>
                                  <h4 class='text-3 mb-1'>".$message."</h4>
                                  <span class='text-muted'>".$n_date_."</span> </div>
                              </div>
                            </div>
                          ";
                      }
                  }else{
                      echo "
                        <div class='notifications-item px-4 py-3' data-bs-toggle='modal' data-bs-target='#notifications-detail'>
                          <div class='row align-items-center flex-row'>
                            <div class='col-2 col-sm-1 text-center text-8 icon-bell'><i class='far fa-bell'></i></div>
                            <div class='col col-sm-10'>
                              <h4 class='text-3 mb-1'>No new notifications!</h4>
                            </div>
                          </div>
                        </div>
                      ";
                  }
              ?>
            </div>
            <!-- Notifications List End --> 
            
            <!-- Notifications Item Details Modal

            <div id="notifications-detail" class="modal fade" role="dialog" aria-hidden="true">
              <div class="modal-dialog modal-lg modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
                <div class="modal-content">
                  <div class="modal-header">
                    <h5 class="modal-title d-flex align-items-center fw-400"><span class="text-6 me-2"><i class="far fa-bell"></i></span> Notifications Details</h5>
					<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                  </div>
                  <div class="modal-body p-4 text-3">
                    <div class="row">
                      <div class="col-sm-12">
                        <h4 class="text-5">Updates to our privacy policy. Please read.</h4>
                        <p class="text-muted">16 Oct 2020</p>
                        <p class="fw-500">Dear Smith Rhodes,</p>
                        <p>We have updated our <a href="#"><u>privacy policy</u></a> to make it easier for you to understand how we collect, use, disclose, store, and transfer your information. It also reflects recent developments in applicable privacy laws. The changes are effective as of <strong class="fw-500">Jan 01, 2021</strong> so please take the time to familiarize yourself with our privacy practices.</p>
                        <p>The changes will take effect automatically and by continuing to use our services you agree to the updated <a href="#"><u>privacy policy</u></a>.</p>
                        <p>Thank You,<br>
                          Guardian Trust - United Team</p>
                      </div>
                    </div>
                  </div>
                  <div class="modal-footer">
                    <div class="btn-group m-0 w-100 row">
                      <button type="button" class="btn btn-secondary shadow-none col-6"><span class="me-1"><i class="far fa-eye-slash"></i></span>Mark as Unread</button>
                      <button type="button" class="btn btn-danger shadow-none col-6"><span class="me-1"><i class="far fa-trash-alt"></i></span>Delete</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            Notifications Item Details Modal End --> 
            
          </div>
          <!-- Notifications End --> 
          
        </div>
        <!-- Middle Panel End --> 
      </div>
    </div>
  </div>
  <!-- Content end --> 
  
  <!-- Footer
  ============================================= -->
  <?php include("includes/footer.php"); ?>
  <!-- Footer end --> 
  
</div>
<!-- Document Wrapper end --> 

<!-- Back to Top
============================================= --> 
<a id="back-to-top" data-bs-toggle="tooltip" title="Back to Top" href="javascript:void(0)"><i class="fa fa-chevron-up"></i></a> 

<!-- Styles Switcher -->

<!-- Styles Switcher End --> 

<!-- Script --> 
<script src="vendor/jquery/jquery.min.js"></script> 
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> 
<!-- Style Switcher --> 
<script src="js/switcher.min.js"></script> 
<script src="js/theme.js"></script>
</body>
</html>