<?php $__env->startSection('content'); ?>
<div class="container-xxl flex-grow-1 container-p-y">
  <div class="card">
    <div class="card-header d-flex justify-content-between align-items-center">
      <h5 class="mb-0">Categories</h5>
      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create categories')): ?>
        <a class="btn btn-primary btn-sm" href="<?php echo e(route('admin.categories.create')); ?>">Add Category</a>
      <?php endif; ?>
    </div>

    <div class="table-responsive">
      <table <?php if($categories->count() > 0): ?> id="categories-table" <?php endif; ?> class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Slug</th>
            <th>Status</th>
            <th>Action</th>
          </tr>
        </thead>
        <tbody>
          <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
              <td><?php echo e($category->name); ?></td>
              <td><?php echo e($category->slug); ?></td>
              <td><?php echo e($category->is_active ? 'Active' : 'Pending'); ?></td>
              <td>
                <div class="d-flex gap-2">
                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('update categories')): ?>
                    <a href="<?php echo e(route('admin.categories.edit', $category)); ?>" class="btn btn-sm btn-outline-primary">Edit</a>
                  <?php endif; ?>

                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete categories')): ?>
                    <form method="POST" action="<?php echo e(route('admin.categories.destroy', $category)); ?>">
                      <?php echo csrf_field(); ?>
                      <?php echo method_field('DELETE'); ?>
                      <button type="submit" class="btn btn-sm btn-outline-danger" onclick="return confirm('Delete this category?')">Delete</button>
                    </form>
                  <?php endif; ?>
                </div>
              </td>
            </tr>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr><td colspan="4" class="text-center py-4">No categories found.</td></tr>
          <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </tbody>
      </table>
    </div>

    <div class="card-body"><?php echo e($categories->links()); ?></div>
  </div>
</div>
<?php $__env->stopSection(); ?>

<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($categories->count() > 0): ?>
<?php $__env->startPush('script'); ?>
<script>
$(document).ready(function () {
  const $table = $('#categories-table');
  if (!$table.length) return;

  $table.DataTable({
    responsive: false,
    scrollX: true,
    pageLength: 10,
    lengthMenu: [5, 10, 25, 50, 100],
    order: [[0, 'asc']],
    columnDefs: [{ orderable: false, targets: -1 }]
  });
});
</script>
<?php $__env->stopPush(); ?>
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/wwwlifelinehealt/public_html/marketplace.lifelinehealthcare.com.pk/resources/views/admin/categories/index.blade.php ENDPATH**/ ?>