<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no"
    />
    <meta name="description" content="" />
    <meta name="author" content="" />

    <title>SB Admin 2 - Dashboard</title>

    <!-- Custom fonts for this template-->
    {% load static%}
    <link
      href="{% static 'vendor/fontawesome-free/css/all.min.css' %}"
      rel="stylesheet"
      type="text/css"
    />
    <link
      href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
      rel="stylesheet"
    />
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <!-- Custom styles for this template-->
    <link href="{% static 'css/sb-admin-2.min.css' %}" rel="stylesheet" />
    <link href="{% static 'vendor/datatables/dataTables.bootstrap4.min.css' %}" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
  </head>

  <body id="page-top">
    <!-- Page Wrapper -->
    <div id="wrapper">
      <!-- Sidebar -->
      <ul
        class="navbar-nav bg-gradient-success sidebar sidebar-dark accordion"
        id="accordionSidebar"
      >
        <!-- Sidebar - Brand -->
        <a
          class="sidebar-brand d-flex align-items-center justify-content-center"
          href="{% url 'home'%}"
        >
          <div class="sidebar-brand-icon rotate-n-15">
            <i class="fas fa-laugh-wink"></i>
          </div>
          {% if request.user.is_authenticated %}
          <div class="sidebar-brand-text mx-1">{{request.user}} </div>
          {% else %}
          <div class="sidebar-brand-text mx-3">Selamat datang</div>
          {% endif%}
        </a>

        <!-- Divider -->
        <hr class="sidebar-divider my-0" />

        <!-- Nav Item - Dashboard -->
        <li class="nav-item">
          <a class="nav-link" href="{% url 'book-list'%}">
            <i class="fas fa-fw fa-book"></i>
            <span>Buku</span></a
          >
        </li>

        <!-- Divider -->
        <hr class="sidebar-divider my-0" />

        <!-- Nav Item - Dashboard -->
        <li class="nav-item">
          <a class="nav-link" href="{% url 'category-list'%}">
            <i class="fas fa-fw fa-book"></i>
            <span>Category</span></a
          >
        </li>
        <!-- Divider -->
        <!-- <hr class="sidebar-divider" />
        <li class="nav-item">
          <a class="nav-link" href="">
            <i class="fas fa-fw fa-pray"></i>
            <span>Member</span></a
          >
        </li> -->
        <!-- Divider -->
        <hr class="sidebar-divider" />
        <li class="nav-item">
          <a class="nav-link collapsed" href="{% url 'datapeminjaman'%}" data-toggle="collapse" data-target="#collapseTwo"
              aria-expanded="true" aria-controls="collapseTwo">
              <i class="fas fa-fw fa-cog"></i>
              <span>Peminjaman</span>
          </a>
          <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
              <div class="bg-white py-2 collapse-inner rounded">
                  <h6 class="collapse-header">Peminjaman Featue</h6>
                  <a class="collapse-item" href="{% url 'datapeminjaman'%}">Data Peminjaman Buku</a>
                  <a class="collapse-item" href="{% url 'createpeminjaman'%}">Tambah Peminjaman Buku</a>
              </div>
          </div>
      </li>
      <hr class="sidebar-divider" />
      <li class="nav-item">
        <a class="nav-link collapsed"  data-toggle="collapse" data-target="#laporan"
            aria-expanded="true" aria-controls="laporan">
            <i class="fas fa-fw fa-cog"></i>
            <span>Laporan Peminjaman </span>
        </a>
        <div id="laporan" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
            <div class="bg-white py-2 collapse-inner rounded">
                <h6 class="collapse-header">Laporan</h6>
                <a class="collapse-item" href="{% url 'hampirdeadline'%}">Near Deadline</a>
                <a class="collapse-item" href="{% url 'reportdeadline'%}">Overdue</a>
            </div>
        </div>
    </li>
      {% if request.user.is_authenticated %}
        {% if request.user.role == 'librarian' %}
          <hr class="sidebar-divider" />
          <li class="nav-item">
            <a class="nav-link" href="{% url 'datauser'%}">
              <i class="fas fa-fw fa-tachometer-alt"></i>
              <span>user</span></a
            >
          </li>
        {% endif%}
      {% endif%}
        <hr class="sidebar-divider" />
        <li class="nav-item">
          <a class="nav-link" href="{% url 'history' %}">
            <i class="fas fa-fw fa-tachometer-alt"></i>
            <span>Login History user</span></a
          >
        </li>

        <hr class="sidebar-divider" />
        <!-- Sidebar Toggler (Sidebar) -->
        <div class="text-center d-none d-md-inline">
          <button class="rounded-circle border-0" id="sidebarToggle"></button>
        </div>
      </ul>
      <!-- End of Sidebar -->

      <!-- Content Wrapper -->
      <div id="content-wrapper" class="d-flex flex-column">
        <!-- Main Content -->
        <div id="content">
          <!-- Topbar -->
          <nav
            class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow"
          >
            <!-- Sidebar Toggle (Topbar) -->
            <button
              id="sidebarToggleTop"
              class="btn btn-link d-md-none rounded-circle mr-3"
            >
              <i class="fa fa-bars"></i>
            </button>


            <!-- Topbar Navbar -->
            <ul class="navbar-nav ml-auto">
              <div class="topbar-divider d-none d-sm-block"></div>

              <!-- Nav Item - User Information -->
              <li class="nav-item dropdown no-arrow">
                <a
                  class="nav-link dropdown-toggle"
                  href="#"
                  id="userDropdown"
                  role="button"
                  data-toggle="dropdown"
                  aria-haspopup="true"
                  aria-expanded="false"
                >
                {% if request.user.is_authenticated %}
                  <span class="mr-2 d-none d-lg-inline text-gray-600 small"
                    >{{request.user.username}}</span
                  >
                  {% else %}
                  <span class="mr-2 d-none d-lg-inline text-gray-600 small"
                    >masuk</span
                  >
                {% endif %}
                </a>
                <!-- Dropdown - User Information -->
                <div
                  class="dropdown-menu dropdown-menu-right shadow animated--grow-in"
                  aria-labelledby="userDropdown"
                >

                  {% if request.user.is_authenticated %}
                  <a class="dropdown-item" href="{% url 'update_password'%}">
                    <i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i>
                    Edit Password
                  </a>
                  <div class="dropdown-divider"></div>
                  <a
                    class="dropdown-item"
                    href="{% url 'logout'%}"
                  >
                    <i
                      class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"
                    ></i>
                    Logout
                  </a>
                  {% else %}
                  <a
                    class="dropdown-item"
                    href="{% url 'login'%}"
                  >
                    <i
                      class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"
                    ></i>
                    Login
                  </a>
                  {% endif%}
                </div>
              </li>
            </ul>
          </nav>
          <!-- End of Topbar -->

          <!-- Begin Page Content -->
          <div class="container-fluid">
            <!-- Page Heading -->
            {% block content %} {% endblock content %}
          </div>
          <!-- /.container-fluid -->
        </div>
        <!-- End of Main Content -->

        <!-- Footer -->
        <footer class="sticky-footer bg-white">
          <div class="container my-auto">
            <div class="copyright text-center my-auto">
              <span>Copyright &copy; Your Website 2021</span>
            </div>
          </div>
        </footer>
        <!-- End of Footer -->
      </div>
      <!-- End of Content Wrapper -->
    </div>
    <!-- End of Page Wrapper -->

    <!-- Bootstrap core JavaScript-->
    <script src="{% static 'vendor/jquery/jquery.min.js' %}"></script>
    <script src="{% static 'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>

    <!-- Core plugin JavaScript-->
    <script src="{% static 'vendor/jquery-easing/jquery.easing.min.js' %}"></script>

    <!-- Custom scripts for all pages-->
    <script src="{% static 'js/sb-admin-2.min.js' %}"></script>

    <!-- Page level plugins -->
    <script src="{% static 'vendor/chart.js/Chart.min.js' %}"></script>

    <!-- Page level custom scripts -->
    <script src="{% static 'js/demo/chart-area-demo.js' %}"></script>
    <script src="{% static 'js/demo/chart-pie-demo.js' %}"></script>
    <!-- Page level plugins -->
    <script src="{% static 'vendor/datatables/jquery.dataTables.min.js' %}"></script>
    <script src="{% static 'vendor/datatables/dataTables.bootstrap4.min.js' %}"></script>

    <!-- Page level custom scripts -->
    <script src="{% static 'js/demo/datatables-demo.js' %}"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>

  </body>
</html>
