@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 collapsed" 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" 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 show" 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') }}" class="active">
                            <i class="bi bi-circle"></i><span>Livres en attente </span>
                        </a>
                    </li>


                </ul>


            <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>Livres en attentes</h1>
            <nav>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{{ url('admin') }}">Accueil</a></li>
                    <li class="breadcrumb-item">Gestion des livres</li>
                    <li class="breadcrumb-item active">Livres en attentes</li>
                </ol>
            </nav>
        </div><!-- End Page Title -->

        <section class="section">
            <div class="row">
                <div class="col-lg-12">

                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">Livres en attentes</h5>
                            <p>Les utilisateurs de la bibliothèque vous proposent les livres suivants </p>

                            <!-- Table with stripped rows -->
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>Titre</th>
                                        <th>Auteur</th>
                                        <th>Edition</th>
                                        <th>ISBN</th>
                                        <!--<th>Discipline</th>-->
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($books as $book)
                                        <tr>
                                            <td><a
                                                    href="{{ route('read.book', $book['id']) }}">{{ $book['titre'] }}</a>
                                            </td>
                                            <td>{{ $book['auteur'] }}</td>
                                            <td>{{ $book['edition'] }}</td>
                                            <td>{{ $book['ISBN'] }}</td>
                                            <!--<td>discipline</td>-->

                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>
                            <!-- End Table with stripped rows -->

                        </div>
                    </div>

                </div>
            </div>
        </section>
    </main>
    @if (session()->has('error'))
        <script src="/js/jquery-3.2.1.min.js"></script>
        <script type="text/javascript">
            $(window).on('load', function() {
                $('#confModal2').modal('show');
            });
        </script>
        <!-- Fenetre modale 1-->

        <div class="modal fade" id="confModal2" tabindex="-1" role="dialog" aria- labelledby="confModalLabel2"
            aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title text-danger text-center" id="confModalLabel2">{{session('error')}}</h5>
                        <button type="button" class="close" data-dismiss="modal" aria- label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <p>Veuillez réessayer !</p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">D'accord</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Fin fenetre modale 1-->
    @endif
    @if (session()->has('success'))
        <script src="/js/jquery-3.2.1.min.js"></script>
        <a type="button" id="lien2" data-bs-toggle="modal" data-bs-target="#confModal1"
            style="display: none;">appui</a>
        <script type="text/javascript">
            $(window).on('load', function() {
                $('#confModal1').modal('show');
            });
        </script>
        <!-- Fenetre modale 1-->

        <div class="modal fade" id="confModal1" tabindex="-1" role="dialog" aria- labelledby="confModalLabel1"
            aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title text-success text-center" id="confModalLabel1"
                            style="text-align:center;">{{session('success')}}</h5>
                        <button type="button" class="close" data-dismiss="modal" aria- label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <p> <strong>Merci pour l'intérêt .</strong> </p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-success" data-dismiss="modal">D'accord</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Fin fenetre modale 1-->
    @endif
@endsection
