<?php $__env->startSection('content'); ?>

<div class="card card-primary">
        <div class="card-header"
            style="display:flex; flex-wrap:wrap; align-items:center; justify-content:center; position:relative; gap:10px;">

            <!-- Title -->
            <h3 style="
                 padding:20px;
                font-weight:700;
                font-size:30px;
                padding-bottom:6px;
                border-bottom:3px solid #a74a28;
                margin:0;
                text-align:center;
                flex:1 1 100%;
            ">
                Early Learning  List
            </h3>

            <!-- Button -->
            <a href="<?php echo e(route('book-offers.create')); ?>"
            class="btn btn-primary"
            style="flex:0 0 auto;">
                <i class="fas fa-plus"></i>  Add Early Learning
            </a>

        </div>


    <div class="card-body">
        <!-- Search -->
        <form method="GET" action="<?php echo e(route('book-offers.index')); ?>" class="mb-3">
            <div class="input-group">
                <input type="text"
                       name="search"
                       class="form-control"
                       placeholder="Search by title..."
                       value="<?php echo e(request('search')); ?>">
                <button type="submit" class="btn btn-primary">Search</button>
            </div>
        </form>

        <!-- Table -->
        <div class="table-responsive">
            <table class="table table-bordered table-hover text-center align-middle">
                <thead class="table bg-primary py-2">
                    <tr>
                        <th class="text-white"><h5>SI</h5></th>
                            <th class="text-white"><h5>Image</h5></th>
                            <th class="text-white"><h5>Category Title</h5></th>
                            <th class="text-white"><h5>Title</h5></th>
                            <th class="text-white"><h5>Author</h5></th>
                            
                            <th class="text-white"><h5>Priority</h5></th>
                            <th class="text-white"><h5>Status</h5></th>
                            <th class="text-white"><h5>Action</h5></th>
                        </tr>
                    </tr>
                </thead>

                <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $bookOffers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $bookOffer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>

                        <td><?php echo e($bookOffers->firstItem() + $key); ?></td>

                        <!-- Image -->
                        <td>
                            <?php if($bookOffer->image): ?>
                                <img src="<?php echo e(asset($bookOffer->image)); ?>"
                                     style="width:60px; height:60px; object-fit:cover; border-radius:6px;">
                            <?php else: ?>
                                <span class="text-muted">No Image</span>
                            <?php endif; ?>
                        </td>

                        <!-- Category -->
                        <td>
                            <?php echo e($bookOffer->category->title ?? 'No Category'); ?>

                        </td>

                        <!-- Data -->
                        <td><?php echo e($bookOffer->title); ?></td>
                        <td><?php echo e($bookOffer->author); ?></td>
                        
                        <td><?php echo e($bookOffer->priority); ?></td>

                        <!-- Status -->
                        <td>
                            <span class="badge <?php echo e($bookOffer->status == 1 ? 'bg-primary text-white' : 'bg-danger text-white'); ?>">
                                <?php echo e($bookOffer->status == 1 ? 'Active' : 'De-Active'); ?>

                            </span>
                        </td>

                        <!-- Action -->
                        <td>
                            <div class="dropdown">
                                <button class="btn btn-light dropdown-toggle"
                                        type="button"
                                        data-toggle="dropdown">
                                    <i class="fa-solid fa-ellipsis-vertical"></i>
                                </button>

                                <div class="dropdown-menu text-center">

                                    <!-- Edit -->
                                    <a class="dropdown-item bg-success text-white rounded mb-1"
                                    href="<?php echo e(route('book-offers.edit', $bookOffer->id)); ?>">
                                        <i class="fa-solid fa-pen-to-square"></i>
                                        Edit
                                    </a>

                                    <!-- Show -->
                                    <a class="dropdown-item bg-primary text-white rounded mb-1"
                                    href="<?php echo e(route('book-offers.show', $bookOffer->id)); ?>">
                                        <i class="fa-solid fa-eye"></i>
                                        Show
                                    </a>

                                    <!-- Delete -->
                                    <form action="<?php echo e(route('book-offers.destroy', $bookOffer->id)); ?>"
                                        method="POST"
                                        onsubmit="return confirm('Are you sure?');">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>

                                        <button type="submit"
                                                class="dropdown-item bg-danger text-white rounded">
                                            <i class="fa-solid fa-trash-can"></i>
                                            Delete
                                        </button>
                                    </form>

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

                    </tr>

                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="9" class="text-center text-muted">
                            No popular items found.
                        </td>
                    </tr>
                <?php endif; ?>
                </tbody>

            </table>
        </div>

        <!-- Pagination -->
       <div class="mt-3">
            <?php echo e($bookOffers->appends(request()->query())->links()); ?>

        </div>

    </div>
</div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.dashboard', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\laragon\www\bookFire\resources\views/backend/pages/bookOffers/index.blade.php ENDPATH**/ ?>