

<?php $__env->startSection('title', 'Books'); ?>

<?php $__env->startSection('content'); ?>
<div class="page-content">
    <div class="container-fluid">
        <!-- Page Title -->
        <div class="row">
            <div class="col-12">
                <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                    <h4 class="mb-sm-0">Books</h4>
                    <div class="page-title-right">
                        <ol class="breadcrumb m-0">
                            <li class="breadcrumb-item"><a href="<?php echo e(route('home')); ?>">Home</a></li>
                            <li class="breadcrumb-item active">Books</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="card border-0 shadow-sm">
                    <div class="card-header bg-transparent border-bottom">
                        <div class="d-flex justify-content-between align-items-center">
                            <h5 class="card-title mb-0">
                                <i class="ri-book-line text-primary me-2"></i> All Books
                                <span class="badge bg-soft-primary text-primary ms-2"><?php echo e($books->count()); ?></span>
                            </h5>
                            <a href="<?php echo e(route('books.create')); ?>" class="btn btn-primary btn-sm">
                                <i class="ri-add-line me-1"></i> Add Book
                            </a>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-hover align-middle mb-0">
                                <thead class="table-light">
                                    <tr>
                                        <th style="width: 60px;">ID</th>
                                        <th>Title</th>
                                        <th>Author</th>
                                        <th>Publisher</th>
                                        <th>Category</th>
                                        <th style="width: 100px;">Cover Image</th>
                                        <th style="width: 200px;">Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php $__empty_1 = true; $__currentLoopData = $books; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $book): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr class="table-row-hover">
                                        <td>
                                            <span class="badge bg-primary rounded-pill"><?php echo e($book->id); ?></span>
                                        </td>
                                        <td>
                                            <strong class="text-dark"><?php echo e($book->title); ?></strong>
                                        </td>
                                        <td>
                                            <span class="text-muted"><?php echo e($book->author); ?></span>
                                        </td>
                                        <td>
                                            <span class="text-muted"><?php echo e($book->publisher); ?></span>
                                        </td>
                                        <td>
                                            <span class="badge bg-soft-info text-info">
                                                <i class="ri-bookmark-line me-1"></i><?php echo e($book->category->name); ?>

                                            </span>
                                        </td>
                                        <td>
                                            <?php if(file_exists(public_path($book->cover_image))): ?>
                                                <img src="<?php echo e(asset($book->cover_image)); ?>" alt="Cover Image" 
                                                     class="img-thumbnail rounded" style="width: 50px; height: 50px; object-fit: cover;">
                                            <?php else: ?>
                                                <span class="badge bg-soft-danger text-danger">Missing</span>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <div class="d-flex gap-2">
                                                <?php if(file_exists(public_path($book->file))): ?>
                                                    <a href="<?php echo e(asset($book->file)); ?>" target="_blank" 
                                                       class="btn btn-sm btn-info rounded-pill" title="View PDF">
                                                        <i class="ri-file-pdf-line"></i>
                                                    </a>
                                                <?php else: ?>
                                                    <button class="btn btn-sm btn-secondary rounded-pill" disabled title="PDF missing">
                                                        <i class="ri-file-pdf-line"></i>
                                                    </button>
                                                <?php endif; ?>
                                                
                                                <a href="<?php echo e(route('books.edit', $book->id)); ?>" 
                                                   class="btn btn-sm btn-warning rounded-pill" title="Edit">
                                                    <i class="ri-pencil-line"></i>
                                                </a>
                                                
                                                <form action="<?php echo e(route('books.destroy', $book->id)); ?>" method="POST" class="d-inline">
                                                    <?php echo csrf_field(); ?>
                                                    <?php echo method_field('DELETE'); ?>
                                                    <button type="submit" class="btn btn-sm btn-danger rounded-pill" 
                                                            onclick="return confirm('Are you sure you want to delete this book?')" title="Delete">
                                                        <i class="ri-delete-bin-line"></i>
                                                    </button>
                                                </form>
                                            </div>
                                        </td>
                                    </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="7" class="text-center py-5">
                                            <div class="text-muted">
                                                <i class="ri-inbox-line fs-1 d-block mb-2"></i>
                                                No books found
                                            </div>
                                        </td>
                                    </tr>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $__env->startPush('styles'); ?>
<style>
    .table-row-hover:hover {
        background-color: #f8f9fa;
        transition: background-color 0.2s ease;
    }
</style>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/macbookpro/Downloads/mulikat/resources/views/dashboard/books/index.blade.php ENDPATH**/ ?>