

<?php $__env->startSection('content'); ?>
    <div class="card">
        <div class="card-header d-flex justify-content-between align-items-center">
            <h5 class="mb-0">Blogs</h5>
            <a href="<?php echo e(route('blogs.create')); ?>" class="btn btn-sm btn-primary">Add Blog</a>
        </div>
        <div class="card-body">
            <?php echo $__env->make('components.alert', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            <div class="table-responsive">
                <table class="table table-bordered w-100" id="dt-responsive">
                    <thead class="thead-light">
                        <tr>
                            <th>SL</th>
                            <th>Image</th>
                            <th>Title</th>
                            <th>Category</th>
                            <th>Author</th>
                            <th>Status</th>
                            <th>Published At</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $blogs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $blog): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr>
                                <td><?php echo e($loop->iteration); ?></td>
                                <td>
                                    <?php if(isset($blog) && $blog->image): ?>
                                        <div class="mt-2">
                                            <img src="<?php echo e(asset($blog->image)); ?>" width="120" alt="Blog Image">
                                        </div>
                                    <?php else: ?>
                                        <img src="<?php echo e(asset('images/no-image.png')); ?>" width="80" alt="No Image">
                                    <?php endif; ?>
                                </td>
                                <td><?php echo e($blog->title); ?></td>
                                <td><?php echo e($blog->category->name ?? ''); ?></td>
                                <td><?php echo e($blog->author ?? 'Admin'); ?></td>
                                <td><?php echo e(ucfirst($blog->status)); ?></td>
                                <td><?php echo e($blog->published_at ? date('Y-m-d', strtotime($blog->published_at)) : '-'); ?></td>
                                <td>
                                    <a href="<?php echo e(route('blogs.edit', $blog->id)); ?>" class="btn btn-sm btn-primary">
                                        Edit
                                    </a>
                                    <form action="<?php echo e(route('blogs.destroy', $blog->id)); ?>" method="POST"
                                        class="d-inline-block"
                                        onsubmit="return confirm('Are you sure you want to delete this blog?')">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button class="btn btn-sm btn-danger">Delete</button>
                                    </form>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="6" class="text-center">No blogs found.</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.masterAdmin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\TGP-hospital-site\resources\views/admin/blog/index.blade.php ENDPATH**/ ?>