<?php
$CI = &get_instance();
$CI->load->model('Admin_model');
$query = "SELECT n.* from notifications n inner join teacher t on n.teacher_id = t.id  where (t.id = '" . $_SESSION['teacher_id'] . "' AND n.notification_read = 'No')  ORDER BY notification_id DESC LIMIT 5";
$result = $CI->Admin_model->get_notification_details('', $query);
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="robots" content="noindex, nofollow">
  <title><?= $school_info['school_name']; ?></title>
  <link rel="icon" type="image/x-icon" href="<?php echo base_url(); ?>common_assets/fav.png">
  <!--styles links-->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/bootstrap.min.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/jquery-ui.min.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/font-family.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/all.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/owl-carousel/css/owl.carousel.min.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/style.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_teacher/css/style-responsive.css">
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/nepali.datepicker.v3.7.min.css">
  <script src="<?php echo base_url(); ?>assets_teacher/js/jquery-3.4.1.min.js"></script>
  <script src="<?php echo base_url(); ?>assets_admin/js/jquery.validate.js"></script>
  <script src="<?php echo base_url(); ?>assets_teacher/js/jquery-ui.min.js"></script>
  <script src="<?php echo base_url(); ?>assets_admin/js/nepali.datepicker.v3.7.min.js" type="text/javascript"></script>
    <script src="<?php echo base_url(); ?>assets_admin/js/jquery.dataTables.min.js"></script>
  <script defer src="<?php echo base_url(); ?>assets_admin/js/dataTables.fixedHeader.min.js"></script>
  <?php

  if (empty($result)) { ?>
    <style>
      .notification-icon-wrap:after {
        content: none;
      }
    </style>
  <?php }

  ?>
</head>

<body>
  <header class="common_margin ">
    <div class="search-bar-wrapp">
      <!-- <input type="text" name="" placeholder="Search.."> -->
    </div>
    <div class="user-login-section">
      <div class="notification-icon-wrap">
        <img src="<?php echo base_url(); ?>assets_teacher/images/notification.png">
        <span></span>
        <div class="notifications-wrap">
          <div class="notifications">
            <h4>Notifications</h4>
            <ul>
              <?php if (!empty($result)) { ?>
                <?php foreach ($result as $key => $value) { ?>
                  <li class="notification-row">
                    <a class="text-white" href="<?php echo base_url() ?>teacher/teacher_notification">
                      <p><?php echo $value['description'] ?></p>
                    </a>
                    <i class="fas fa-trash-alt" onclick="delete_notificaton('<?php echo $value['notification_id'] ?>',$(this).parent())"></i>
                  </li>
                <?php } ?>
              <?php } else {
                echo "<li><p>There no new notifications</p></li>";
              } ?>
            </ul>
          </div>
        </div>
      </div>

      <div class="user-wrap">
        <div class="user-login-head">

          <h5><span class="user-name"><?php echo $_SESSION['teacher_name']; ?></span><i class="fa fa-caret-down" aria-hidden="true"></i><i class="fa fa-caret-up" aria-hidden="true"></i></h5>
        </div>
        <div class="login-wrap-open">
          <ul>
            <!-- <li><span><i class="fa fa-user" aria-hidden="true"></i></span>My Profile</li> -->
            <li><a href="<?php echo base_url(); ?>teacher/teacher-change-password"><span><i class="fa fa-lock" aria-hidden="true"></i></span>Change Password</a></li>
            <li><a href="<?php echo base_url(); ?>Teacher/teacher_logout"><span><i class="fas fa-sign-out-alt"></i></span>Sign Out</a></li>
          </ul>
        </div>
      </div>
    </div>
    <div class="mobileMenu">
      <i class="fas fa-bars"></i>
    </div>
  </header>