@extends('admin.template')

@section('sidebar')
  <aside id="sidebar" class="sidebar">

    <ul class="sidebar-nav" id="sidebar-nav">

      <li class="nav-item">
        <a class="nav-link " href="{{ url('admin') }}">
          <i class="bi bi-grid"></i>
          <span>Tableau de Bord</span>
        </a>
      </li><!-- End Dashboard Nav -->

      <li class="nav-item">
        <a class="nav-link collapsed" data-bs-target="#components-nav" data-bs-toggle="collapse" href="#">
          <i class="bi bi-menu-button-wide"></i><span>Gestion des livres </span><i class="bi bi-chevron-down ms-auto"></i>
        </a>
        <ul id="components-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
          <li>
            <a href="{{ url('admin/consulter_book') }}">
              <i class="bi bi-circle"></i><span>Livres disponibles</span>
            </a>
          </li>
          <li>
            <a href="{{ url('admin/add') }}">
              <i class="bi bi-circle"></i><span>Ajouter un livre</span>
            </a>
          </li>
          <li>
            <a href="{{ url('admin/supp') }}">
              <i class="bi bi-circle"></i><span>Livres supprimés</span>
            </a>
          </li>
          <li>
            <a href="{{ url('admin/attente') }}">
              <i class="bi bi-circle"></i><span>Livres en attente </span>
            </a>
          </li>


        </ul>
      </li>


      <li class="nav-item">
        <a class="nav-link collapsed" data-bs-target="#forms-nav" data-bs-toggle="collapse" href="#">
          <i class="bi bi-journal-text"></i><span>Documentations </span><i class="bi bi-chevron-down ms-auto"></i>
        </a>
        <ul id="forms-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
          <li>
            <a href="{{ url('admin/add_document') }}">
              <i class="bi bi-circle"></i><span>Ajouter un document </span>
            </a>
          </li>
          <li>
            <a href="{{ url('admin/supp_document') }}">
              <i class="bi bi-circle"></i><span>Documents supprimés  </span>
            </a>
          </li>
          <li>
            <a href="{{ url('admin/consulter') }}">
              <i class="bi bi-circle"></i><span>Documents disponibles </span>
            </a>
          </li>
        </ul>
      </li><!-- End Forms Nav -->
      <li class="nav-heading">Pages</li>

      <li class="nav-item ">
        <a class="nav-link collapsed" href="{{ route('profil', 0) }}">
          <i class="bi bi-person"></i>
          <span>Profil</span>
        </a>
      </li><!-- End Profile Page Nav -->

      <li class="nav-item">
        <a class="nav-link collapsed" href="{{ url('admin/pages-faq') }}">
          <i class="bi bi-question-circle"></i>
          <span>Aide</span>
        </a>
      </li><!-- End F.A.Q Page Nav -->


    </ul>

  </aside>
@endsection


@section('main')
  <main id="main" class="main">

    <div class="pagetitle">
      <h1>Tableau de Bord</h1>
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item"><a href="{{ url('admin') }}">Accueil</a></li>
          <li class="breadcrumb-item active">Tableau de Bord</li>
        </ol>
      </nav>
    </div><!-- End Page Title -->

    <section class="section dashboard">
      <div class="row">

        <!-- Left side columns -->
        <div class="col-lg-12">
          <div class="row">

            <!-- Sales Card -->
            <div class="col-xxl-4 col-md-4">

              <div class="card info-card customers-card">

                <div class="card-body">
                  <h5 class="card-title">Utilisateurs</h5>

                  <div class="d-flex align-items-center">
                    <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
                      <i class="bi bi-people"></i>
                    </div>
                    <div class="ps-3">
                      <h6>{{ $stats['user'] }}</h6>
                    </div>
                  </div>

                </div>
              </div>

            </div><!-- End Sales Card -->

            <!-- Revenue Card -->
            <div class="col-xxl-4 col-md-4">
              <div class="card info-card revenue-card">

                <div class="card-body">
                  <h5 class="card-title">Livres enregistrés</h5>

                  <div class="d-flex align-items-center">
                    <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
                      <i class="bi bi-book"></i>
                    </div>
                    <div class="ps-3">
                      <h6>{{ $stats['livre'] }}</h6>

                    </div>
                  </div>
                </div>

              </div>
            </div><!-- End Revenue Card -->

            <!-- Revenue Card -->
            <div class="col-xxl-4 col-md-4">
              <div class="card info-card revenue-card">

                <div class="card-body">
                  <h5 class="card-title">Livres en attente</h5>

                  <div class="d-flex align-items-center">
                    <div class="card-icon rounded-circle d-flex align-items-center justify-content-center text-secondary">
                      <i class="bi bi-book"></i>
                    </div>
                    <div class="ps-3">
                      <h6>{{ $stats['livre_attente'] }}</h6>

                    </div>
                  </div>
                </div>

              </div>
            </div><!-- End Revenue Card -->

            <!-- Recent Sales -->
            <div class="col-12">
              <div class="card recent-sales overflow-auto">

                <div class="card-body">
                  <h5 class="card-title">Livres en attente</h5>

                  <table class="table table-borderless ">
                    <thead>
                      <tr>
                        <th scope="col">#</th>
                        <th>Titre</th>
                        <th>Auteur</th>
                        <th>Edition</th>
                        <th>ISBN</th>
                      </tr>
                    </thead>
                    <tbody>
                      @foreach ($books as $book)
                        <tr>
                          <th scope="row"><a href="#">#{{ $book->id }}</a></th>
                          <td><a href="{{ route('read.book', $book['id']) }}">{{ $book['titre'] }}</a>
                          </td>
                          <td>{{ $book['auteur'] }}</td>
                          <td>{{ $book['edition'] }}</td>
                          <td>{{ $book['ISBN'] }}</td>
                        </tr>
                      @endforeach
                    </tbody>
                  </table>

                </div>

              </div>
            </div><!-- End Recent Sales -->

          </div>
        </div><!-- End Left side columns -->

    </section>

  </main>
@endsection
