<?php if (isset($component)) { $__componentOriginal1a6cca1fb3b05e19b47840b98800a235 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal1a6cca1fb3b05e19b47840b98800a235 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.layouts.dashboard','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('layouts.dashboard'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>


    <div class="page-shell">

        

        <div class="page-header">

            <div>
                <span class="eyebrow">
                    Digital Catalogue
                </span>

                <h1>
                    Books
                </h1>

                <p>
                    Manage LiteraHub titles, authors, publishers,
                    review status and distribution rights.
                </p>
            </div>

            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create', App\Models\Book::class)): ?>

                <a
                    href="<?php echo e(route('books.create')); ?>"
                    class="btn btn--primary"
                >
                    Add Book
                </a>

            <?php endif; ?>

        </div>


        

        <div class="card">

            <form
                method="GET"
                action="<?php echo e(route('books.index')); ?>"
                class="catalogue-filters"
            >

                <div class="filter-search">

                    <label
                        for="search"
                        class="sr-only"
                    >
                        Search books
                    </label>

                    <input
                        id="search"
                        type="search"
                        name="search"
                        value="<?php echo e(request('search')); ?>"
                        placeholder="Search title, ISBN or author..."
                    >

                </div>


                <div>

                    <label
                        for="status"
                        class="sr-only"
                    >
                        Status
                    </label>

                    <select
                        id="status"
                        name="status"
                    >

                        <option value="">
                            All statuses
                        </option>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = [
                            'draft' => 'Draft',
                            'under_review' => 'Under Review',
                            'changes_requested' => 'Changes Requested',
                            'approved' => 'Approved',
                            'published' => 'Published',
                            'rejected' => 'Rejected',
                            'archived' => 'Archived',
                        ]; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>

                            <option
                                value="<?php echo e($value); ?>"
                                <?php if(request('status') === $value): echo 'selected'; endif; ?>
                            >
                                <?php echo e($label); ?>

                            </option>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>

                    </select>

                </div>


                <button
                    type="submit"
                    class="btn btn--secondary"
                >
                    Filter
                </button>


                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(
                    request('search')
                    || request('status')
                ): ?>

                    <a
                        href="<?php echo e(route('books.index')); ?>"
                        class="btn btn--ghost"
                    >
                        Clear
                    </a>

                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            </form>

        </div>


        

        <div class="card">

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($books->count()): ?>

                <div class="table-wrapper">

                    <table class="table-condensed">

                        <thead>

                            <tr>
                                <th>Book</th>
                                <th>ISBN</th>
                                <th>Publisher</th>
                                <th>Category</th>
                                <th>Status</th>
                                <th>Rights</th>
                                <th>Updated</th>
                                <th></th>
                            </tr>

                        </thead>

                        <tbody>

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $books; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $book): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>

                                <?php
                                    $bookInitials = collect(
                                        preg_split(
                                            '/\s+/',
                                            trim($book->title)
                                        )
                                    )
                                        ->filter()
                                        ->take(2)
                                        ->map(
                                            fn ($word) =>
                                                strtoupper(
                                                    mb_substr(
                                                        $word,
                                                        0,
                                                        1
                                                    )
                                                )
                                        )
                                        ->implode('');
                                ?>


                                <tr>

                                    
                                    <td>

                                        <div class="directory-person">

                                            <span class="directory-avatar">
                                                <?php echo e($bookInitials); ?>

                                            </span>


                                            <div class="directory-person__details">

                                                <div class="directory-person__name">

                                                    <a
                                                        href="<?php echo e(route('books.show', $book)); ?>"
                                                    >
                                                        <?php echo e($book->title); ?>

                                                    </a>

                                                </div>

                                                <span class="directory-person__meta">

                                                    <?php echo e($book->authors->pluck('name')->join(', ') ?: 'No author assigned'); ?>


                                                </span>

                                            </div>

                                        </div>

                                    </td>


                                    
                                    <td>

                                        <span class="table-value">
                                            <?php echo e($book->isbn); ?>

                                        </span>

                                    </td>


                                    
                                    <td>

                                        <span class="table-value">
                                            <?php echo e($book->publisher?->name ?? 'Independent'); ?>

                                        </span>

                                    </td>


                                    
                                    <td>

                                        <span class="table-value">
                                            <?php echo e($book->category ?? '—'); ?>

                                        </span>

                                    </td>


                                    
                                    <td>

                                        <?php if (isset($component)) { $__componentOriginal3f380d495f99c22111a0f231bf4ba319 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal3f380d495f99c22111a0f231bf4ba319 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.library.book-status','data' => ['status' => $book->status]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('library.book-status'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['status' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($book->status)]); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal3f380d495f99c22111a0f231bf4ba319)): ?>
<?php $attributes = $__attributesOriginal3f380d495f99c22111a0f231bf4ba319; ?>
<?php unset($__attributesOriginal3f380d495f99c22111a0f231bf4ba319); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal3f380d495f99c22111a0f231bf4ba319)): ?>
<?php $component = $__componentOriginal3f380d495f99c22111a0f231bf4ba319; ?>
<?php unset($__componentOriginal3f380d495f99c22111a0f231bf4ba319); ?>
<?php endif; ?>

                                    </td>


                                    
                                    <td>

                                        <div class="mini-rights">

                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($book->allow_online_reading): ?>
                                                <span title="Online reading allowed">
                                                    Read
                                                </span>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($book->allow_print): ?>
                                                <span title="Printing allowed">
                                                    Print
                                                </span>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($book->allow_download): ?>
                                                <span title="Download allowed">
                                                    Download
                                                </span>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                                        </div>

                                    </td>


                                    
                                    <td>

                                        <span class="table-value">
                                            <?php echo e($book->updated_at?->format('d M Y')); ?>

                                        </span>

                                    </td>


                                    
                                    <td>

                                        <div class="table-icon-actions">

                                            <a
                                                href="<?php echo e(route('books.show', $book)); ?>"
                                                class="table-icon-button"
                                                title="View book"
                                                aria-label="View book"
                                            >
                                                <svg viewBox="0 0 24 24">
                                                    <path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12Z"/>
                                                    <circle cx="12" cy="12" r="3"/>
                                                </svg>
                                            </a>


                                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update', $book)): ?>

                                                <a
                                                    href="<?php echo e(route('books.edit', $book)); ?>"
                                                    class="table-icon-button"
                                                    title="Edit book"
                                                    aria-label="Edit book"
                                                >
                                                    <svg viewBox="0 0 24 24">
                                                        <path d="M12 20h9"/>
                                                        <path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/>
                                                    </svg>
                                                </a>

                                            <?php endif; ?>


                                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete', $book)): ?>

                                                <form
                                                    method="POST"
                                                    action="<?php echo e(route('books.destroy', $book)); ?>"
                                                    class="table-icon-form"
                                                    onsubmit="return confirm('Delete this book? This action cannot be undone.');"
                                                >

                                                    <?php echo csrf_field(); ?>
                                                    <?php echo method_field('DELETE'); ?>

                                                    <button
                                                        type="submit"
                                                        class="table-icon-button table-icon-button--danger"
                                                        title="Delete book"
                                                        aria-label="Delete book"
                                                    >
                                                        <svg viewBox="0 0 24 24">
                                                            <path d="M3 6h18"/>
                                                            <path d="M8 6V4h8v2"/>
                                                            <path d="M19 6l-1 14H6L5 6"/>
                                                            <path d="M10 11v5"/>
                                                            <path d="M14 11v5"/>
                                                        </svg>
                                                    </button>

                                                </form>

                                            <?php endif; ?>

                                        </div>

                                    </td>

                                </tr>

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>

                        </tbody>

                    </table>

                </div>


                <div class="pagination-shell">
                    <?php echo e($books->links()); ?>

                </div>

            <?php else: ?>

                <div class="empty-state">

                    <div class="empty-state__icon">

                        <svg viewBox="0 0 24 24">
                            <path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"/>
                            <path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2Z"/>
                        </svg>

                    </div>

                    <h2>
                        No books found
                    </h2>

                    <p>
                        Add your first book or adjust the current filters.
                    </p>

                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create', App\Models\Book::class)): ?>

                        <a
                            href="<?php echo e(route('books.create')); ?>"
                            class="btn btn--primary"
                        >
                            Add Book
                        </a>

                    <?php endif; ?>

                </div>

            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        </div>

    </div>


    <style>
        .catalogue-filters {
            display: grid;
            grid-template-columns: minmax(260px, 1fr) 180px auto auto;
            gap: 8px;
            align-items: end;
        }

        .filter-search {
            min-width: 0;
        }

        .catalogue-filters input,
        .catalogue-filters select {
            width: 100%;
        }

        .mini-rights {
            display: flex;
            flex-wrap: wrap;
            gap: 3px;
        }

        .mini-rights span {
            padding: 2px 5px;
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
            color: var(--color-text-muted);
            font-size: .52rem;
            font-weight: 700;
        }

        .pagination-shell {
            margin-top: 15px;
        }

        @media (max-width: 800px) {
            .catalogue-filters {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media (max-width: 520px) {
            .catalogue-filters {
                grid-template-columns: 1fr;
            }
        }
    </style>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal1a6cca1fb3b05e19b47840b98800a235)): ?>
<?php $attributes = $__attributesOriginal1a6cca1fb3b05e19b47840b98800a235; ?>
<?php unset($__attributesOriginal1a6cca1fb3b05e19b47840b98800a235); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal1a6cca1fb3b05e19b47840b98800a235)): ?>
<?php $component = $__componentOriginal1a6cca1fb3b05e19b47840b98800a235; ?>
<?php unset($__componentOriginal1a6cca1fb3b05e19b47840b98800a235); ?>
<?php endif; ?><?php /**PATH C:\Users\Surface pro 4\OneDrive\Desktop\DevOps\literture\literahub\resources\views/books/index.blade.php ENDPATH**/ ?>