@extends('back-end.master.app')
@section('title', 'customer')
@section('body')
    <main class="app-content">
        <section class=" gradient-custom-2">
            <div class="">
                <div class="row d-flex justify-content-center align-items-center h-100">
                    <div class="col-md-12 col-xl-12">
                        <div class="card mask-custom">
                            <div class="card-header">
                                <div class="row">
                                    <div class="col-md-8">
                                        <h4>poetries</h4>
                                        <ul class="nav nav-tabs mb-3" id="ex1" role="tablist">
                                            <li class="nav-item" role="presentation">
                                                <a data-mdb-tab-init class="nav-link active" id="ex1-tab-1"
                                                    href="{{ route('poetries.index') }}" role="tab" aria-controls="ex1-tabs-1"
                                                    aria-selected="true">General literature</a>
                                            </li>
                                            <li class="nav-item" role="presentation">
                                                <a data-mdb-tab-init class="nav-link" id="ex1-tab-2" href="{{ route('publicPoetries.index') }}"
                                                    role="tab" aria-controls="ex1-tabs-2" aria-selected="false">Public literature</a>
                                            </li>
                                            
                                        </ul>
                                    </div>
                                    <div class="col-md-4">
                                        <div class="" style="float: right">
                                            <a href="{{ route('poetries.create') }}"
                                                class="btn btn-primary btn-sm btn-rounded mt-5" style="float: right">Add
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="card-body p-4 ">
                                <div class="row">
                                    <div class="col-md-12">
                                        <table class="table text-center">
                                            <thead>
                                                <tr>
                                                    <th scope="col">#</th>
                                                    <th scope="col">The first poem</th>
                                                    {{-- <th scope="col">Date</th> --}}
                                                    <th scope="col">Writter</th>
                                                    {{-- <th scope="col">Qaran</th> --}}
                                                    <th scope="col">Action</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                @foreach ($data as $row)
                                                    <tr class="fw-normal">
                                                        <th class="border-0">{{ $loop->iteration }}</th>
                                                        <th class="border-0">{{ $row->title }}</th>
                                                        <th class="border-0">{{ $row->poet->name }}</th>
                                                        <td class="border-0 align-middle">
                                                            <a href="{{ route('poetries.show', $row->id) }}"
                                                                data-mdb-toggle="tooltip" title="edit"><i
                                                                    class="fas fa-eye fa-lg text-info me-3"></i></a>

                                                            <a href="{{ route('poetries.edit', $row->id) }}"
                                                                data-mdb-toggle="tooltip" title="edit"><i
                                                                    class="fas fa-pencil fa-lg text-success me-3"></i></a>

                                                            <a href="{{ route('poetries.delete', $row->id) }}"
                                                                data-mdb-toggle="tooltip" onclick="return showConfirmBox();" class="btn-delete"
                                                                title="Remove"><i
                                                                    class="fas fa-trash-alt fa-lg text-warning "></i></a>


                                                        </td>

                                                    </tr>
                                                @endforeach

                                            </tbody>
                                            {{ $data->links('pagination::bootstrap-4') }}
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </section>
    </main>
@endsection


@section('pageJs')
    <script type="text/javascript">
        $(".app-menu").removeClass("active");
        $("#nav_stocki").addClass("active");
        $("#stocki").addClass("is-expanded");
        $("#poets").addClass("active");
    </script>
@endsection
