<nav
    class="sidebar vertical-scroll ps-container ps-theme-default ps-active-y"
  >
    <div class="logo d-flex justify-content-space-around">
      <a href="/staff-dashboard"
        ><img src="/img/kp.png" alt="" style="height: 50px; width: 50px"
      /></a>
      <h6 class="fw-bold header_text mt-3 mx-3">CORASS</h6>

      <div class="sidebar_close_icon d-lg-none">
        <i class="ti-close"></i>
      </div>
    </div>
    <ul id="sidebar_menu">

      <li class="">
        <a href="/staff-dashboard" aria-expanded="false">
          <div class="icon_menu">
            <img src="/img/menu-icon/dashboard.svg" alt="" />
          </div>
          <span>Dashboard</span>
        </a>
      </li>

      <li class="">
        <a class="has-arrow" href="#" aria-expanded="false">
          <div class="icon_menu">
            <img src="/img/menu-icon/4.svg" alt="" />
          </div>
          <span>My Assigned Student</span>
        </a>
        <ul>
          <%for (const session of sessions){%>
          <li class="">
            <a  href="/assigned-student/<%= session.id%>"  aria-expanded="false">
              <span><%= session.name %> </span>
            </a>
          </li>
          <%}%>
        </ul>
      </li>
      <li class="">
        <a href="/topic" aria-expanded="false">
          <div class="icon_menu">
            <img src="/img/menu-icon/2.svg" alt="" />
          </div>
          <span>Topic Management</span>
        </a>
      </li>
      <li class="">
        <a class="" href="/student-project" aria-expanded="false">
          <div class="icon_menu">
            <img src="/img/menu-icon/3.svg" alt="" />
          </div>
          <span>Project Management</span>
        </a>
      
      </li>
      
      <li class="">
        <a class="has-arrow" href="#" aria-expanded="false">
            <div class="icon_menu">
                <img src="/img/menu-icon/3.svg" alt="">
            </div>
            <span style="color: rgb(1, 16, 1);">Miscellanenous</span>
        </a>
        <ul>
          <% if(user.second_role == 11){ %>
          <li class="">
            <a href="/student-management" aria-expanded="false">
              <span>Student Management </span>
            </a>
          </li>
          <%}%>
          <% if(user.second_role == 4){ %>
            <li class="">
              <a href="/all-project" aria-expanded="false">
                <span> QA Project Management </span>
              </a>
            </li>
            <%}%>
          <li class="">
            <a data-toggle="modal" data-target="#exampleModal2" aria-expanded="false">
              <span>Research Library </span>

            </a>
          </li>
        </ul>
    </li>
    </ul>
    </nav>
        <!-- Modal -->
        <div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2" aria-hidden="true">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Library Approval Code</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body">
                <input type="text" class="form-control" name="comment1" id="comment1"  >
              </div>
              <center>
                <strong>Call Library at: <a href="tel:+2348147661547">+2348147661547</a>, <a href="tel:+2349159424041">+2349159424041</a></strong> 
              </center>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" id="saveComment1" class="btn btn-success">Validate</button>
              </div>
            </div>
          </div>
        </div>


<!-- This CDN is delebrately put here to help research library authentication -->

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="../js/toastr.min.js"></script>
<script>
    $('#saveComment1').on('click', function () {
   const message = $('#comment1').val();
   if(!message){
    Swal.fire({
      position: 'top-end',
      icon: 'error',
      title: "Please input your code",
      showConfirmButton: false,
      timer: 1500
    })
    return
   }
   jQuery.ajax({
    url:`/research/verify-otp`,
    method:'POST',
    data:{
      auth_code:message,
    },
     success:function(data)
        {
          if(data.success == false){
            
          Swal.fire({
            position: 'top-end',
            icon: 'error',
            title: data.message,
            showConfirmButton: false,
            timer: 1500
          })
          return
          }
          location.href = `/research?auth_code=${message}`;        
        }
    });
  });
  
</script>